summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2016-07-23 20:14:02 -0500
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2016-07-23 20:14:09 -0500
commit3477433db48209b0449cbe360688e4383c73cd2b (patch)
tree5685deddf0df217a1a0fa695c7b147183ea6ab0e
parentdb0be3d5d7f13a70fb9456bfd0a8481323ad7d2e (diff)
downloadapkkit-3477433db48209b0449cbe360688e4383c73cd2b.tar.gz
apkkit-3477433db48209b0449cbe360688e4383c73cd2b.tar.bz2
apkkit-3477433db48209b0449cbe360688e4383c73cd2b.tar.xz
apkkit-3477433db48209b0449cbe360688e4383c73cd2b.zip
APKFile: correctly handle wildcards in split paths
Walk the image dir to find anything that matches, and add it. Otherwise the directories aren't crawled (since they may not match). This fixes a bug where gcc-devel did not contain libgcc.a.
-rw-r--r--apkkit/io/apkfile.py16
1 files changed, 13 insertions, 3 deletions
diff --git a/apkkit/io/apkfile.py b/apkkit/io/apkfile.py
index bc8d783..3cce809 100644
--- a/apkkit/io/apkfile.py
+++ b/apkkit/io/apkfile.py
@@ -15,6 +15,7 @@ from copy import deepcopy
from fnmatch import fnmatch
from functools import partial
from itertools import chain
+from pathlib import Path
from subprocess import Popen, PIPE
from tempfile import mkstemp
@@ -364,9 +365,7 @@ class APKFile:
splits += load_package_split(package)
splits = [split for split in splits if split is not None]
- exclude_from_base = list(chain.from_iterable([
- [path for path in split['paths']] for split in splits
- ]))
+ exclude_from_base = []
for split in splits:
split_package = deepcopy(package)
@@ -385,6 +384,15 @@ class APKFile:
else:
split_package._provides = []
+ file_matches = []
+ for path in split['paths']:
+ if '*' in path:
+ file_matches += [str(f.relative_to(datadir))
+ for f in Path(datadir).glob(path)]
+ split['paths'].remove(path)
+
+ split['paths'] += file_matches
+
LOGGER.info('Probing for split package: %s', split_package.name)
combined = APKFile._create_file(split_package, datadir, sign,
signfile, data_hash, hash_method,
@@ -392,6 +400,8 @@ class APKFile:
if combined:
files.append(cls(fileobj=combined, package=split_package))
+ exclude_from_base += [path for path in split['paths']]
+
LOGGER.info('Processing main package: %s', package.name)
combined = APKFile._create_file(package, datadir, sign, signfile,
data_hash, hash_method, mode,