* [PATCH v2] convert-srcuri.py: use regex to check space in SRC_URI
@ 2021-11-11 9:57 kai.kang
0 siblings, 0 replies; only message in thread
From: kai.kang @ 2021-11-11 9:57 UTC (permalink / raw)
To: openembedded-core; +Cc: foss
From: Kai Kang <kai.kang@windriver.com>
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\
Signed-off-by: Kai Kang <kai.kang@windriver.com>
---
v2:
* use re to check and replace
scripts/contrib/convert-srcuri.py | 8 ++++----
1 file 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):
if ("git://" in line or "gitsm://" in line) and "branch=" not in line and matchline(line):
if line.endswith('"\n'):
line = line.replace('"\n', ';branch=master"\n')
- elif line.endswith(" \\\n"):
- line = line.replace(' \\\n', ';branch=master \\\n')
+ elif re.search('\s*\\\\$', line):
+ line = re.sub('\s*\\\\$', ';branch=master \\\\', line)
modified = True
if ("git://" in line or "gitsm://" in line) and "github.com" in line and "protocol=https" not in line and matchline(line):
if "protocol=git" in line:
line = line.replace('protocol=git', 'protocol=https')
elif line.endswith('"\n'):
line = line.replace('"\n', ';protocol=https"\n')
- elif line.endswith(" \\\n"):
- line = line.replace(' \\\n', ';protocol=https \\\n')
+ elif re.search('\s*\\\\$', line):
+ line = re.sub('\s*\\\\$', ';protocol=https \\\\', line)
modified = True
new_file.write(line)
if modified:
--
2.17.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2021-11-11 9:57 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-11 9:57 [PATCH v2] convert-srcuri.py: use regex to check space in SRC_URI kai.kang
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.