[elbe-devel] [PATCH] handle slash in mirror description

Benedikt Spranger b.spranger at linutronix.de
Wed Sep 30 00:22:16 CEST 2015


apt handle slashes in deb mirror description in a different manner then
without a slash:
deb http://mirror foo  --> URI-Prefix: http://mirror/dist/foo
deb http://mirror foo/ --> URI-Prefix: http://mirror/foo

Fix mirror verification in validate_apt_sources().

Signed-off-by: Benedikt Spranger <b.spranger at linutronix.de>
---
 elbepack/elbexml.py | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/elbepack/elbexml.py b/elbepack/elbexml.py
index 9d79733..62a1abb 100644
--- a/elbepack/elbexml.py
+++ b/elbepack/elbexml.py
@@ -154,10 +154,16 @@ class ElbeXML(object):
                 pass
             elif l.startswith ("deb "):
                 lsplit = l.split (" ")
-                urls.append ("%s/dists/%s/Release" % (lsplit[1], lsplit[2]))
+                if lsplit[2].endswith('/'):
+                    urls.append ("%s/%s/Release" % (lsplit[1], lsplit[2]))
+                else:
+                    urls.append ("%s/dists/%s/Release" % (lsplit[1], lsplit[2]))
             elif l.startswith ("deb-src "):
                 lsplit = l.split (" ")
-                urls.append ("%s/dists/%s/Release" % (lsplit[1], lsplit[2]))
+                if lsplit[2].endswith('/'):
+                    urls.append ("%s/%s/Release" % (lsplit[1], lsplit[2]))
+                else:
+                    urls.append ("%s/dists/%s/Release" % (lsplit[1], lsplit[2]))
 
         if self.prj.has ("mirror/primary_proxy"):
             os.environ["no_proxy"] = "10.0.2.2,localhost,127.0.0.1"
-- 
2.5.3





More information about the elbe-devel mailing list