chiark / gitweb /
buildorder.py: add targeted build order
authorFrancisco Demartino <demartino.francisco@gmail.com>
Thu, 24 Dec 2015 06:29:34 +0000 (03:29 -0300)
committerFrancisco Demartino <demartino.francisco@gmail.com>
Thu, 24 Dec 2015 06:29:34 +0000 (03:29 -0300)
Now you can run the following:

`buildorder.py <package> [<package> ...]`

and get the buildorder just for building those packages

buildorder.py

index bb248a95c3d76e9d8f716db659323d1cd63cc053..273a10d5755ec2ff5a66480cd3738b33e31267a3 100755 (executable)
@@ -9,10 +9,6 @@ def die(msg):
     sys.exit('ERROR: ' + msg)
 
 
-if len(sys.argv) != 1:
-    die('buildorder.py takes no arguments')
-
-
 class TermuxBuildFile(object):
     def __init__(self, path):
         self.path = path
@@ -192,6 +188,17 @@ def generate_and_print_buildorder():
 
     sys.exit(0)
 
+
+def print_after_deps_recursive(pkg):
+    for dep in sorted(pkg.deps):
+        print_after_deps_recursive(pkgs_map[dep])
+    print(pkg.name)
+
 if __name__ == '__main__':
     populate()
-    generate_and_print_buildorder()
+
+    if len(sys.argv) == 1:
+        generate_and_print_buildorder()
+
+    for target in sys.argv[1:]:
+        print_after_deps_recursive(pkgs_map[target])