summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKai Kang <kai.kang@windriver.com>2021-11-11 17:57:24 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-11-21 11:41:39 +0000
commit7884e05de96a4be27fbc98da8725d285064b16de (patch)
tree8e65de62746cd64a0155181f77b68ff3bd480725
parent7752c9e87b43910641da3df0f535ec4954a0155c (diff)
downloadpoky-7884e05de96a4be27fbc98da8725d285064b16de.tar.gz
convert-srcuri.py: use regex to check space in SRC_URI
There may be none, one or more spaces including tab before backslash in SRC_URI. Use regex to check and update. It helps to avoid malformed uri such as recipe open-iscsi-user in meta-openstack: SRC_URI = "git://github.com/open-iscsi/open-iscsi.git;protocol=https ;branch=master \ And help to check more recipes such as concurrent-ruby in the same layer: SRC_URI = "git://github.com/ruby-concurrency/concurrent-ruby.git;protocol=https;tag=v1.1.6\ (From OE-Core rev: f87a3aba3086cd3fd89274337f25fc1717d6c981) Signed-off-by: Kai Kang <kai.kang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit a69a53573b1987ee5834a6fc27763f9bbf5fe5a4) Signed-off-by: Anuj Mittal <anuj.mittal@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rwxr-xr-xscripts/contrib/convert-srcuri.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/scripts/contrib/convert-srcuri.py b/scripts/contrib/convert-srcuri.py
index 5b362ea2e8..587392334f 100755
--- a/scripts/contrib/convert-srcuri.py
+++ b/scripts/contrib/convert-srcuri.py
@@ -35,16 +35,16 @@ def processfile(fn):
35 if ("git://" in line or "gitsm://" in line) and "branch=" not in line and matchline(line): 35 if ("git://" in line or "gitsm://" in line) and "branch=" not in line and matchline(line):
36 if line.endswith('"\n'): 36 if line.endswith('"\n'):
37 line = line.replace('"\n', ';branch=master"\n') 37 line = line.replace('"\n', ';branch=master"\n')
38 elif line.endswith(" \\\n"): 38 elif re.search('\s*\\\\$', line):
39 line = line.replace(' \\\n', ';branch=master \\\n') 39 line = re.sub('\s*\\\\$', ';branch=master \\\\', line)
40 modified = True 40 modified = True
41 if ("git://" in line or "gitsm://" in line) and "github.com" in line and "protocol=https" not in line and matchline(line): 41 if ("git://" in line or "gitsm://" in line) and "github.com" in line and "protocol=https" not in line and matchline(line):
42 if "protocol=git" in line: 42 if "protocol=git" in line:
43 line = line.replace('protocol=git', 'protocol=https') 43 line = line.replace('protocol=git', 'protocol=https')
44 elif line.endswith('"\n'): 44 elif line.endswith('"\n'):
45 line = line.replace('"\n', ';protocol=https"\n') 45 line = line.replace('"\n', ';protocol=https"\n')
46 elif line.endswith(" \\\n"): 46 elif re.search('\s*\\\\$', line):
47 line = line.replace(' \\\n', ';protocol=https \\\n') 47 line = re.sub('\s*\\\\$', ';protocol=https \\\\', line)
48 modified = True 48 modified = True
49 new_file.write(line) 49 new_file.write(line)
50 if modified: 50 if modified: