1 |
commit: 06fc8b7625def67f415342a225566ff453de99a4 |
2 |
Author: Julian Ospald <hasufell <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu Oct 1 09:29:25 2015 +0000 |
4 |
Commit: Julian Ospald <hasufell <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Oct 1 09:29:25 2015 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=06fc8b76 |
7 |
|
8 |
app-misc/ca-certificates: use app-misc/c_rehash |
9 |
|
10 |
Gentoo-Bug: 561852 |
11 |
Reviewed-By: SpanKY <vapier <AT> gentoo.org> |
12 |
|
13 |
.../ca-certificates-20150426.3.20-r1.ebuild | 189 +++++++++++++++++++++ |
14 |
1 file changed, 189 insertions(+) |
15 |
|
16 |
diff --git a/app-misc/ca-certificates/ca-certificates-20150426.3.20-r1.ebuild b/app-misc/ca-certificates/ca-certificates-20150426.3.20-r1.ebuild |
17 |
new file mode 100644 |
18 |
index 0000000..1e0f3f5 |
19 |
--- /dev/null |
20 |
+++ b/app-misc/ca-certificates/ca-certificates-20150426.3.20-r1.ebuild |
21 |
@@ -0,0 +1,189 @@ |
22 |
+# Copyright 1999-2015 Gentoo Foundation |
23 |
+# Distributed under the terms of the GNU General Public License v2 |
24 |
+# $Id$ |
25 |
+ |
26 |
+# The Debian ca-certificates package merely takes the CA database as it exists |
27 |
+# in the nss package and repackages it for use by openssl. |
28 |
+# |
29 |
+# The issue with using the compiled debs directly is two fold: |
30 |
+# - they do not update frequently enough for us to rely on them |
31 |
+# - they pull the CA database from nss tip of tree rather than the release |
32 |
+# |
33 |
+# So we take the Debian source tools and combine them with the latest nss |
34 |
+# release to produce (largely) the same end result. The difference is that |
35 |
+# now we know our cert database is kept in sync with nss and, if need be, |
36 |
+# can be sync with nss tip of tree more frequently to respond to bugs. |
37 |
+ |
38 |
+# When triaging bugs from users, here's some handy tips: |
39 |
+# - To see what cert is hitting errors, use openssl: |
40 |
+# openssl s_client -port 443 -CApath /etc/ssl/certs/ -host $HOSTNAME |
41 |
+# Focus on the errors written to stderr. |
42 |
+# |
43 |
+# - Look at the upstream log as to why certs were added/removed: |
44 |
+# https://hg.mozilla.org/projects/nss/log/tip/lib/ckfw/builtins/certdata.txt |
45 |
+# |
46 |
+# - If people want to add/remove certs, tell them to file w/mozilla: |
47 |
+# https://bugzilla.mozilla.org/enter_bug.cgi?product=NSS&component=CA%20Certificates&version=trunk |
48 |
+ |
49 |
+EAPI="4" |
50 |
+PYTHON_COMPAT=( python{2_7,3_3,3_4} ) |
51 |
+ |
52 |
+inherit eutils python-any-r1 |
53 |
+ |
54 |
+if [[ ${PV} == *.* ]] ; then |
55 |
+ # Compile from source ourselves. |
56 |
+ PRECOMPILED=false |
57 |
+ inherit versionator |
58 |
+ |
59 |
+ DEB_VER=$(get_version_component_range 1) |
60 |
+ NSS_VER=$(get_version_component_range 2-) |
61 |
+ RTM_NAME="NSS_${NSS_VER//./_}_RTM" |
62 |
+else |
63 |
+ # Debian precompiled version. |
64 |
+ PRECOMPILED=true |
65 |
+ inherit unpacker |
66 |
+fi |
67 |
+ |
68 |
+DESCRIPTION="Common CA Certificates PEM files" |
69 |
+HOMEPAGE="http://packages.debian.org/sid/ca-certificates" |
70 |
+NMU_PR="" |
71 |
+if ${PRECOMPILED} ; then |
72 |
+ SRC_URI="mirror://debian/pool/main/c/${PN}/${PN}_${PV}${NMU_PR:++nmu}${NMU_PR}_all.deb" |
73 |
+else |
74 |
+ SRC_URI="mirror://debian/pool/main/c/${PN}/${PN}_${DEB_VER}${NMU_PR:++nmu}${NMU_PR}.tar.xz |
75 |
+ ftp://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/${RTM_NAME}/src/nss-${NSS_VER}.tar.gz |
76 |
+ cacert? ( https://dev.gentoo.org/~anarchy/patches/nss-3.14.1-add_spi+cacerts_ca_certs.patch )" |
77 |
+fi |
78 |
+ |
79 |
+LICENSE="MPL-1.1" |
80 |
+SLOT="0" |
81 |
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x64-freebsd ~x86-freebsd ~hppa-hpux ~ia64-hpux ~x86-interix ~amd64-linux ~arm-linux ~ia64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris ~x86-winnt" |
82 |
+IUSE="" |
83 |
+${PRECOMPILED} || IUSE+=" +cacert" |
84 |
+ |
85 |
+DEPEND="" |
86 |
+if ${PRECOMPILED} ; then |
87 |
+ # platforms like AIX don't have a good ar |
88 |
+ DEPEND+=" |
89 |
+ kernel_AIX? ( app-arch/deb2targz ) |
90 |
+ !<sys-apps/portage-2.1.10.41" |
91 |
+fi |
92 |
+# c_rehash: we run `c_rehash`; newer version for alt-cert-paths #552540 |
93 |
+# debianutils: we run `run-parts` |
94 |
+RDEPEND="${DEPEND} |
95 |
+ >=app-misc/c_rehash-1.7-r1 |
96 |
+ sys-apps/debianutils" |
97 |
+ |
98 |
+if ! ${PRECOMPILED}; then |
99 |
+ DEPEND+=" ${PYTHON_DEPS}" |
100 |
+fi |
101 |
+ |
102 |
+S=${WORKDIR} |
103 |
+ |
104 |
+pkg_setup() { |
105 |
+ # For the conversion to having it in CONFIG_PROTECT_MASK, |
106 |
+ # we need to tell users about it once manually first. |
107 |
+ [[ -f "${EPREFIX}"/etc/env.d/98ca-certificates ]] \ |
108 |
+ || ewarn "You should run update-ca-certificates manually after etc-update" |
109 |
+} |
110 |
+ |
111 |
+src_unpack() { |
112 |
+ ${PRECOMPILED} || default |
113 |
+ |
114 |
+ mv ${PN}-*/ ${PN} || die |
115 |
+ |
116 |
+ # Do all the work in the image subdir to avoid conflicting with source |
117 |
+ # dirs in $WORKDIR. Need to perform everything in the offset #381937 |
118 |
+ mkdir -p "image/${EPREFIX}" |
119 |
+ cd "image/${EPREFIX}" || die |
120 |
+ |
121 |
+ ${PRECOMPILED} && unpacker_src_unpack |
122 |
+} |
123 |
+ |
124 |
+src_prepare() { |
125 |
+ cd "image/${EPREFIX}" || die |
126 |
+ if ! ${PRECOMPILED} ; then |
127 |
+ mkdir -p usr/sbin |
128 |
+ cp -p "${S}"/${PN}/sbin/update-ca-certificates usr/sbin/ || die |
129 |
+ |
130 |
+ if use cacert ; then |
131 |
+ pushd "${S}"/nss-${NSS_VER} >/dev/null |
132 |
+ epatch "${DISTDIR}"/nss-3.14.1-add_spi+cacerts_ca_certs.patch |
133 |
+ popd >/dev/null |
134 |
+ fi |
135 |
+ fi |
136 |
+ |
137 |
+ epatch "${FILESDIR}"/${PN}-20150426-root.patch |
138 |
+ local relp=$(echo "${EPREFIX}" | sed -e 's:[^/]\+:..:g') |
139 |
+ sed -i \ |
140 |
+ -e '/="$ROOT/s:ROOT/:ROOT'"${EPREFIX}"'/:' \ |
141 |
+ -e '/RELPATH="\.\./s:"$:'"${relp}"'":' \ |
142 |
+ usr/sbin/update-ca-certificates || die |
143 |
+ |
144 |
+ cd "${S}" |
145 |
+ epatch "${FILESDIR}"/${PN}-20150426-nss-certdata2pem-py3.patch #548374 |
146 |
+} |
147 |
+ |
148 |
+src_compile() { |
149 |
+ cd "image/${EPREFIX}" || die |
150 |
+ if ! ${PRECOMPILED} ; then |
151 |
+ python_setup |
152 |
+ local d="${S}/${PN}/mozilla" |
153 |
+ # Grab the database from the nss sources. |
154 |
+ cp "${S}"/nss-${NSS_VER}/nss/lib/ckfw/builtins/{certdata.txt,nssckbi.h} "${d}" || die |
155 |
+ emake -C "${d}" |
156 |
+ |
157 |
+ # Now move the files to the same places that the precompiled would. |
158 |
+ mkdir -p etc/ssl/certs etc/ca-certificates/update.d usr/share/ca-certificates/mozilla |
159 |
+ if use cacert ; then |
160 |
+ mkdir -p usr/share/ca-certificates/{cacert.org,spi-inc.org} |
161 |
+ mv "${d}"/CAcert_Inc..crt usr/share/ca-certificates/cacert.org/cacert.org_root.crt || die |
162 |
+ mv "${d}"/SPI_Inc..crt usr/share/ca-certificates/spi-inc.org/spi-cacert-2008.crt || die |
163 |
+ fi |
164 |
+ mv "${d}"/*.crt usr/share/ca-certificates/mozilla/ || die |
165 |
+ else |
166 |
+ mv usr/share/doc/{ca-certificates,${PF}} || die |
167 |
+ fi |
168 |
+ |
169 |
+ ( |
170 |
+ echo "# Automatically generated by ${CATEGORY}/${PF}" |
171 |
+ echo "# $(date -u)" |
172 |
+ echo "# Do not edit." |
173 |
+ cd usr/share/ca-certificates |
174 |
+ find * -name '*.crt' | LC_ALL=C sort |
175 |
+ ) > etc/ca-certificates.conf |
176 |
+ |
177 |
+ sh usr/sbin/update-ca-certificates --root "${S}/image" || die |
178 |
+} |
179 |
+ |
180 |
+src_install() { |
181 |
+ cp -pPR image/* "${D}"/ || die |
182 |
+ if ! ${PRECOMPILED} ; then |
183 |
+ cd ca-certificates |
184 |
+ doman sbin/*.8 |
185 |
+ dodoc debian/README.* examples/ca-certificates-local/README |
186 |
+ fi |
187 |
+ |
188 |
+ echo 'CONFIG_PROTECT_MASK="/etc/ca-certificates.conf"' > 98ca-certificates |
189 |
+ doenvd 98ca-certificates |
190 |
+} |
191 |
+ |
192 |
+pkg_postinst() { |
193 |
+ if [ -d "${EROOT}/usr/local/share/ca-certificates" ] ; then |
194 |
+ # if the user has local certs, we need to rebuild again |
195 |
+ # to include their stuff in the db. |
196 |
+ # However it's too overzealous when the user has custom certs in place. |
197 |
+ # --fresh is to clean up dangling symlinks |
198 |
+ "${EROOT}"/usr/sbin/update-ca-certificates --root "${ROOT}" |
199 |
+ fi |
200 |
+ |
201 |
+ local c badcerts=0 |
202 |
+ for c in $(find -L "${EROOT}"etc/ssl/certs/ -type l) ; do |
203 |
+ ewarn "Broken symlink for a certificate at $c" |
204 |
+ badcerts=1 |
205 |
+ done |
206 |
+ if [ $badcerts -eq 1 ]; then |
207 |
+ ewarn "Removing the following broken symlinks:" |
208 |
+ ewarn "$(find -L "${EROOT}"/etc/ssl/certs/ -type l -printf '%p -> %l\n' -delete)" |
209 |
+ fi |
210 |
+} |