convert-srcuri.py: remove extra spaces before backslash
PATCH 1/1 convert-srcuri.py: remove extra spaces before backslash
From: Kai Kang <[email protected]>
There may be more than one spaces before backslash in SRC_URI. Strip them otherwise it forges a malformed uri such as open-iscsi-user in meta-openstack:
SRC_URI = "git://github.com/open-iscsi/open-iscsi.git;protocol=https ;branch=master \
--- scripts/contrib/convert-srcuri.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/contrib/convert-srcuri.py +2 -2
@@ -36,7 +36,7 @@ def processfile(fn): if line.endswith('"\n'): line = line.replace('"\n', ';branch=master"\n') elif line.endswith(" \\\n"): - line = line.replace(' \\\n', ';branch=master \\\n') + line = line.replace(' \\\n', '').rstrip() + ';branch=master \\\n' 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:
@@ -44,7 +44,7 @@ def processfile(fn): elif line.endswith('"\n'): line = line.replace('"\n', ';protocol=https"\n') elif line.endswith(" \\\n"): - line = line.replace(' \\\n', ';protocol=https \\\n') + line = line.replace(' \\\n', '').rstrip() + ';protocol=https \\\n' modified = True new_file.write(line) if modified:
Signature · 1 line
2.17.1
Hi Kai,
Quoted 3 lines · kai
From: Kai Kang <[email protected]>
There may be more than one spaces before backslash in
SRC_URI. Strip
There could technically be tabs too and the current code (even after your patch) does not seem to handle that (from the git context I see in your patch). Maybe a regex would be ok here, using \s* to match as many tabs and spaces as needed. Not sure we care that much but I wanted to raise this so it's known at least.
Thanks for the patch,
Cheers
Quentin
Quoted 32 lines
them otherwise it forges a malformed uri such as open-iscsi-user in meta-openstack:
SRC_URI= "git://github.com/open-iscsi/open-iscsi.git;protocol=https;branch=master \Signed-off-by Kai Kang <[email protected]>---
scripts/contrib/convert-srcuri.py| 4 ++--1 file changed, 2 insertions(+), 2 deletions(-)scripts/contrib/convert-srcuri.py +2
-2@@ -36,7 +36,7 @@ def processfile(fn): if line.endswith('"\n'): line = line.replace('"\n', ';branch=master"\n') elif line.endswith(" \\\n"): - line = line.replace(' \\\n', ';branch=master \\\n') + line = line.replace(' \\\n', '').rstrip() + ';branch=master \\\n' 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:@@ -44,7 +44,7 @@ def processfile(fn): elif line.endswith('"\n'): line = line.replace('"\n', ';protocol=https"\n') elif line.endswith(" \\\n"): - line = line.replace(' \\\n', ';protocol=https \\\n') + line = line.replace(' \\\n', '').rstrip() + ';protocol=https \\\n' modified = True new_file.write(line) if modified:
Quoted 7 lines · Quentin Schulz
Hi Kai,
Quoted 3 lines · kai
From: Kai Kang <[email protected]>
There may be more than one spaces before backslash in
SRC_URI. StripThere could technically be tabs too and the current code (even after your patch) does not seem to handle that (from the git context I see in your patch). Maybe a regex would be ok here, using \s* to match as many tabs and spaces as needed. Not sure we care that much but I wanted to raise this so it's known at least.
Thanks for comment. v2 sent.
Kai
Quoted 37 lines
Thanks for the patch,
Cheers
QuentinQuoted 32 lines
them otherwise it forges a malformed uri such as open-iscsi-user in meta-openstack:
SRC_URI= "git://github.com/open-iscsi/open-iscsi.git;protocol=https;branch=master \Signed-off-by Kai Kang <[email protected]>---
scripts/contrib/convert-srcuri.py| 4 ++--1 file changed, 2 insertions(+), 2 deletions(-)scripts/contrib/convert-srcuri.py +2
-2@@ -36,7 +36,7 @@ def processfile(fn): if line.endswith('"\n'): line = line.replace('"\n', ';branch=master"\n') elif line.endswith(" \\\n"): - line = line.replace(' \\\n', ';branch=master \\\n') + line = line.replace(' \\\n', '').rstrip() + ';branch=master \\\n' 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:@@ -44,7 +44,7 @@ def processfile(fn): elif line.endswith('"\n'): line = line.replace('"\n', ';protocol=https"\n') elif line.endswith(" \\\n"): - line = line.replace(' \\\n', ';protocol=https \\\n') + line = line.replace(' \\\n', '').rstrip() + ';protocol=https \\\n' modified = True new_file.write(line) if modified:
Signature · 2 lines
Kai Kang Wind River Linux