[elbe-devel] [PATCH 2/6] Add implementation of XML tag 'url-list/url/raw-key'

Torben Hohn torben.hohn at linutronix.de
Mon May 27 15:34:11 CEST 2019


On Tue, May 21, 2019 at 10:48:54AM +0200, dion at linutronix.de wrote:
> From: Olivier Dion <dion at linutronix.de>
> 
> Also removed implementation of XML tag 'url-list/url/key' since the
> preprocessor is going to substitute it with a 'raw-key' tag.
> 
> Signed-off-by: Olivier Dion <dion at linutronix.de>

Reviewed-by: Torben Hohn <torben.hohn at linutronix.de>

> ---
>  elbepack/rfs.py | 29 +++++++++++++++++------------
>  1 file changed, 17 insertions(+), 12 deletions(-)
> 
> diff --git a/elbepack/rfs.py b/elbepack/rfs.py
> index 15756b76..8476d01b 100644
> --- a/elbepack/rfs.py
> +++ b/elbepack/rfs.py
> @@ -235,21 +235,26 @@ class BuildEnv (object):
>          self.rfs.mkdir_p("/state/lists/partial")
>          self.rfs.touch_file("/state/status")
>  
> +    def add_key(self, key):
> +        cmd = 'echo "%s" > %s' % (key, self.rfs.fname("tmp/key.pub"))
> +        clean = 'rm -f %s' % self.rfs.fname("tmp/key.pub")
> +        self.log.do(cmd)
> +        with self.rfs:
> +            self.log.chroot(self.rfs.path, 'apt-key add /tmp/key.pub')
> +        self.log.do(clean)
> +
>      def import_keys(self):
>          if self.xml.has('project/mirror/url-list'):
> +            # Should we use self.xml.prj.has("noauth")???
> +            #
> +            # If so, this is related to issue #220 -
> +            # https://github.com/Linutronix/elbe/issues/220
> +            #
> +            # I could make a none global 'noauth' flag for mirrors
>              for url in self.xml.node('project/mirror/url-list'):
> -                if url.has('key') and not self.xml.prj.has("noauth"):
> -                    keyurl = url.text('key').strip()    # URL to key
> -                    keyurl = keyurl.replace('LOCALMACHINE', '10.0.2.2')
> -
> -                    myKey = urllib2.urlopen(keyurl).read()
> -                    self.log.do(
> -                        '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')
> -                    self.log.do('rm -f %s' % self.rfs.fname("tmp/key.pub"))
> +                if url.has('raw-key'):
> +                    key = "\n".join(line.strip(" \t") for line in url.text('raw-key').splitlines()[1:-1])
> +                    self.add_key(key)
>  
>      def initialize_dirs(self, build_sources=False):
>          mirror = self.xml.create_apt_sources_list(build_sources=build_sources)
> -- 
> 2.21.0
> 
> 
> _______________________________________________
> elbe-devel mailing list
> elbe-devel at linutronix.de
> https://lists.linutronix.de/mailman/listinfo/elbe-devel

-- 
Torben Hohn
Linutronix GmbH | Bahnhofstrasse 3 | D-88690 Uhldingen-Mühlhofen
Phone: +49 7556 25 999 18; Fax.: +49 7556 25 999 99

Hinweise zum Datenschutz finden Sie hier (Informations on data privacy 
can be found here): https://linutronix.de/kontakt/Datenschutz.php

Linutronix GmbH | Firmensitz (Registered Office): Uhldingen-Mühlhofen | 
Registergericht (Registration Court): Amtsgericht Freiburg i.Br., HRB700 
806 | Geschäftsführer (Managing Directors): Heinz Egger, Thomas Gleixner



More information about the elbe-devel mailing list