[1/9] isar-bootstrap: avoid forced early expansion of key vars

Message ID 20240402172813.418770-2-chris.larson@siemens.com
State Superseded, archived
Headers show
Series Add more signature cachability tests to the testsuite | expand

Commit Message

kergoth@gmail.com April 2, 2024, 5:28 p.m. UTC
From: Christopher Larson <chris.larson@seimens.com>

Rather than appending the items from the expanded key variables into
SRC_URI individually, which means there's no way to use tools like
vardepvalue or vardepexclude to control signature generation, append the
unexpanded variables to the SRC_URI directly. This avoids issues with
shared state reuse for the isar-bootstrap packages.

Signed-off-by: Christopher Larson <chris.larson@siemens.com>
---
 meta/recipes-core/isar-bootstrap/isar-bootstrap.inc | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

Comments

MOESSBAUER, Felix April 3, 2024, 6:54 a.m. UTC | #1
On Tue, 2024-04-02 at 17:28 +0000, kergoth@gmail.com wrote:
> From: Christopher Larson <chris.larson@seimens.com>
------------------------------------------^

Hi, please resend the whole series with a correct "From:".

Felix

> 
> Rather than appending the items from the expanded key variables into
> SRC_URI individually, which means there's no way to use tools like
> vardepvalue or vardepexclude to control signature generation, append
> the
> unexpanded variables to the SRC_URI directly. This avoids issues with
> shared state reuse for the isar-bootstrap packages.
> 
> Signed-off-by: Christopher Larson <chris.larson@siemens.com>
> ---
>  meta/recipes-core/isar-bootstrap/isar-bootstrap.inc | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
> b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
> index 17f19fd8..de14e946 100644
> --- a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
> +++ b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
> @@ -10,7 +10,9 @@ LIC_FILES_CHKSUM =
> "file://${LAYERDIR_core}/licenses/COPYING.GPLv2;md5=751419260
>  FILESPATH:prepend := "${THISDIR}/files:"
>  SRC_URI = " \
>      file://locale \
> -    file://chroot-setup.sh"
> +    file://chroot-setup.sh \
> +    ${DISTRO_BOOTSTRAP_KEYS} \
> +    ${THIRD_PARTY_APT_KEYS}"
>  PV = "1.0"
>  
>  BOOTSTRAP_FOR_HOST ?= "0"
> @@ -22,6 +24,8 @@ APTSRCS = "${WORKDIR}/apt-sources"
>  APTSRCS_INIT = "${WORKDIR}/apt-sources-init"
>  DISTRO_BOOTSTRAP_KEYFILES = ""
>  THIRD_PARTY_APT_KEYFILES = ""
> +DISTRO_BOOTSTRAP_KEYS ?= ""
> +THIRD_PARTY_APT_KEYS ?= ""
>  DEPLOY_ISAR_BOOTSTRAP ?= ""
>  DISTRO_BOOTSTRAP_BASE_PACKAGES = "locales"
>  DISTRO_BOOTSTRAP_BASE_PACKAGES:append:gnupg = ",gnupg"
> @@ -48,13 +52,11 @@ python () {
>              distro_bootstrap_keys += own_pub_key.split()
>  
>      for key in distro_bootstrap_keys:
> -        d.appendVar("SRC_URI", " %s" % key)
>          fetcher = bb.fetch2.Fetch([key], d)
>          filename = os.path.relpath(fetcher.localpath(key), topdir)
>          d.appendVar("DISTRO_BOOTSTRAP_KEYFILES", " ${TOPDIR}/%s" %
> filename)
>  
>      for key in third_party_apt_keys:
> -        d.appendVar("SRC_URI", " %s" % key)
>          fetcher = bb.fetch2.Fetch([key], d)
>          filename = os.path.relpath(fetcher.localpath(key), topdir)
>          d.appendVar("THIRD_PARTY_APT_KEYFILES", " ${TOPDIR}/%s" %
> filename)
> -- 
> 2.39.2
>
Larson, Chris April 3, 2024, 9:42 p.m. UTC | #2
Actually the From was correct, as I really should be using my work address, I just need to actually send the emails from there instead to match. I'll do that for the v2. Thanks.

-----Original Message-----
From: Moessbauer, Felix (T CED OES-DE) <felix.moessbauer@siemens.com> 
Sent: Tuesday, April 2, 2024 11:55 PM
To: kergoth@gmail.com; isar-users@googlegroups.com
Cc: Larson, Chris (DI CTO FDS CES LX MEL) <chris.larson@siemens.com>; chris.larson@seimens.com
Subject: Re: [PATCH 1/9] isar-bootstrap: avoid forced early expansion of key vars

On Tue, 2024-04-02 at 17:28 +0000, kergoth@gmail.com wrote:
> From: Christopher Larson <chris.larson@seimens.com>
------------------------------------------^

Hi, please resend the whole series with a correct "From:".

Felix

> 
> Rather than appending the items from the expanded key variables into 
> SRC_URI individually, which means there's no way to use tools like 
> vardepvalue or vardepexclude to control signature generation, append 
> the unexpanded variables to the SRC_URI directly. This avoids issues 
> with shared state reuse for the isar-bootstrap packages.
> 
> Signed-off-by: Christopher Larson <chris.larson@siemens.com>
> ---
>  meta/recipes-core/isar-bootstrap/isar-bootstrap.inc | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
> b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
> index 17f19fd8..de14e946 100644
> --- a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
> +++ b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
> @@ -10,7 +10,9 @@ LIC_FILES_CHKSUM =
> "file://${LAYERDIR_core}/licenses/COPYING.GPLv2;md5=751419260
>  FILESPATH:prepend := "${THISDIR}/files:"
>  SRC_URI = " \
>      file://locale \
> -    file://chroot-setup.sh"
> +    file://chroot-setup.sh \
> +    ${DISTRO_BOOTSTRAP_KEYS} \
> +    ${THIRD_PARTY_APT_KEYS}"
>  PV = "1.0"
>  
>  BOOTSTRAP_FOR_HOST ?= "0"
> @@ -22,6 +24,8 @@ APTSRCS = "${WORKDIR}/apt-sources"
>  APTSRCS_INIT = "${WORKDIR}/apt-sources-init"
>  DISTRO_BOOTSTRAP_KEYFILES = ""
>  THIRD_PARTY_APT_KEYFILES = ""
> +DISTRO_BOOTSTRAP_KEYS ?= ""
> +THIRD_PARTY_APT_KEYS ?= ""
>  DEPLOY_ISAR_BOOTSTRAP ?= ""
>  DISTRO_BOOTSTRAP_BASE_PACKAGES = "locales"
>  DISTRO_BOOTSTRAP_BASE_PACKAGES:append:gnupg = ",gnupg"
> @@ -48,13 +52,11 @@ python () {
>              distro_bootstrap_keys += own_pub_key.split()
>  
>      for key in distro_bootstrap_keys:
> -        d.appendVar("SRC_URI", " %s" % key)
>          fetcher = bb.fetch2.Fetch([key], d)
>          filename = os.path.relpath(fetcher.localpath(key), topdir)
>          d.appendVar("DISTRO_BOOTSTRAP_KEYFILES", " ${TOPDIR}/%s" %
> filename)
>  
>      for key in third_party_apt_keys:
> -        d.appendVar("SRC_URI", " %s" % key)
>          fetcher = bb.fetch2.Fetch([key], d)
>          filename = os.path.relpath(fetcher.localpath(key), topdir)
>          d.appendVar("THIRD_PARTY_APT_KEYFILES", " ${TOPDIR}/%s" %
> filename)
> --
> 2.39.2
>
MOESSBAUER, Felix April 4, 2024, 6:26 a.m. UTC | #3
On Wed, 2024-04-03 at 21:42 +0000, Larson, Chris (DI CTO FDS CES LX
MEL) wrote:
> Actually the From was correct, as I really should be using my work
> address, I just need to actually send the emails from there instead
> to match. I'll do that for the v2. Thanks.

Sending from a different address is fine, but there is a typo in your
email: <chris.larson@seimens.com> != <chris.larson@siemens.com>
(SEIMENS vs. SIEMENS).

Felix

> 
> -----Original Message-----
> From: Moessbauer, Felix (T CED OES-DE) <felix.moessbauer@siemens.com>
> Sent: Tuesday, April 2, 2024 11:55 PM
> To: kergoth@gmail.com; isar-users@googlegroups.com
> Cc: Larson, Chris (DI CTO FDS CES LX MEL) <chris.larson@siemens.com>;
> chris.larson@seimens.com
> Subject: Re: [PATCH 1/9] isar-bootstrap: avoid forced early expansion
> of key vars
> 
> On Tue, 2024-04-02 at 17:28 +0000, kergoth@gmail.com wrote:
> > From: Christopher Larson <chris.larson@seimens.com>
> ------------------------------------------^
> 
> Hi, please resend the whole series with a correct "From:".
> 
> Felix
> 
> > 
> > Rather than appending the items from the expanded key variables
> > into 
> > SRC_URI individually, which means there's no way to use tools like 
> > vardepvalue or vardepexclude to control signature generation,
> > append 
> > the unexpanded variables to the SRC_URI directly. This avoids
> > issues 
> > with shared state reuse for the isar-bootstrap packages.
> > 
> > Signed-off-by: Christopher Larson <chris.larson@siemens.com>
> > ---
> >  meta/recipes-core/isar-bootstrap/isar-bootstrap.inc | 8 +++++---
> >  1 file changed, 5 insertions(+), 3 deletions(-)
> > 
> > diff --git a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
> > b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
> > index 17f19fd8..de14e946 100644
> > --- a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
> > +++ b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
> > @@ -10,7 +10,9 @@ LIC_FILES_CHKSUM =
> > "file://${LAYERDIR_core}/licenses/COPYING.GPLv2;md5=751419260
> >  FILESPATH:prepend := "${THISDIR}/files:"
> >  SRC_URI = " \
> >      file://locale \
> > -    file://chroot-setup.sh"
> > +    file://chroot-setup.sh \
> > +    ${DISTRO_BOOTSTRAP_KEYS} \
> > +    ${THIRD_PARTY_APT_KEYS}"
> >  PV = "1.0"
> >  
> >  BOOTSTRAP_FOR_HOST ?= "0"
> > @@ -22,6 +24,8 @@ APTSRCS = "${WORKDIR}/apt-sources"
> >  APTSRCS_INIT = "${WORKDIR}/apt-sources-init"
> >  DISTRO_BOOTSTRAP_KEYFILES = ""
> >  THIRD_PARTY_APT_KEYFILES = ""
> > +DISTRO_BOOTSTRAP_KEYS ?= ""
> > +THIRD_PARTY_APT_KEYS ?= ""
> >  DEPLOY_ISAR_BOOTSTRAP ?= ""
> >  DISTRO_BOOTSTRAP_BASE_PACKAGES = "locales"
> >  DISTRO_BOOTSTRAP_BASE_PACKAGES:append:gnupg = ",gnupg"
> > @@ -48,13 +52,11 @@ python () {
> >              distro_bootstrap_keys += own_pub_key.split()
> >  
> >      for key in distro_bootstrap_keys:
> > -        d.appendVar("SRC_URI", " %s" % key)
> >          fetcher = bb.fetch2.Fetch([key], d)
> >          filename = os.path.relpath(fetcher.localpath(key), topdir)
> >          d.appendVar("DISTRO_BOOTSTRAP_KEYFILES", " ${TOPDIR}/%s" %
> > filename)
> >  
> >      for key in third_party_apt_keys:
> > -        d.appendVar("SRC_URI", " %s" % key)
> >          fetcher = bb.fetch2.Fetch([key], d)
> >          filename = os.path.relpath(fetcher.localpath(key), topdir)
> >          d.appendVar("THIRD_PARTY_APT_KEYFILES", " ${TOPDIR}/%s" %
> > filename)
> > --
> > 2.39.2
> > 
> 
> -- 
> Siemens AG, Technology
> Linux Expert Center
> 
>

Patch

diff --git a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
index 17f19fd8..de14e946 100644
--- a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
+++ b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
@@ -10,7 +10,9 @@  LIC_FILES_CHKSUM = "file://${LAYERDIR_core}/licenses/COPYING.GPLv2;md5=751419260
 FILESPATH:prepend := "${THISDIR}/files:"
 SRC_URI = " \
     file://locale \
-    file://chroot-setup.sh"
+    file://chroot-setup.sh \
+    ${DISTRO_BOOTSTRAP_KEYS} \
+    ${THIRD_PARTY_APT_KEYS}"
 PV = "1.0"
 
 BOOTSTRAP_FOR_HOST ?= "0"
@@ -22,6 +24,8 @@  APTSRCS = "${WORKDIR}/apt-sources"
 APTSRCS_INIT = "${WORKDIR}/apt-sources-init"
 DISTRO_BOOTSTRAP_KEYFILES = ""
 THIRD_PARTY_APT_KEYFILES = ""
+DISTRO_BOOTSTRAP_KEYS ?= ""
+THIRD_PARTY_APT_KEYS ?= ""
 DEPLOY_ISAR_BOOTSTRAP ?= ""
 DISTRO_BOOTSTRAP_BASE_PACKAGES = "locales"
 DISTRO_BOOTSTRAP_BASE_PACKAGES:append:gnupg = ",gnupg"
@@ -48,13 +52,11 @@  python () {
             distro_bootstrap_keys += own_pub_key.split()
 
     for key in distro_bootstrap_keys:
-        d.appendVar("SRC_URI", " %s" % key)
         fetcher = bb.fetch2.Fetch([key], d)
         filename = os.path.relpath(fetcher.localpath(key), topdir)
         d.appendVar("DISTRO_BOOTSTRAP_KEYFILES", " ${TOPDIR}/%s" % filename)
 
     for key in third_party_apt_keys:
-        d.appendVar("SRC_URI", " %s" % key)
         fetcher = bb.fetch2.Fetch([key], d)
         filename = os.path.relpath(fetcher.localpath(key), topdir)
         d.appendVar("THIRD_PARTY_APT_KEYFILES", " ${TOPDIR}/%s" % filename)