[elbe-devel] [PATCH] respect <noauth/> for sources.list generation

Torben Hohn torben.hohn at linutronix.de
Fri Apr 26 08:38:16 CEST 2019


On Thu, Apr 25, 2019 at 02:41:01PM +0200, Manuel Traut wrote:
> This resolves the issue that <noauth/> in combination
> with unsigned repos end up in this error:
> 
> --8<--
> I: Base system installed successfully.
> ------------------------------------------------------------------------------
> 
> running cmd +chroot /var/cache/elbe/b0e54edc-8299-46b1-b99f-375fb258ec39/chroot dpkg --configure -a+
> ------------------------------------------------------------------------------
> ------------------------------------------------------------------------------
> 
> running cmd +chroot /var/cache/elbe/b0e54edc-8299-46b1-b99f-375fb258ec39/chroot debconf-set-selections < /var/cache/elbe/b0e54edc-8299-46b1-b99f-375fb258ec39/chroot/var/cache/elbe/preseed.txt+
> ------------------------------------------------------------------------------
> ------------------------------------------------------------------------------
> 
> Keys imported
> Build failed !!!
> 
> Failed to build the Apt Cache.
> Not all Mirror Index Files could be downloaded.
> Probable cause might be:
> - Problems with Internet Connection
> - Broken mirrors
> 
> Message from apt:
> Error Updating rpcaptcache: E:The repository 'http://192.168.100.10/~xyz/packages stretch Release' is not signed., W:Updating from such a repository can't be done securely, and is therefore disabled by default., W:See apt-secure(8) manpage for repository creation and user configuration details., W:Target Packages (main/binary-armhf/Packages) is configured multiple times in /etc/apt/sources.list:1 and /etc/apt/sources.list:3, W:Target Packages (main/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:1 and /etc/apt/sources.list:3, W:Target Translations (main/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:1 and /etc/apt/sources.list:3
> --8<--
> 
> Signed-off-by: Manuel Traut <manut at linutronix.de>

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

i dont like the varname noauth (should be: repo_options or something)
we need to add per url features in the future.
but this is acceptable.


> ---
>  elbepack/elbexml.py  | 13 +++++++++----
>  elbepack/pbuilder.py |  8 ++++++--
>  elbepack/rfs.py      |  2 +-
>  3 files changed, 16 insertions(+), 7 deletions(-)
> 
> diff --git a/elbepack/elbexml.py b/elbepack/elbexml.py
> index 146524fd..9953a08b 100644
> --- a/elbepack/elbexml.py
> +++ b/elbepack/elbexml.py
> @@ -140,21 +140,26 @@ class ElbeXML(object):
>          if not self.prj.has("mirror") and not self.prj.has("mirror/cdrom"):
>              return "# no mirrors configured"
>  
> +        noauth = ""
> +        if self.prj.has("noauth"):
> +            noauth = "[trusted=yes] "
> +
>          mirror = ""
>          if self.prj.has("mirror/primary_host"):
> -            mirror += "deb " + self.get_primary_mirror(None)
> +            mirror += "deb " + noauth + self.get_primary_mirror(None)
>              mirror += " " + self.prj.text("suite") + " main\n"
>  
>              if build_sources:
> -                mirror += "deb-src " + self.get_primary_mirror(None)
> +                mirror += "deb-src " + noauth + self.get_primary_mirror(None)
>                  mirror += " " + self.prj.text("suite") + " main\n"
>  
>              if self.prj.has("mirror/url-list"):
>                  for url in self.prj.node("mirror/url-list"):
>                      if url.has("binary"):
> -                        mirror += "deb " + url.text("binary").strip() + "\n"
> +                        mirror += "deb " + noauth + \
> +                                   url.text("binary").strip() + "\n"
>                      if url.has("source"):
> -                        mirror += "deb-src " + \
> +                        mirror += "deb-src " + noauth + \
>                              url.text("source").strip() + "\n"
>  
>          if self.prj.has("mirror/cdrom"):
> diff --git a/elbepack/pbuilder.py b/elbepack/pbuilder.py
> index 866589e8..c1f3a5ef 100644
> --- a/elbepack/pbuilder.py
> +++ b/elbepack/pbuilder.py
> @@ -128,11 +128,15 @@ def pbuilder_write_repo_hook(builddir, xml):
>                    xml.prj.text("suite") + ' main" >> /etc/apt/sources.list\n'
>  
>          if xml.prj.has("mirror/url-list"):
> +            noauth = ""
> +            if xml.prj.has("noauth"):
> +                noauth = "[trusted=yes] "
>              for url in xml.prj.node("mirror/url-list"):
>                  if url.has("binary"):
> -                    mirror += 'echo "deb ' + url.text("binary").strip() + \
> +                    mirror += 'echo "deb ' + noauth + \
> +                              url.text("binary").strip() + \
>                                '" >> /etc/apt/sources.list\n'
> -                if url.has("key"):
> +                if url.has("key") and not xml.prj.has("noauth"):
>                      key_url = url.text("key").strip()
>                      mirror = mirror_script_add_key(mirror, key_url)
>  
> diff --git a/elbepack/rfs.py b/elbepack/rfs.py
> index a4f27b40..15756b76 100644
> --- a/elbepack/rfs.py
> +++ b/elbepack/rfs.py
> @@ -238,7 +238,7 @@ class BuildEnv (object):
>      def import_keys(self):
>          if self.xml.has('project/mirror/url-list'):
>              for url in self.xml.node('project/mirror/url-list'):
> -                if url.has('key'):
> +                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')
>  
> -- 
> 2.20.1
> 

-- 
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.linutronix.de/pipermail/elbe-devel/attachments/20190426/2c624117/attachment.sig>


More information about the elbe-devel mailing list