[elbe-devel] [PATCH] Add includepkgs as debootstrapvariant attribute

Manuel Traut manut at linutronix.de
Fri Mar 1 07:21:55 CET 2019


Hi Bastian,

On 10:47 Wed 27 Feb     , bage at linutronix.de wrote:
> From: Bastian Germann <bage at linutronix.de>
> 
> In some situations, you need additional packages during debootstrap.
> E.g., with variant minbase and additional repository keys, gnupg is needed to
> add those keys to the trusted key database.

apt-transport-https check if https is used in url-list is missing, see also
inline below.

> Add an attribute includepkgs to the debootstrapvariant element and apply its
> contents as debootstrap --include="...".
>
> Closes issue #200.
> 
> Signed-off-by: Bastian Germann <bage at linutronix.de>
> ---
>  elbepack/rfs.py   | 23 ++++++++++++++++++-----
>  schema/dbsfed.xsd |  8 +++++++-
>  2 files changed, 25 insertions(+), 6 deletions(-)
> 
> diff --git a/elbepack/rfs.py b/elbepack/rfs.py
> index eec4e6a0..d392f41f 100644
> --- a/elbepack/rfs.py
> +++ b/elbepack/rfs.py
> @@ -124,9 +124,17 @@ class BuildEnv (object):
>  
>          if self.xml.has("target/debootstrapvariant"):
>              bootstrapvariant = self.xml.text("target/debootstrapvariant")
> -            self.log.printo('NOTE: use bootstrap variant "%s".' % (
> -                bootstrapvariant))
> -            strapcmd = 'debootstrap --variant="%s"' % (bootstrapvariant)
> +            includepkgs = self.xml.node("target/debootstrapvariant").et.get("includepkgs")
> +            if includepkgs:
> +                self.log.printo('NOTE: use bootstrap variant '
> +                    '"%s" with additional includes: "%s".' % (
> +                    bootstrapvariant, includepkgs))
> +                strapcmd = 'debootstrap --variant="%s" --include="%s"' % (
> +                    bootstrapvariant, includepkgs)
> +            else:
> +                self.log.printo('NOTE: use bootstrap variant "%s".' % (
> +                    bootstrapvariant))
> +                strapcmd = 'debootstrap --variant="%s"' % (bootstrapvariant)

ack!

>          else:
>              self.log.printo('use bootstrap no variant.')
>              strapcmd = 'debootstrap'
> @@ -217,8 +225,13 @@ class BuildEnv (object):
>                          'echo "%s" > %s' %
>                          (myKey, self.rfs.fname("tmp/key.pub")))
>                      with self.rfs:
> -                        self.log.chroot(
> -                            self.rfs.path, 'apt-key add /tmp/key.pub')
> +                        try:
> +                            self.log.chroot(
> +                                self.rfs.path, 'apt-key add /tmp/key.pub')
> +                        except CommandError:
> +                            self.log.printo("Use debootstrapvariant's attribute includepkgs to "
> +                                             "make gnupg available in debootstrap.")
> +                            raise

we want to detect errors as early as possible. Please add sanity checks to
elbepack/validate.py

>                      self.log.do('rm -f %s' % self.rfs.fname("tmp/key.pub"))
>  
>      def initialize_dirs(self, build_sources=False):
> diff --git a/schema/dbsfed.xsd b/schema/dbsfed.xsd
> index 4740a436..ccab23be 100644
> --- a/schema/dbsfed.xsd
> +++ b/schema/dbsfed.xsd
> @@ -885,7 +885,13 @@
>      </annotation>
>      <simpleContent>
>        <extension base="rfs:debootstrapvarianttype_restriction">
> -        <attribute ref="xml:base"/>
> +        <attribute name="includepkgs" type="string" use="optional">
> +          <annotation>
> +            <documentation>
> +              A comma-separated list of additional packages at debootstrap runtime.
> +            </documentation>
> +          </annotation>
> +        </attribute>

ack

>        </extension>
>      </simpleContent>
>    </complexType>
> -- 
> 2.11.0
> 
> 
> _______________________________________________
> elbe-devel mailing list
> elbe-devel at linutronix.de
> https://lists.linutronix.de/mailman/listinfo/elbe-devel



More information about the elbe-devel mailing list