From db0be3d5d7f13a70fb9456bfd0a8481323ad7d2e Mon Sep 17 00:00:00 2001 From: Andrew Wilcox Date: Wed, 13 Jul 2016 02:09:56 -0500 Subject: APKFile: allow split packages to use * for files included --- apkkit/io/apkfile.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/apkkit/io/apkfile.py b/apkkit/io/apkfile.py index 1257ac6..bc8d783 100644 --- a/apkkit/io/apkfile.py +++ b/apkkit/io/apkfile.py @@ -11,7 +11,8 @@ import sys import tarfile import yaml -from copy import copy +from copy import deepcopy +from fnmatch import fnmatch from functools import partial from itertools import chain from subprocess import Popen, PIPE @@ -94,7 +95,8 @@ def split_filter(split_info, tar_info): paths.add(component) if any([tar_info.name.startswith(path) for path in split_info['paths']]) or\ - any([tar_info.name == component for component in paths]): + any([tar_info.name == component for component in paths]) or\ + any([fnmatch(tar_info.name, path) for path in split_info['paths']]): return tar_info return None @@ -110,7 +112,8 @@ def base_filter(exclude_from_base, tar_info): The TarInfo object to inspect. """ - if any([tar_info.name.startswith(path) for path in exclude_from_base]): + if any([tar_info.name.startswith(path) for path in exclude_from_base]) or\ + any([fnmatch(tar_info.name, path) for path in exclude_from_base]): return None return tar_info @@ -366,7 +369,7 @@ class APKFile: ])) for split in splits: - split_package = copy(package) + split_package = deepcopy(package) split_package._pkgname = split['name'].format(name=package.name) if 'desc' in split: -- cgit v1.2.3-70-g09d2