build-package: handle -dev package download from buildorder.py
This commit is contained in:
parent
ca475bf2be
commit
bc217587fb
@ -8,7 +8,9 @@ termux_extract_dep_info() {
|
||||
TERMUX_PKG_PLATFORM_INDEPENDENT=""
|
||||
source ${PKG_DIR}/build.sh
|
||||
TERMUX_SUBPKG_PLATFORM_INDEPENDENT=$TERMUX_PKG_PLATFORM_INDEPENDENT
|
||||
source ${PKG_DIR}/${PKG}.subpackage.sh
|
||||
if [ "$TERMUX_INSTALL_DEPS" = false ] || [ -n "${TERMUX_PKG_NO_DEVELSPLIT}" ] || [ "${PKG/-dev/}-dev" != "${PKG}" ]; then
|
||||
source ${PKG_DIR}/${PKG}.subpackage.sh
|
||||
fi
|
||||
if [ "$TERMUX_SUBPKG_PLATFORM_INDEPENDENT" = yes ]; then
|
||||
echo all
|
||||
else
|
||||
|
@ -42,15 +42,6 @@ termux_step_start_build() {
|
||||
)
|
||||
fi
|
||||
|
||||
if termux_download_deb $PKG-dev $DEP_ARCH $DEP_VERSION; then
|
||||
(
|
||||
cd $TERMUX_COMMON_CACHEDIR-$DEP_ARCH
|
||||
ar x $PKG-dev_${DEP_VERSION}_${DEP_ARCH}.deb data.tar.xz
|
||||
tar xf data.tar.xz --no-overwrite-dir -C /
|
||||
)
|
||||
else
|
||||
echo "Download of $PKG-dev@$DEP_VERSION from $TERMUX_REPO_URL failed"
|
||||
fi
|
||||
mkdir -p /data/data/.built-packages
|
||||
echo "$DEP_VERSION" > "/data/data/.built-packages/$PKG"
|
||||
done<<<$(./scripts/buildorder.py -i "$TERMUX_PKG_BUILDER_DIR" $TERMUX_PACKAGES_DIRECTORIES || echo "ERROR")
|
||||
|
@ -45,13 +45,19 @@ def parse_build_file_dependencies(path):
|
||||
for dependency_value in re.split(',|\\|', dependencies_string):
|
||||
# Replace parenthesis to ignore version qualifiers as in "gcc (>= 5.0)":
|
||||
dependency_value = re.sub(r'\(.*?\)', '', dependency_value).strip()
|
||||
# Handle dependencies on *-dev packages:
|
||||
dependency_value = re.sub('-dev$', '', dependency_value)
|
||||
|
||||
dependencies.append(dependency_value)
|
||||
|
||||
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):
|
||||
"A main package definition represented by a directory with a build.sh file."
|
||||
def __init__(self, dir_path, fast_build_mode):
|
||||
@ -80,6 +86,11 @@ class TermuxPackage(object):
|
||||
self.subpkgs.append(subpkg)
|
||||
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
|
||||
self.deps.discard(self.name)
|
||||
# Do not depend on any sub package
|
||||
@ -102,13 +113,16 @@ class TermuxPackage(object):
|
||||
|
||||
class TermuxSubPackage:
|
||||
"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:
|
||||
raise Exception("SubPackages should have a parent")
|
||||
|
||||
self.name = os.path.basename(subpackage_file_path).split('.subpackage.sh')[0]
|
||||
self.parent = parent
|
||||
self.deps = parse_build_file_dependencies(subpackage_file_path)
|
||||
if virtual:
|
||||
self.deps = set([parent.name])
|
||||
else:
|
||||
self.deps = parse_build_file_dependencies(subpackage_file_path)
|
||||
self.dir = parent.dir
|
||||
|
||||
self.needed_by = set() # Populated outside constructor, reverse of deps.
|
||||
|
Loading…
Reference in New Issue
Block a user