Skip to contentSkip to conversation

fetch2: Allow whitespace only mirror entries

PATCH New Richard Purdie 1 participant 1 message Mar 3, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fetch2: Allow whitespace only mirror entries

Forcing the use of "\n" in mirror variables is pointless, we can just require that there are pairs of values.

---
 lib/bb/fetch2/__init__.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
lib/bb/fetch2/__init__.py +5 -1
index 760e24f..672f109 100644
@@ -538,7 +538,11 @@ def fetcher_compare_revisions():
     return False
 
 def mirror_from_string(data):
-    return [ i.split() for i in (data or "").replace('\\n','\n').split('\n') if i ]
+    mirrors = (data or "").replace('\\n',' ').split()
+    # Split into pairs
+    if len(mirrors) % 2 != 0:
+        bb.warn('Invalid mirror data %s, should have paired members.' % data)
+    return list(zip(*[iter(mirrors)]*2))
 
 def verify_checksum(ud, d, precomputed={}):
     """
Signature · 1 line
2.7.4