launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #21885
[Merge] lp:~cjwatson/launchpad/external-dependencies-trusted into lp:launchpad
Colin Watson has proposed merging lp:~cjwatson/launchpad/external-dependencies-trusted into lp:launchpad.
Commit message:
Accept and ignore options (e.g. "[trusted=yes]") in sources.list lines passed via external_dependencies.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/external-dependencies-trusted/+merge/331490
We need this to tolerate builder chroots without allow-unauthenticated configuration: the external archive that we use for bootstrapping packages with circular dependencies is unsigned.
I considered more careful non-regex-based parsing, but I don't think it's worth the effort as this is just a preliminary scan for errors before handing it off to the builder.
--
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/external-dependencies-trusted into lp:launchpad.
=== modified file 'lib/lp/soyuz/browser/tests/archive-views.txt'
--- lib/lp/soyuz/browser/tests/archive-views.txt 2016-01-26 15:47:37 +0000
+++ lib/lp/soyuz/browser/tests/archive-views.txt 2017-09-28 14:31:29 +0000
@@ -1490,3 +1490,12 @@
... "deb http://example.com/ karmic universe\n"
... "deb example.com/ karmic main")
['deb example.com/ karmic main: Invalid URL']
+
+Options are permitted:
+
+ >>> print validate_external_dependencies(
+ ... "deb [trusted=yes] http://example.com/ karmic main")
+ []
+ >>> print validate_external_dependencies(
+ ... "deb [trusted=yes] example.com/ karmic main")
+ ['deb [trusted=yes] example.com/ karmic main: Invalid URL']
=== modified file 'lib/lp/soyuz/interfaces/archive.py'
--- lib/lp/soyuz/interfaces/archive.py 2017-06-26 09:54:51 +0000
+++ lib/lp/soyuz/interfaces/archive.py 2017-09-28 14:31:29 +0000
@@ -55,6 +55,7 @@
]
import httplib
+import re
from urlparse import urlparse
from lazr.restful.declarations import (
@@ -2468,8 +2469,9 @@
# The field can consist of multiple entries separated by
# newlines, so process each in turn.
for dep in ext_deps.splitlines():
+ dep_without_options = re.sub(r"^([^ ]*) \[[^]]*\] ", r"\1 ", dep)
try:
- deb, url, suite, components = dep.split(" ", 3)
+ deb, url, suite, components = dep_without_options.split(" ", 3)
except ValueError:
errors.append(
"'%s' is not a complete and valid sources.list entry"
Follow ups