Skip to contentSkip to conversation

Revert "utils/get-developers: make it callable from elsewhere than the toplevel directory"

PATCH New Peter Korsgaard 1 participant 6 messages Jan 3, 2019 – Jan 24, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 Revert "utils/get-developers: make it callable from elsewhere than the toplevel directory"

This reverts commit 62d5558f76a790d1c1b3a1834f1736dc86b6e34f.

This actually does not work, as patches contain paths relative to the toplevel directory as well.

---
 utils/get-developers     | 6 ++----
 utils/getdeveloperlib.py | 2 --
 2 files changed, 2 insertions(+), 6 deletions(-)
utils/get-developers +2 -4
index c887938859..ce882e6699 100755
@@ -24,9 +24,7 @@ def parse_args():
 
 
 def __main__():
-    # DEVELOPERS is one level up from here
-    devs_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..')
-    devs = getdeveloperlib.parse_developers(devs_dir)
+    devs = getdeveloperlib.parse_developers()
     if devs is None:
         sys.exit(1)
     args = parse_args()
@@ -52,7 +50,7 @@ def __main__():
 
     # Handle the check action
     if args.check:
-        files = getdeveloperlib.check_developers(devs, devs_dir)
+        files = getdeveloperlib.check_developers(devs)
         for f in files:
             print(f)
 
utils/getdeveloperlib.py +0 -2
index 84665520c6..2c8d477583 100644
@@ -158,8 +158,6 @@ def parse_developers(basepath=None):
     linen = 0
     if basepath is None:
         basepath = os.getcwd()
-    else:
-        basepath = os.path.abspath(basepath)
     with open(os.path.join(basepath, "DEVELOPERS"), "r") as f:
         files = []
         name = None
Signature · 1 line
2.11.0
#1 lore raw

PATCH 1/2 Revert "utils/get-developers: make it callable from elsewhere than the toplevel directory"

Quoted 7 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Peter" == Peter Korsgaard <[email protected]> writes:

This reverts commit 62d5558f76a790d1c1b3a1834f1736dc86b6e34f. This actually does not work, as patches contain paths relative to the toplevel directory as well.

Committed, thanks.

Signature · 1 line
Bye, Peter Korsgaard
#2 lore raw

PATCH 1/2 Revert "utils/get-developers: make it callable from elsewhere than the toplevel directory"

In reply to Peter Korsgaard
Quoted 7 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Peter" == Peter Korsgaard <[email protected]> writes:

This reverts commit 62d5558f76a790d1c1b3a1834f1736dc86b6e34f. This actually does not work, as patches contain paths relative to the toplevel directory as well.

Committed to 2018.02.x and 2018.11.x, thanks.

Signature · 1 line
Bye, Peter Korsgaard
#3 lore raw

PATCH 2/2 utils/get-developers: really make it callable from elsewhere than the toplevel directory

In reply to Peter Korsgaard

Commit 62d5558f76a (utils/get-developers: make it callable from elsewhere than the toplevel directory) tried to fix this by passing in the toplevel directory when the DEVELOPERS file is parsed.

Unfortunately this is not enough, as E.G. also the paths listed in the patches are relative to the toplevel directory, causing it to not match the entries in the DEVELOPERS file.

In concept this can be fixed by also passing the toplevel directory to the Developers class, but the simplest solution is just to chdir to the toplevel Buildroot directory before calling any of the getdeveloperlib functions.

This does require us to finish parsing command line arguments (which opens the provided patch files) to not get into trouble with relative paths to patches before chdir'ing / initializing getdeveloperlib.

---
 utils/get-developers | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
utils/get-developers +8 -3
index ce882e6699..750fc556dc 100755
@@ -24,9 +24,6 @@ def parse_args():
 
 
 def __main__():
-    devs = getdeveloperlib.parse_developers()
-    if devs is None:
-        sys.exit(1)
     args = parse_args()
 
     # Check that only one action is given
@@ -48,6 +45,14 @@ def __main__():
         print("No action specified")
         return
 
+    # getdeveloperlib expects to be executed from the toplevel buildroot
+    # directory, which is one level up from this script
+    os.chdir(os.path.join(os.path.dirname(os.path.realpath(__file__)), '..'))
+
+    devs = getdeveloperlib.parse_developers()
+    if devs is None:
+        sys.exit(1)
+
     # Handle the check action
     if args.check:
         files = getdeveloperlib.check_developers(devs)
Signature · 1 line
2.11.0
#4 lore raw

PATCH 2/2 utils/get-developers: really make it callable from elsewhere than the toplevel directory

Quoted 14 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Peter" == Peter Korsgaard <[email protected]> writes:

Commit 62d5558f76a (utils/get-developers: make it callable from elsewhere than the toplevel directory) tried to fix this by passing in the toplevel directory when the DEVELOPERS file is parsed.

Unfortunately this is not enough, as E.G. also the paths listed in the patches are relative to the toplevel directory, causing it to not match the entries in the DEVELOPERS file.

In concept this can be fixed by also passing the toplevel directory to the Developers class, but the simplest solution is just to chdir to the toplevel Buildroot directory before calling any of the getdeveloperlib functions.

Quoted 5 lines

This does require us to finish parsing command line arguments (which opens the provided patch files) to not get into trouble with relative paths to patches before chdir'ing / initializing getdeveloperlib.

Committed, thanks.

Signature · 1 line
Bye, Peter Korsgaard
#5 lore raw

PATCH 2/2 utils/get-developers: really make it callable from elsewhere than the toplevel directory

In reply to Peter Korsgaard
Quoted 14 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Peter" == Peter Korsgaard <[email protected]> writes:

Commit 62d5558f76a (utils/get-developers: make it callable from elsewhere than the toplevel directory) tried to fix this by passing in the toplevel directory when the DEVELOPERS file is parsed.

Unfortunately this is not enough, as E.G. also the paths listed in the patches are relative to the toplevel directory, causing it to not match the entries in the DEVELOPERS file.

In concept this can be fixed by also passing the toplevel directory to the Developers class, but the simplest solution is just to chdir to the toplevel Buildroot directory before calling any of the getdeveloperlib functions.

Quoted 5 lines

This does require us to finish parsing command line arguments (which opens the provided patch files) to not get into trouble with relative paths to patches before chdir'ing / initializing getdeveloperlib.

Committed to 2018.02.x and 2018.11.x, thanks.

Signature · 1 line
Bye, Peter Korsgaard