Re: [OE-core] [PATCH] convert-srcuri.py: remove extra spaces before backslash

2021-11-11 Thread kai

On 11/11/21 4:40 PM, Quentin Schulz wrote:

Hi Kai,

On November 11, 2021 4:48:14 AM GMT+01:00, kai  wrote:

From: Kai Kang 

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 comment. v2 sent.

Kai



Thanks for the patch,
Cheers
Quentin


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 
---
scripts/contrib/convert-srcuri.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/contrib/convert-srcuri.py 
b/scripts/contrib/convert-srcuri.py
index 5b362ea2e8..e7a97fdbd4 100755
--- a/scripts/contrib/convert-srcuri.py
+++ b/scripts/contrib/convert-srcuri.py
@@ -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:



--
Kai Kang
Wind River Linux


-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#158151): 
https://lists.openembedded.org/g/openembedded-core/message/158151
Mute This Topic: https://lists.openembedded.org/mt/86974863/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [OE-core] [PATCH] convert-srcuri.py: remove extra spaces before backslash

2021-11-11 Thread Quentin Schulz
Hi Kai,

On November 11, 2021 4:48:14 AM GMT+01:00, kai  wrote:
>From: Kai Kang 
>
>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

>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 
>---
> scripts/contrib/convert-srcuri.py | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
>diff --git a/scripts/contrib/convert-srcuri.py 
>b/scripts/contrib/convert-srcuri.py
>index 5b362ea2e8..e7a97fdbd4 100755
>--- a/scripts/contrib/convert-srcuri.py
>+++ b/scripts/contrib/convert-srcuri.py
>@@ -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:

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#158148): 
https://lists.openembedded.org/g/openembedded-core/message/158148
Mute This Topic: https://lists.openembedded.org/mt/86974863/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[OE-core] [PATCH] convert-srcuri.py: remove extra spaces before backslash

2021-11-10 Thread kai
From: Kai Kang 

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 \

Signed-off-by: Kai Kang 
---
 scripts/contrib/convert-srcuri.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/contrib/convert-srcuri.py 
b/scripts/contrib/convert-srcuri.py
index 5b362ea2e8..e7a97fdbd4 100755
--- a/scripts/contrib/convert-srcuri.py
+++ b/scripts/contrib/convert-srcuri.py
@@ -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:
-- 
2.17.1


-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#158131): 
https://lists.openembedded.org/g/openembedded-core/message/158131
Mute This Topic: https://lists.openembedded.org/mt/86974863/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-