|
@ -45,13 +45,19 @@ def parse_build_file_dependencies(path): |
|
|
for dependency_value in re.split(',|\\|', dependencies_string): |
|
|
for dependency_value in re.split(',|\\|', dependencies_string): |
|
|
# Replace parenthesis to ignore version qualifiers as in "gcc (>= 5.0)": |
|
|
# Replace parenthesis to ignore version qualifiers as in "gcc (>= 5.0)": |
|
|
dependency_value = re.sub(r'\(.*?\)', '', dependency_value).strip() |
|
|
dependency_value = re.sub(r'\(.*?\)', '', dependency_value).strip() |
|
|
# Handle dependencies on *-dev packages: |
|
|
|
|
|
dependency_value = re.sub('-dev$', '', dependency_value) |
|
|
|
|
|
|
|
|
|
|
|
dependencies.append(dependency_value) |
|
|
dependencies.append(dependency_value) |
|
|
|
|
|
|
|
|
return set(dependencies) |
|
|
return set(dependencies) |
|
|
|
|
|
|
|
|
|
|
|
def develsplit(path): |
|
|
|
|
|
with open(path, encoding="utf-8") as build_script: |
|
|
|
|
|
for line in build_script: |
|
|
|
|
|
if line.startswith('TERMUX_PKG_NO_DEVELSPLIT'): |
|
|
|
|
|
return False |
|
|
|
|
|
|
|
|
|
|
|
return True |
|
|
|
|
|
|
|
|
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, fast_build_mode): |
|
|
def __init__(self, dir_path, fast_build_mode): |
|
@ -80,6 +86,11 @@ class TermuxPackage(object): |
|
|
self.subpkgs.append(subpkg) |
|
|
self.subpkgs.append(subpkg) |
|
|
self.deps |= subpkg.deps |
|
|
self.deps |= subpkg.deps |
|
|
|
|
|
|
|
|
|
|
|
if develsplit(build_sh_path): |
|
|
|
|
|
subpkg = TermuxSubPackage(self.dir + '/' + self.name + '-dev' + '.subpackage.sh', self, virtual=True) |
|
|
|
|
|
self.subpkgs.append(subpkg) |
|
|
|
|
|
self.deps.add(subpkg.name) |
|
|
|
|
|
|
|
|
# Do not depend on itself |
|
|
# Do not depend on itself |
|
|
self.deps.discard(self.name) |
|
|
self.deps.discard(self.name) |
|
|
# Do not depend on any sub package |
|
|
# Do not depend on any sub package |
|
@ -102,12 +113,15 @@ class TermuxPackage(object): |
|
|
|
|
|
|
|
|
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, virtual=False): |
|
|
if parent is None: |
|
|
if parent is None: |
|
|
raise Exception("SubPackages should have a parent") |
|
|
raise Exception("SubPackages should have a parent") |
|
|
|
|
|
|
|
|
self.name = os.path.basename(subpackage_file_path).split('.subpackage.sh')[0] |
|
|
self.name = os.path.basename(subpackage_file_path).split('.subpackage.sh')[0] |
|
|
self.parent = parent |
|
|
self.parent = parent |
|
|
|
|
|
if virtual: |
|
|
|
|
|
self.deps = set([parent.name]) |
|
|
|
|
|
else: |
|
|
self.deps = parse_build_file_dependencies(subpackage_file_path) |
|
|
self.deps = parse_build_file_dependencies(subpackage_file_path) |
|
|
self.dir = parent.dir |
|
|
self.dir = parent.dir |
|
|
|
|
|
|
|
|