diff options
| author | Alexander Kanavin <alex@linutronix.de> | 2025-11-10 23:21:45 +1300 |
|---|---|---|
| committer | Steve Sakoman <steve@sakoman.com> | 2025-11-14 06:45:29 -0800 |
| commit | 8951fdb63a38faa062548009dda28dae51abb90d (patch) | |
| tree | f2eba699c334615fb6c516e12f1b8cb970c134d9 | |
| parent | 3ad2146a1bf6cf0df8e89ee5d38b8154e348f898 (diff) | |
| download | poky-8951fdb63a38faa062548009dda28dae51abb90d.tar.gz | |
ca-certificates: submit sysroot patch upstream, drop default-sysroot.patch
ca-certificates/0002-update-ca-certificates-use-SYSROOT.patch
was using a non-standard environment variable, and was replaced
with a patch that adds a command line option (and then this
was submitted upstream). ca-certificates recipe was tweaked accordingly,
and nothing else in core or meta-oe is using update-ca-certificates.
Drop default-sysroot.patch as the use case is unclear: sysroot
is explicitly specified in all known invocations of update-ca-certificate,
and if there's a place where it isn't, then update-ca-certificates
will error out trying to write to /etc, and should be fixed to
explicitly specify the sysroot.
(From OE-Core rev: a80185fd72a2be183783b0e464c07f1043d7dd37)
Signed-off-by: Alexander Kanavin <alex@linutronix.de>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 90d9f0ba674d4fe8e9291f0513c13dff3775c545)
Signed-off-by: Ankur Tyagi <ankur.tyagi85@gmail.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
5 files changed, 49 insertions, 118 deletions
diff --git a/meta/recipes-support/ca-certificates/ca-certificates/0002-sbin-update-ca-certificates-add-a-sysroot-option.patch b/meta/recipes-support/ca-certificates/ca-certificates/0002-sbin-update-ca-certificates-add-a-sysroot-option.patch new file mode 100644 index 0000000000..ba5bb69657 --- /dev/null +++ b/meta/recipes-support/ca-certificates/ca-certificates/0002-sbin-update-ca-certificates-add-a-sysroot-option.patch | |||
| @@ -0,0 +1,36 @@ | |||
| 1 | From d6bb773745c2e95fd1a414e916fbed64e0d8df66 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Alexander Kanavin <alex@linutronix.de> | ||
| 3 | Date: Mon, 31 Mar 2025 17:42:25 +0200 | ||
| 4 | Subject: [PATCH] sbin/update-ca-certificates: add a --sysroot option | ||
| 5 | |||
| 6 | This allows using the script in cross-compilation environments | ||
| 7 | where the script needs to prefix the sysroot to every other | ||
| 8 | directory it operates on. There are individual options | ||
| 9 | to set those directories, but using a common prefix option | ||
| 10 | instead is a lot less clutter and more robust. | ||
| 11 | |||
| 12 | Upstream-Status: Submitted [https://salsa.debian.org/debian/ca-certificates/-/merge_requests/13] | ||
| 13 | Signed-off-by: Alexander Kanavin <alex@linutronix.de> | ||
| 14 | --- | ||
| 15 | sbin/update-ca-certificates | 8 ++++++++ | ||
| 16 | 1 file changed, 8 insertions(+) | ||
| 17 | |||
| 18 | diff --git a/sbin/update-ca-certificates b/sbin/update-ca-certificates | ||
| 19 | index 4bb77a0..1e737b9 100755 | ||
| 20 | --- a/sbin/update-ca-certificates | ||
| 21 | +++ b/sbin/update-ca-certificates | ||
| 22 | @@ -59,6 +59,14 @@ do | ||
| 23 | --hooksdir) | ||
| 24 | shift | ||
| 25 | HOOKSDIR="$1";; | ||
| 26 | + --sysroot) | ||
| 27 | + shift | ||
| 28 | + SYSROOT="$1" | ||
| 29 | + CERTSCONF="$1/${CERTSCONF}" | ||
| 30 | + CERTSDIR="$1/${CERTSDIR}" | ||
| 31 | + LOCALCERTSDIR="$1/${LOCALCERTSDIR}" | ||
| 32 | + ETCCERTSDIR="$1/${ETCCERTSDIR}" | ||
| 33 | + HOOKSDIR="$1/${HOOKSDIR}";; | ||
| 34 | --help|-h|*) | ||
| 35 | echo "$0: [--verbose] [--fresh]" | ||
| 36 | exit;; | ||
diff --git a/meta/recipes-support/ca-certificates/ca-certificates/0002-update-ca-certificates-use-SYSROOT.patch b/meta/recipes-support/ca-certificates/ca-certificates/0002-update-ca-certificates-use-SYSROOT.patch deleted file mode 100644 index 48c69f0cbc..0000000000 --- a/meta/recipes-support/ca-certificates/ca-certificates/0002-update-ca-certificates-use-SYSROOT.patch +++ /dev/null | |||
| @@ -1,46 +0,0 @@ | |||
| 1 | From cdb53438bae194c1281c31374a901ad7ee460408 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Andreas Oberritter <obi@opendreambox.org> | ||
| 3 | Date: Tue, 19 Mar 2013 17:14:33 +0100 | ||
| 4 | Subject: [PATCH] update-ca-certificates: use $SYSROOT | ||
| 5 | |||
| 6 | Upstream-Status: Pending | ||
| 7 | |||
| 8 | Signed-off-by: Andreas Oberritter <obi@opendreambox.org> | ||
| 9 | --- | ||
| 10 | sbin/update-ca-certificates | 14 +++++++------- | ||
| 11 | 1 file changed, 7 insertions(+), 7 deletions(-) | ||
| 12 | |||
| 13 | diff --git a/sbin/update-ca-certificates b/sbin/update-ca-certificates | ||
| 14 | index 5a0a1da..36cdd9a 100755 | ||
| 15 | --- a/sbin/update-ca-certificates | ||
| 16 | +++ b/sbin/update-ca-certificates | ||
| 17 | @@ -24,12 +24,12 @@ | ||
| 18 | verbose=0 | ||
| 19 | fresh=0 | ||
| 20 | default=0 | ||
| 21 | -CERTSCONF=/etc/ca-certificates.conf | ||
| 22 | -CERTSDIR=/usr/share/ca-certificates | ||
| 23 | -LOCALCERTSDIR=/usr/local/share/ca-certificates | ||
| 24 | +CERTSCONF=$SYSROOT/etc/ca-certificates.conf | ||
| 25 | +CERTSDIR=$SYSROOT/usr/share/ca-certificates | ||
| 26 | +LOCALCERTSDIR=$SYSROOT/usr/local/share/ca-certificates | ||
| 27 | CERTBUNDLE=ca-certificates.crt | ||
| 28 | -ETCCERTSDIR=/etc/ssl/certs | ||
| 29 | -HOOKSDIR=/etc/ca-certificates/update.d | ||
| 30 | +ETCCERTSDIR=$SYSROOT/etc/ssl/certs | ||
| 31 | +HOOKSDIR=$SYSROOT/etc/ca-certificates/update.d | ||
| 32 | |||
| 33 | while [ $# -gt 0 ]; | ||
| 34 | do | ||
| 35 | @@ -92,9 +92,9 @@ add() { | ||
| 36 | PEM="$ETCCERTSDIR/$(basename "$CERT" .crt | sed -e 's/ /_/g' \ | ||
| 37 | -e 's/[()]/=/g' \ | ||
| 38 | -e 's/,/_/g').pem" | ||
| 39 | - if ! test -e "$PEM" || [ "$(readlink "$PEM")" != "$CERT" ] | ||
| 40 | + if ! test -e "$PEM" || [ "$(readlink "$PEM")" != "${CERT##$SYSROOT}" ] | ||
| 41 | then | ||
| 42 | - ln -sf "$CERT" "$PEM" | ||
| 43 | + ln -sf "${CERT##$SYSROOT}" "$PEM" | ||
| 44 | echo "+$PEM" >> "$ADDED" | ||
| 45 | fi | ||
| 46 | # Add trailing newline to certificate, if it is missing (#635570) | ||
diff --git a/meta/recipes-support/ca-certificates/ca-certificates/0003-update-ca-certificates-use-relative-symlinks-from-ET.patch b/meta/recipes-support/ca-certificates/ca-certificates/0003-update-ca-certificates-use-relative-symlinks-from-ET.patch index 214f88909a..929945b56f 100644 --- a/meta/recipes-support/ca-certificates/ca-certificates/0003-update-ca-certificates-use-relative-symlinks-from-ET.patch +++ b/meta/recipes-support/ca-certificates/ca-certificates/0003-update-ca-certificates-use-relative-symlinks-from-ET.patch | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | From 38d47c53749c6f16d5d7993410b256116e0ee0b8 Mon Sep 17 00:00:00 2001 | 1 | From a69933f96a8675369de702bdb55e57dc21f65e7f Mon Sep 17 00:00:00 2001 |
| 2 | From: =?UTF-8?q?Andr=C3=A9=20Draszik?= <andre.draszik@jci.com> | 2 | From: =?UTF-8?q?Andr=C3=A9=20Draszik?= <andre.draszik@jci.com> |
| 3 | Date: Wed, 28 Mar 2018 16:45:05 +0100 | 3 | Date: Wed, 28 Mar 2018 16:45:05 +0100 |
| 4 | Subject: [PATCH] update-ca-certificates: use relative symlinks from | 4 | Subject: [PATCH] update-ca-certificates: use relative symlinks from |
| @@ -45,26 +45,26 @@ Signed-off-by: André Draszik <andre.draszik@jci.com> | |||
| 45 | 1 file changed, 4 insertions(+), 2 deletions(-) | 45 | 1 file changed, 4 insertions(+), 2 deletions(-) |
| 46 | 46 | ||
| 47 | diff --git a/sbin/update-ca-certificates b/sbin/update-ca-certificates | 47 | diff --git a/sbin/update-ca-certificates b/sbin/update-ca-certificates |
| 48 | index f7d0dbf..97a589c 100755 | 48 | index 1e737b9..8510082 100755 |
| 49 | --- a/sbin/update-ca-certificates | 49 | --- a/sbin/update-ca-certificates |
| 50 | +++ b/sbin/update-ca-certificates | 50 | +++ b/sbin/update-ca-certificates |
| 51 | @@ -29,6 +29,7 @@ CERTSDIR=$SYSROOT/usr/share/ca-certificates | 51 | @@ -30,6 +30,7 @@ LOCALCERTSDIR=/usr/local/share/ca-certificates |
| 52 | LOCALCERTSDIR=$SYSROOT/usr/local/share/ca-certificates | ||
| 53 | CERTBUNDLE=ca-certificates.crt | 52 | CERTBUNDLE=ca-certificates.crt |
| 54 | ETCCERTSDIR=$SYSROOT/etc/ssl/certs | 53 | ETCCERTSDIR=/etc/ssl/certs |
| 54 | HOOKSDIR=/etc/ca-certificates/update.d | ||
| 55 | +FSROOT=../../../ # to get from $ETCCERTSDIR to the root of the file system | 55 | +FSROOT=../../../ # to get from $ETCCERTSDIR to the root of the file system |
| 56 | HOOKSDIR=$SYSROOT/etc/ca-certificates/update.d | ||
| 57 | 56 | ||
| 58 | while [ $# -gt 0 ]; | 57 | while [ $# -gt 0 ]; |
| 59 | @@ -125,9 +126,10 @@ add() { | 58 | do |
| 59 | @@ -100,9 +101,10 @@ add() { | ||
| 60 | PEM="$ETCCERTSDIR/$(basename "$CERT" .crt | sed -e 's/ /_/g' \ | 60 | PEM="$ETCCERTSDIR/$(basename "$CERT" .crt | sed -e 's/ /_/g' \ |
| 61 | -e 's/[()]/=/g' \ | 61 | -e 's/[()]/=/g' \ |
| 62 | -e 's/,/_/g').pem" | 62 | -e 's/,/_/g').pem" |
| 63 | - if ! test -e "$PEM" || [ "$(readlink "$PEM")" != "${CERT##$SYSROOT}" ] | 63 | - if ! test -e "$PEM" || [ "$(readlink "$PEM")" != "$CERT" ] |
| 64 | + DST="$(echo ${CERT} | sed -e "s|^$SYSROOT||" -e "s|^/|$FSROOT|" )" | 64 | + DST="$(echo ${CERT} | sed -e "s|^$SYSROOT||" -e "s|^/|$FSROOT|" )" |
| 65 | + if ! test -e "$PEM" || [ "$(readlink "$PEM")" != "${DST}" ] | 65 | + if ! test -e "$PEM" || [ "$(readlink "$PEM")" != "${DST}" ] |
| 66 | then | 66 | then |
| 67 | - ln -sf "${CERT##$SYSROOT}" "$PEM" | 67 | - ln -sf "$CERT" "$PEM" |
| 68 | + ln -sf "${DST}" "$PEM" | 68 | + ln -sf "${DST}" "$PEM" |
| 69 | echo "+$PEM" >> "$ADDED" | 69 | echo "+$PEM" >> "$ADDED" |
| 70 | fi | 70 | fi |
diff --git a/meta/recipes-support/ca-certificates/ca-certificates/default-sysroot.patch b/meta/recipes-support/ca-certificates/ca-certificates/default-sysroot.patch deleted file mode 100644 index c2a54c0096..0000000000 --- a/meta/recipes-support/ca-certificates/ca-certificates/default-sysroot.patch +++ /dev/null | |||
| @@ -1,58 +0,0 @@ | |||
| 1 | From 50aadd3eb1c4be43d3decdeb60cede2de5a687be Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Christopher Larson <chris_larson@mentor.com> | ||
| 3 | Date: Fri, 23 Aug 2013 12:26:14 -0700 | ||
| 4 | Subject: [PATCH] ca-certificates: add recipe (version 20130610) | ||
| 5 | |||
| 6 | Upstream-Status: Pending | ||
| 7 | |||
| 8 | update-ca-certificates: find SYSROOT relative to its own location | ||
| 9 | |||
| 10 | This makes the script relocatable. | ||
| 11 | --- | ||
| 12 | sbin/update-ca-certificates | 33 +++++++++++++++++++++++++++++++++ | ||
| 13 | 1 file changed, 33 insertions(+) | ||
| 14 | |||
| 15 | diff --git a/sbin/update-ca-certificates b/sbin/update-ca-certificates | ||
| 16 | index 2d3e1fe..f7d0dbf 100755 | ||
| 17 | --- a/sbin/update-ca-certificates | ||
| 18 | +++ b/sbin/update-ca-certificates | ||
| 19 | @@ -66,6 +66,39 @@ do | ||
| 20 | shift | ||
| 21 | done | ||
| 22 | |||
| 23 | +if [ -z "$SYSROOT" ]; then | ||
| 24 | + local_which () { | ||
| 25 | + if [ $# -lt 1 ]; then | ||
| 26 | + return 1 | ||
| 27 | + fi | ||
| 28 | + | ||
| 29 | + ( | ||
| 30 | + IFS=: | ||
| 31 | + for entry in $PATH; do | ||
| 32 | + if [ -x "$entry/$1" ]; then | ||
| 33 | + echo "$entry/$1" | ||
| 34 | + exit 0 | ||
| 35 | + fi | ||
| 36 | + done | ||
| 37 | + exit 1 | ||
| 38 | + ) | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | + case "$0" in | ||
| 42 | + */*) | ||
| 43 | + sbindir=$(cd ${0%/*} && pwd) | ||
| 44 | + ;; | ||
| 45 | + *) | ||
| 46 | + sbindir=$(cd $(dirname $(local_which $0)) && pwd) | ||
| 47 | + ;; | ||
| 48 | + esac | ||
| 49 | + prefix=${sbindir%/*} | ||
| 50 | + SYSROOT=${prefix%/*} | ||
| 51 | + if [ ! -d "$SYSROOT/usr/share/ca-certificates" ]; then | ||
| 52 | + SYSROOT= | ||
| 53 | + fi | ||
| 54 | +fi | ||
| 55 | + | ||
| 56 | if [ ! -s "$CERTSCONF" ] | ||
| 57 | then | ||
| 58 | fresh=1 | ||
diff --git a/meta/recipes-support/ca-certificates/ca-certificates_20241223.bb b/meta/recipes-support/ca-certificates/ca-certificates_20241223.bb index bbdc7dd68d..676e9e0c78 100644 --- a/meta/recipes-support/ca-certificates/ca-certificates_20241223.bb +++ b/meta/recipes-support/ca-certificates/ca-certificates_20241223.bb | |||
| @@ -16,9 +16,8 @@ PACKAGE_WRITE_DEPS += "openssl-native debianutils-native" | |||
| 16 | 16 | ||
| 17 | SRC_URI[sha256sum] = "dd8286d0a9dd35c756fea5f1df3fed1510fb891f376903891b003cd9b1ad7e03" | 17 | SRC_URI[sha256sum] = "dd8286d0a9dd35c756fea5f1df3fed1510fb891f376903891b003cd9b1ad7e03" |
| 18 | SRC_URI = "${DEBIAN_MIRROR}/main/c/ca-certificates/${BPN}_${PV}.tar.xz \ | 18 | SRC_URI = "${DEBIAN_MIRROR}/main/c/ca-certificates/${BPN}_${PV}.tar.xz \ |
| 19 | file://0002-update-ca-certificates-use-SYSROOT.patch \ | ||
| 20 | file://0001-update-ca-certificates-don-t-use-Debianisms-in-run-p.patch \ | 19 | file://0001-update-ca-certificates-don-t-use-Debianisms-in-run-p.patch \ |
| 21 | file://default-sysroot.patch \ | 20 | file://0002-sbin-update-ca-certificates-add-a-sysroot-option.patch \ |
| 22 | file://0003-update-ca-certificates-use-relative-symlinks-from-ET.patch \ | 21 | file://0003-update-ca-certificates-use-relative-symlinks-from-ET.patch \ |
| 23 | file://0001-Revert-mozilla-certdata2pem.py-print-a-warning-for-e.patch \ | 22 | file://0001-Revert-mozilla-certdata2pem.py-print-a-warning-for-e.patch \ |
| 24 | " | 23 | " |
| @@ -62,7 +61,7 @@ do_install:append:class-target () { | |||
| 62 | } | 61 | } |
| 63 | 62 | ||
| 64 | pkg_postinst:${PN}:class-target () { | 63 | pkg_postinst:${PN}:class-target () { |
| 65 | SYSROOT="$D" $D${sbindir}/update-ca-certificates | 64 | $D${sbindir}/update-ca-certificates --sysroot $D |
| 66 | } | 65 | } |
| 67 | 66 | ||
| 68 | CONFFILES:${PN} += "${sysconfdir}/ca-certificates.conf" | 67 | CONFFILES:${PN} += "${sysconfdir}/ca-certificates.conf" |
| @@ -71,11 +70,11 @@ CONFFILES:${PN} += "${sysconfdir}/ca-certificates.conf" | |||
| 71 | # we just run update-ca-certificate from do_install() for nativesdk. | 70 | # we just run update-ca-certificate from do_install() for nativesdk. |
| 72 | CONFFILES:${PN}:append:class-nativesdk = " ${sysconfdir}/ssl/certs/ca-certificates.crt" | 71 | CONFFILES:${PN}:append:class-nativesdk = " ${sysconfdir}/ssl/certs/ca-certificates.crt" |
| 73 | do_install:append:class-nativesdk () { | 72 | do_install:append:class-nativesdk () { |
| 74 | SYSROOT="${D}${SDKPATHNATIVE}" ${D}${sbindir}/update-ca-certificates | 73 | ${D}${sbindir}/update-ca-certificates --sysroot ${D}${SDKPATHNATIVE} |
| 75 | } | 74 | } |
| 76 | 75 | ||
| 77 | do_install:append:class-native () { | 76 | do_install:append:class-native () { |
| 78 | SYSROOT="${D}${base_prefix}" ${D}${sbindir}/update-ca-certificates | 77 | ${D}${sbindir}/update-ca-certificates --sysroot ${D}${base_prefix} |
| 79 | } | 78 | } |
| 80 | 79 | ||
| 81 | RDEPENDS:${PN}:append:class-target = " openssl-bin openssl" | 80 | RDEPENDS:${PN}:append:class-target = " openssl-bin openssl" |
