Gentoo Archives: gentoo-commits

From: Sam James <sam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-misc/ca-certificates/
Date: Thu, 31 Mar 2022 00:47:38
Message-Id: 1648687578.48838aca4ee8c57f9a6a166428dd935d2e14e91d.sam@gentoo
1 commit: 48838aca4ee8c57f9a6a166428dd935d2e14e91d
2 Author: Sam James <sam <AT> gentoo <DOT> org>
3 AuthorDate: Thu Mar 31 00:46:14 2022 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Thu Mar 31 00:46:18 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=48838aca
7
8 app-misc/ca-certificates: add 20211016.3.76.1
9
10 Pulling in 3.76.1 NSS to aid debugging in some
11 issues with people.redhat.com. This doesn't
12 resolve it but our last NSS version (for
13 ca-certs) -> 3.76.1 has a fair amount of updates,
14 so let's drag it in.
15
16 Signed-off-by: Sam James <sam <AT> gentoo.org>
17
18 app-misc/ca-certificates/Manifest | 1 +
19 .../ca-certificates-20211016.3.76.1.ebuild | 198 +++++++++++++++++++++
20 2 files changed, 199 insertions(+)
21
22 diff --git a/app-misc/ca-certificates/Manifest b/app-misc/ca-certificates/Manifest
23 index c16439df7078..6a311f5ee131 100644
24 --- a/app-misc/ca-certificates/Manifest
25 +++ b/app-misc/ca-certificates/Manifest
26 @@ -3,4 +3,5 @@ DIST ca-certificates_20211016.tar.xz 239608 BLAKE2B 9b4730b54fd9f472fe4e5427bf91
27 DIST nss-3.66.tar.gz 82401896 BLAKE2B ae369899af681e1c6ea8046098c83da08c2112b16d85a0eaee46e9d4f97dfb3f7c3e97eb681ec947b5648446c6db51e8f1396ec9bb6c731c9678ecf925e7f743 SHA512 327129cb065a8c19246e081e3cbc4798c81dc52eab6ee366eade151e9d308990592075c52a7c672165725fd855a0c539d56a803c26ef066561c584d693e0e467
28 DIST nss-3.71.tar.gz 83927933 BLAKE2B a8d683b9f9bff5390e0378ab0d55156f7cc69a52b0667658738e67e920548965e7a276dc4104547b2e6a1a6d18325c3f85b955b9c12d7f071d10930b5264207e SHA512 a4a724dc4e8677965b6245ea2309790d31ec7719658e2b349eb67c9008082132c76277340d15e4fdd8d2fe1f560ae6803fb038d023c3dfd2e3772fa3b77720e2
29 DIST nss-3.72.tar.gz 83928300 BLAKE2B d92889e27e99095a18090eff0c08b8653ef1f53f4954f5bd018df2f2903647bc71f217159bb4b11f0d6b4fb289fda20bffa2d1d207d1836dcfc33dbd4bedf511 SHA512 1d818d2ef85735837275059fecf68d57e48152f0348ea54887c29171cf029b6944e94d99a8cd96e580a81edb678b79c55515ac0516e27daf6b290c34baed9ebb
30 +DIST nss-3.76.1.tar.gz 84626067 BLAKE2B 5112b208f3b9528a34b1d8e3e669db067ecb79719ad16793b8cd556a02910cc29f899f2a57e959c50048c5d2b94eb3b9855208dd3c20646a719c971561f6ea4c SHA512 80d32a97501cbc05312caa5cec54fe6dd8708f01e6d15693e36a40d70433be7a35565fcc5fadfc324c998ee9093b10b2f7a89643882f06a850eda4ffd3b19c54
31 DIST nss-cacert-class1-class3-r2.patch 21925 BLAKE2B 7627ff9a09f084c19d72d0490676865e3cab3ca7c920ae1ce4bea2db664f37fd0aa84fcda919809a516891ab2a62e2e7a43a9d6ada4c231adfe4c216525fac7d SHA512 1ce6ff9ab310aaca9005eafb461338b291df8523cc7044e096cd75774ce746c26eed19ec6bb2643c6c67f94650f2f309463492d80a90568f38ce2557f8ada2f4
32
33 diff --git a/app-misc/ca-certificates/ca-certificates-20211016.3.76.1.ebuild b/app-misc/ca-certificates/ca-certificates-20211016.3.76.1.ebuild
34 new file mode 100644
35 index 000000000000..864b59789c1f
36 --- /dev/null
37 +++ b/app-misc/ca-certificates/ca-certificates-20211016.3.76.1.ebuild
38 @@ -0,0 +1,198 @@
39 +# Copyright 1999-2022 Gentoo Authors
40 +# Distributed under the terms of the GNU General Public License v2
41 +
42 +# The Debian ca-certificates package merely takes the CA database as it exists
43 +# in the nss package and repackages it for use by openssl.
44 +#
45 +# The issue with using the compiled debs directly is two fold:
46 +# - they do not update frequently enough for us to rely on them
47 +# - they pull the CA database from nss tip of tree rather than the release
48 +#
49 +# So we take the Debian source tools and combine them with the latest nss
50 +# release to produce (largely) the same end result. The difference is that
51 +# now we know our cert database is kept in sync with nss and, if need be,
52 +# can be sync with nss tip of tree more frequently to respond to bugs.
53 +
54 +# When triaging user reports, refer to our wiki for tips:
55 +# https://wiki.gentoo.org/wiki/Certificates#Debugging_certificate_issues
56 +
57 +EAPI=7
58 +
59 +PYTHON_COMPAT=( python3_{7..10} )
60 +
61 +inherit python-any-r1
62 +
63 +if [[ ${PV} == *.* ]] ; then
64 + # Compile from source ourselves.
65 + PRECOMPILED=false
66 +
67 + DEB_VER=$(ver_cut 1)
68 + NSS_VER=$(ver_cut 2-)
69 + RTM_NAME="NSS_${NSS_VER//./_}_RTM"
70 +else
71 + # Debian precompiled version.
72 + PRECOMPILED=true
73 + inherit unpacker
74 +fi
75 +
76 +DESCRIPTION="Common CA Certificates PEM files"
77 +HOMEPAGE="https://packages.debian.org/sid/ca-certificates"
78 +NMU_PR=""
79 +if ${PRECOMPILED} ; then
80 + SRC_URI="mirror://debian/pool/main/c/${PN}/${PN}_${PV}${NMU_PR:++nmu}${NMU_PR}_all.deb"
81 +else
82 + SRC_URI="mirror://debian/pool/main/c/${PN}/${PN}_${DEB_VER}${NMU_PR:++nmu}${NMU_PR}.tar.xz
83 + https://archive.mozilla.org/pub/security/nss/releases/${RTM_NAME}/src/nss-${NSS_VER}.tar.gz
84 + cacert? (
85 + https://dev.gentoo.org/~whissi/dist/ca-certificates/nss-cacert-class1-class3-r2.patch
86 + )"
87 +fi
88 +
89 +LICENSE="MPL-1.1"
90 +SLOT="0"
91 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris ~x86-winnt"
92 +IUSE=""
93 +${PRECOMPILED} || IUSE+=" cacert"
94 +
95 +# c_rehash: we run `c_rehash`
96 +# debianutils: we run `run-parts`
97 +CDEPEND="app-misc/c_rehash
98 + sys-apps/debianutils"
99 +
100 +BDEPEND="${CDEPEND}"
101 +if ! ${PRECOMPILED} ; then
102 + BDEPEND+=" ${PYTHON_DEPS}"
103 +fi
104 +
105 +DEPEND=""
106 +if ${PRECOMPILED} ; then
107 + DEPEND+=" !<sys-apps/portage-2.1.10.41"
108 +fi
109 +
110 +RDEPEND="${CDEPEND}
111 + ${DEPEND}"
112 +
113 +S=${WORKDIR}
114 +
115 +pkg_setup() {
116 + # For the conversion to having it in CONFIG_PROTECT_MASK,
117 + # we need to tell users about it once manually first.
118 + [[ -f "${EPREFIX}"/etc/env.d/98ca-certificates ]] \
119 + || ewarn "You should run update-ca-certificates manually after etc-update"
120 +
121 + if ! ${PRECOMPILED} ; then
122 + python-any-r1_pkg_setup
123 + fi
124 +}
125 +
126 +src_unpack() {
127 + if ! ${PRECOMPILED} ; then
128 + default
129 + # Initial 20200601 deb release had bad naming inside the debian source tarball.
130 + DEB_S="${WORKDIR}/${PN}-${DEB_VER}"
131 + DEB_BAD_S="${WORKDIR}/work"
132 + if [[ -d "${DEB_BAD_S}" ]] && [[ ! -d "${DEB_S}" ]] ; then
133 + mv "${DEB_BAD_S}" "${DEB_S}"
134 + fi
135 + fi
136 +
137 + # Do all the work in the image subdir to avoid conflicting with source
138 + # dirs in ${WORKDIR}. Need to perform everything in the offset #381937
139 + mkdir -p "image/${EPREFIX}" || die
140 + cd "image/${EPREFIX}" || die
141 +
142 + ${PRECOMPILED} && unpacker_src_unpack
143 +}
144 +
145 +src_prepare() {
146 + cd "image/${EPREFIX}" || die
147 + if ! ${PRECOMPILED} ; then
148 + mkdir -p usr/sbin || die
149 + cp -p "${S}"/${PN}-${DEB_VER}/sbin/update-ca-certificates \
150 + usr/sbin/ || die
151 +
152 + if use cacert ; then
153 + pushd "${S}"/nss-${NSS_VER} >/dev/null || die
154 + eapply "${DISTDIR}"/nss-cacert-class1-class3-r2.patch
155 + popd >/dev/null || die
156 + fi
157 + fi
158 +
159 + default
160 + eapply -p2 "${FILESDIR}"/${PN}-20150426-root.patch
161 +
162 + pushd "${S}/${PN}-${DEB_VER}" >/dev/null || die
163 + eapply "${FILESDIR}"/${PN}-20211016.3.72-no-cryptography.patch
164 + popd >/dev/null || die
165 +
166 + local relp=$(echo "${EPREFIX}" | sed -e 's:[^/]\+:..:g')
167 + sed -i \
168 + -e '/="$ROOT/s:ROOT:ROOT'"${EPREFIX}"':' \
169 + -e '/RELPATH="\.\./s:"$:'"${relp}"'":' \
170 + -e 's/openssl rehash/c_rehash/' \
171 + usr/sbin/update-ca-certificates || die
172 +}
173 +
174 +src_compile() {
175 + cd "image/${EPREFIX}" || die
176 + if ! ${PRECOMPILED} ; then
177 + local d="${S}/${PN}-${DEB_VER}/mozilla" c="usr/share/${PN}"
178 +
179 + # Grab the database from the nss sources.
180 + cp "${S}"/nss-${NSS_VER}/nss/lib/ckfw/builtins/{certdata.txt,nssckbi.h} "${d}" || die
181 + emake -C "${d}"
182 +
183 + # Now move the files to the same places that the precompiled would.
184 + mkdir -p etc/ssl/certs \
185 + etc/ca-certificates/update.d \
186 + "${c}"/mozilla \
187 + || die
188 + if use cacert ; then
189 + mkdir -p "${c}"/cacert.org || die
190 + mv "${d}"/CA_Cert_Signing_Authority.crt \
191 + "${c}"/cacert.org/cacert.org_class1.crt || die
192 + mv "${d}"/CAcert_Class_3_Root.crt \
193 + "${c}"/cacert.org/cacert.org_class3.crt || die
194 + fi
195 + mv "${d}"/*.crt "${c}"/mozilla/ || die
196 + else
197 + mv usr/share/doc/{ca-certificates,${PF}} || die
198 + fi
199 +
200 + (
201 + echo "# Automatically generated by ${CATEGORY}/${PF}"
202 + echo "# $(date -u)"
203 + echo "# Do not edit."
204 + cd "${c}" || die
205 + find * -name '*.crt' | LC_ALL=C sort
206 + ) > etc/ca-certificates.conf
207 +
208 + sh usr/sbin/update-ca-certificates --root "${S}/image" || die
209 +}
210 +
211 +src_install() {
212 + cp -pPR image/* "${D}"/ || die
213 + if ! ${PRECOMPILED} ; then
214 + cd ${PN}-${DEB_VER} || die
215 + doman sbin/*.8
216 + dodoc debian/README.* examples/ca-certificates-local/README
217 + fi
218 +
219 + echo 'CONFIG_PROTECT_MASK="/etc/ca-certificates.conf"' > 98ca-certificates
220 + doenvd 98ca-certificates
221 +}
222 +
223 +pkg_postinst() {
224 + if [[ -d "${EROOT}/usr/local/share/ca-certificates" ]] ; then
225 + # if the user has local certs, we need to rebuild again
226 + # to include their stuff in the db.
227 + # However it's too overzealous when the user has custom certs in place.
228 + # --fresh is to clean up dangling symlinks
229 + "${EROOT}"/usr/sbin/update-ca-certificates --root "${ROOT}"
230 + fi
231 +
232 + if [[ -n "$(find -L "${EROOT}"/etc/ssl/certs/ -type l)" ]] ; then
233 + ewarn "Removing the following broken symlinks:"
234 + ewarn "$(find -L "${EROOT}"/etc/ssl/certs/ -type l -printf '%p -> %l\n' -delete)"
235 + fi
236 +}