* [Buildroot] [PATCH 1/2] utils/getdeveloperlib.py: fix check_output() return value decoding
@ 2021-11-02 22:20 Thomas Petazzoni
2021-11-02 22:20 ` [Buildroot] [PATCH 2/2] utils/getdeveloperlib.py: call Developer.hasfile() with relative path Thomas Petazzoni
2021-11-03 21:15 ` [Buildroot] [PATCH 1/2] utils/getdeveloperlib.py: fix check_output() return value decoding Peter Korsgaard
0 siblings, 2 replies; 7+ messages in thread
From: Thomas Petazzoni @ 2021-11-02 22:20 UTC (permalink / raw)
To: buildroot; +Cc: Thomas Petazzoni
In Python 3.x, check_output() returns a "bytes" array, and not a
string. Its result needs to be decoded to be turned into a
string. Without this fix, "get-developers -c" bails out with:
Traceback (most recent call last):
File "/home/thomas/projets/buildroot/./utils/get-developers", line 105, in <module>
__main__()
File "/home/thomas/projets/buildroot/./utils/get-developers", line 53, in __main__
files = getdeveloperlib.check_developers(devs)
File "/home/thomas/projets/buildroot/utils/getdeveloperlib.py", line 280, in check_developers
files = subprocess.check_output(cmd).strip().split("\n")
TypeError: a bytes-like object is required, not 'str'
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
utils/getdeveloperlib.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/utils/getdeveloperlib.py b/utils/getdeveloperlib.py
index 438d26d68d..f351f05a1f 100644
--- a/utils/getdeveloperlib.py
+++ b/utils/getdeveloperlib.py
@@ -277,7 +277,7 @@ def check_developers(developers, basepath=None):
if basepath is None:
basepath = os.getcwd()
cmd = ["git", "--git-dir", os.path.join(basepath, ".git"), "ls-files"]
- files = subprocess.check_output(cmd).strip().split("\n")
+ files = subprocess.check_output(cmd).decode(sys.stdout.encoding).strip().split("\n")
unhandled_files = []
for f in files:
handled = False
--
2.31.1
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 7+ messages in thread* [Buildroot] [PATCH 2/2] utils/getdeveloperlib.py: call Developer.hasfile() with relative path
2021-11-02 22:20 [Buildroot] [PATCH 1/2] utils/getdeveloperlib.py: fix check_output() return value decoding Thomas Petazzoni
@ 2021-11-02 22:20 ` Thomas Petazzoni
2021-11-03 21:15 ` Peter Korsgaard
2021-11-03 21:15 ` [Buildroot] [PATCH 1/2] utils/getdeveloperlib.py: fix check_output() return value decoding Peter Korsgaard
1 sibling, 1 reply; 7+ messages in thread
From: Thomas Petazzoni @ 2021-11-02 22:20 UTC (permalink / raw)
To: buildroot; +Cc: Thomas Petazzoni
In commit
40bb37bd70d46822e803aaa5169dee8ff8b51093 ("utils/getdeveloperlib.py:
use relative paths for files"), the Developer class was changed to use
relative paths, including for its .hasfile() method.
However the check_developers() function of getdeveloperlib.py was not
updated accordingly, and continued to pass absolute paths. This caused
"get-developers -c" to return the entire list of files in Buildroot as
being unmaintained, as none of them were matching the file listed in
the DEVELOPERS file.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
utils/getdeveloperlib.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/utils/getdeveloperlib.py b/utils/getdeveloperlib.py
index f351f05a1f..f2b36862e3 100644
--- a/utils/getdeveloperlib.py
+++ b/utils/getdeveloperlib.py
@@ -282,7 +282,7 @@ def check_developers(developers, basepath=None):
for f in files:
handled = False
for d in developers:
- if d.hasfile(os.path.join(basepath, f)):
+ if d.hasfile(f):
handled = True
break
if not handled:
--
2.31.1
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [Buildroot] [PATCH 2/2] utils/getdeveloperlib.py: call Developer.hasfile() with relative path
2021-11-02 22:20 ` [Buildroot] [PATCH 2/2] utils/getdeveloperlib.py: call Developer.hasfile() with relative path Thomas Petazzoni
@ 2021-11-03 21:15 ` Peter Korsgaard
0 siblings, 0 replies; 7+ messages in thread
From: Peter Korsgaard @ 2021-11-03 21:15 UTC (permalink / raw)
To: Thomas Petazzoni; +Cc: buildroot
>>>>> "Thomas" == Thomas Petazzoni <thomas.petazzoni@bootlin.com> writes:
> In commit
> 40bb37bd70d46822e803aaa5169dee8ff8b51093 ("utils/getdeveloperlib.py:
> use relative paths for files"), the Developer class was changed to use
> relative paths, including for its .hasfile() method.
> However the check_developers() function of getdeveloperlib.py was not
> updated accordingly, and continued to pass absolute paths. This caused
> "get-developers -c" to return the entire list of files in Buildroot as
> being unmaintained, as none of them were matching the file listed in
> the DEVELOPERS file.
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Committed to 2021.02.x and 2021.08.x, thanks.
--
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Buildroot] [PATCH 1/2] utils/getdeveloperlib.py: fix check_output() return value decoding
2021-11-02 22:20 [Buildroot] [PATCH 1/2] utils/getdeveloperlib.py: fix check_output() return value decoding Thomas Petazzoni
2021-11-02 22:20 ` [Buildroot] [PATCH 2/2] utils/getdeveloperlib.py: call Developer.hasfile() with relative path Thomas Petazzoni
@ 2021-11-03 21:15 ` Peter Korsgaard
2021-11-03 21:53 ` Thomas Petazzoni
1 sibling, 1 reply; 7+ messages in thread
From: Peter Korsgaard @ 2021-11-03 21:15 UTC (permalink / raw)
To: Thomas Petazzoni; +Cc: buildroot
>>>>> "Thomas" == Thomas Petazzoni <thomas.petazzoni@bootlin.com> writes:
> In Python 3.x, check_output() returns a "bytes" array, and not a
> string. Its result needs to be decoded to be turned into a
> string. Without this fix, "get-developers -c" bails out with:
> Traceback (most recent call last):
> File "/home/thomas/projets/buildroot/./utils/get-developers", line 105, in <module>
> __main__()
> File "/home/thomas/projets/buildroot/./utils/get-developers", line 53, in __main__
> files = getdeveloperlib.check_developers(devs)
> File "/home/thomas/projets/buildroot/utils/getdeveloperlib.py", line 280, in check_developers
> files = subprocess.check_output(cmd).strip().split("\n")
> TypeError: a bytes-like object is required, not 'str'
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Alternatively we could use universal_newlines=True, but Ok - Committed
to 2021.02.x and 2021.08.x, thanks.
--
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [Buildroot] [PATCH 1/2] utils/getdeveloperlib.py: fix check_output() return value decoding
2021-11-03 21:15 ` [Buildroot] [PATCH 1/2] utils/getdeveloperlib.py: fix check_output() return value decoding Peter Korsgaard
@ 2021-11-03 21:53 ` Thomas Petazzoni
2021-11-03 22:10 ` Peter Korsgaard
0 siblings, 1 reply; 7+ messages in thread
From: Thomas Petazzoni @ 2021-11-03 21:53 UTC (permalink / raw)
To: Peter Korsgaard; +Cc: buildroot
On Wed, 03 Nov 2021 22:15:42 +0100
Peter Korsgaard <peter@korsgaard.com> wrote:
> >>>>> "Thomas" == Thomas Petazzoni <thomas.petazzoni@bootlin.com> writes:
>
> > In Python 3.x, check_output() returns a "bytes" array, and not a
> > string. Its result needs to be decoded to be turned into a
> > string. Without this fix, "get-developers -c" bails out with:
>
> > Traceback (most recent call last):
> > File "/home/thomas/projets/buildroot/./utils/get-developers", line 105, in <module>
> > __main__()
> > File "/home/thomas/projets/buildroot/./utils/get-developers", line 53, in __main__
> > files = getdeveloperlib.check_developers(devs)
> > File "/home/thomas/projets/buildroot/utils/getdeveloperlib.py", line 280, in check_developers
> > files = subprocess.check_output(cmd).strip().split("\n")
> > TypeError: a bytes-like object is required, not 'str'
>
> > Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
>
> Alternatively we could use universal_newlines=True, but Ok - Committed
> to 2021.02.x and 2021.08.x, thanks.
But was this committed to master already? It seems not. Isn't it
dangerous to start committing stuff to stable branches that are not in
master? I thought you were only cherry-picking stuff from master.
Thomas
--
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [Buildroot] [PATCH 1/2] utils/getdeveloperlib.py: fix check_output() return value decoding
2021-11-03 21:53 ` Thomas Petazzoni
@ 2021-11-03 22:10 ` Peter Korsgaard
2021-11-03 22:41 ` Thomas Petazzoni
0 siblings, 1 reply; 7+ messages in thread
From: Peter Korsgaard @ 2021-11-03 22:10 UTC (permalink / raw)
To: Thomas Petazzoni; +Cc: buildroot
>>>>> "Thomas" == Thomas Petazzoni <thomas.petazzoni@bootlin.com> writes:
> On Wed, 03 Nov 2021 22:15:42 +0100
> Peter Korsgaard <peter@korsgaard.com> wrote:
>> >>>>> "Thomas" == Thomas Petazzoni <thomas.petazzoni@bootlin.com> writes:
>>
>> > In Python 3.x, check_output() returns a "bytes" array, and not a
>> > string. Its result needs to be decoded to be turned into a
>> > string. Without this fix, "get-developers -c" bails out with:
>>
>> > Traceback (most recent call last):
>> > File "/home/thomas/projets/buildroot/./utils/get-developers", line 105, in <module>
>> > __main__()
>> > File "/home/thomas/projets/buildroot/./utils/get-developers", line 53, in __main__
>> > files = getdeveloperlib.check_developers(devs)
>> > File "/home/thomas/projets/buildroot/utils/getdeveloperlib.py", line 280, in check_developers
>> > files = subprocess.check_output(cmd).strip().split("\n")
>> > TypeError: a bytes-like object is required, not 'str'
>>
>> > Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
>>
>> Alternatively we could use universal_newlines=True, but Ok - Committed
>> to 2021.02.x and 2021.08.x, thanks.
> But was this committed to master already? It seems not. Isn't it
> dangerous to start committing stuff to stable branches that are not in
> master? I thought you were only cherry-picking stuff from master.
I am, you applied it to master yesterday?
https://git.buildroot.net/buildroot/commit/?id=53da6a7c05f75af925d235f22db2142b5067806e
--
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2021-11-03 22:41 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-02 22:20 [Buildroot] [PATCH 1/2] utils/getdeveloperlib.py: fix check_output() return value decoding Thomas Petazzoni
2021-11-02 22:20 ` [Buildroot] [PATCH 2/2] utils/getdeveloperlib.py: call Developer.hasfile() with relative path Thomas Petazzoni
2021-11-03 21:15 ` Peter Korsgaard
2021-11-03 21:15 ` [Buildroot] [PATCH 1/2] utils/getdeveloperlib.py: fix check_output() return value decoding Peter Korsgaard
2021-11-03 21:53 ` Thomas Petazzoni
2021-11-03 22:10 ` Peter Korsgaard
2021-11-03 22:41 ` Thomas Petazzoni
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox