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

Manuel Traut manut at linutronix.de
Thu Apr 25 14:41:01 CEST 2019


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>
---
 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




More information about the elbe-devel mailing list