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