|
@ -7,7 +7,6 @@ import sys |
|
|
|
|
|
|
|
|
from itertools import filterfalse |
|
|
from itertools import filterfalse |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def unique_everseen(iterable, key=None): |
|
|
def unique_everseen(iterable, key=None): |
|
|
"""List unique elements, preserving order. Remember all elements ever seen. |
|
|
"""List unique elements, preserving order. Remember all elements ever seen. |
|
|
See https://docs.python.org/3/library/itertools.html#itertools-recipes |
|
|
See https://docs.python.org/3/library/itertools.html#itertools-recipes |
|
@ -27,12 +26,10 @@ def unique_everseen(iterable, key=None): |
|
|
seen_add(k) |
|
|
seen_add(k) |
|
|
yield element |
|
|
yield element |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def die(msg): |
|
|
def die(msg): |
|
|
"Exit the process with an error message." |
|
|
"Exit the process with an error message." |
|
|
sys.exit('ERROR: ' + msg) |
|
|
sys.exit('ERROR: ' + msg) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def parse_build_file_dependencies(path): |
|
|
def parse_build_file_dependencies(path): |
|
|
"Extract the dependencies of a build.sh or *.subpackage.sh file." |
|
|
"Extract the dependencies of a build.sh or *.subpackage.sh file." |
|
|
pkg_dep_prefix = 'TERMUX_PKG_DEPENDS=' |
|
|
pkg_dep_prefix = 'TERMUX_PKG_DEPENDS=' |
|
@ -64,7 +61,6 @@ def parse_build_file_dependencies(path): |
|
|
|
|
|
|
|
|
return set(dependencies) |
|
|
return set(dependencies) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class TermuxPackage(object): |
|
|
class TermuxPackage(object): |
|
|
"A main package definition represented by a directory with a build.sh file." |
|
|
"A main package definition represented by a directory with a build.sh file." |
|
|
def __init__(self, dir_path): |
|
|
def __init__(self, dir_path): |
|
@ -111,7 +107,6 @@ class TermuxPackage(object): |
|
|
result += [dependency_package] |
|
|
result += [dependency_package] |
|
|
return unique_everseen(result) |
|
|
return unique_everseen(result) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class TermuxSubPackage: |
|
|
class TermuxSubPackage: |
|
|
"A sub-package represented by a ${PACKAGE_NAME}.subpackage.sh file." |
|
|
"A sub-package represented by a ${PACKAGE_NAME}.subpackage.sh file." |
|
|
def __init__(self, subpackage_file_path, parent): |
|
|
def __init__(self, subpackage_file_path, parent): |
|
@ -125,7 +120,6 @@ class TermuxSubPackage: |
|
|
def __repr__(self): |
|
|
def __repr__(self): |
|
|
return "<{} '{}' parent='{}'>".format(self.__class__.__name__, self.name, self.parent) |
|
|
return "<{} '{}' parent='{}'>".format(self.__class__.__name__, self.name, self.parent) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def read_packages_from_directories(directories): |
|
|
def read_packages_from_directories(directories): |
|
|
"""Construct a map from package name to TermuxPackage. |
|
|
"""Construct a map from package name to TermuxPackage. |
|
|
For subpackages this maps from the subpackage name to the parent package.""" |
|
|
For subpackages this maps from the subpackage name to the parent package.""" |
|
@ -160,7 +154,6 @@ def read_packages_from_directories(directories): |
|
|
dep_pkg.needed_by.add(pkg) |
|
|
dep_pkg.needed_by.add(pkg) |
|
|
return pkgs_map |
|
|
return pkgs_map |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def generate_full_buildorder(pkgs_map): |
|
|
def generate_full_buildorder(pkgs_map): |
|
|
"Generate a build order for building all packages." |
|
|
"Generate a build order for building all packages." |
|
|
build_order = [] |
|
|
build_order = [] |
|
@ -214,7 +207,6 @@ def generate_full_buildorder(pkgs_map): |
|
|
|
|
|
|
|
|
return build_order |
|
|
return build_order |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def generate_target_buildorder(target_path, pkgs_map): |
|
|
def generate_target_buildorder(target_path, pkgs_map): |
|
|
"Generate a build order for building the dependencies of the specified package." |
|
|
"Generate a build order for building the dependencies of the specified package." |
|
|
if target_path.endswith('/'): |
|
|
if target_path.endswith('/'): |
|
|