[diffoscope] 01/05: Remove archive name from apktool.yml and rename it. (Closes: #850501)
Chris Lamb
chris at chris-lamb.co.uk
Mon Jan 9 12:32:17 CET 2017
This is an automated email from the git hooks/post-receive script.
lamby pushed a commit to branch master
in repository diffoscope.
commit b85e7852bf3f202a0cdcb5ad280577050ac9e37a
Author: Maria Glukhova <siamezzze at gmail.com>
Date: Mon Jan 9 02:36:47 2017 +0300
Remove archive name from apktool.yml and rename it. (Closes: #850501)
Signed-off-by: Chris Lamb <lamby at debian.org>
---
diffoscope/comparators/apk.py | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/diffoscope/comparators/apk.py b/diffoscope/comparators/apk.py
index 3cb1905..636cfff 100644
--- a/diffoscope/comparators/apk.py
+++ b/diffoscope/comparators/apk.py
@@ -31,6 +31,18 @@ from .utils.archive import Archive
logger = logging.getLogger(__name__)
+def filter_apk_metadata(filepath, archive_name):
+ new_filename = os.path.join(os.path.split(filepath)[0], "APK metadata")
+ logger.debug("Moving APK metadata from %s to %s", filepath, new_filename)
+ with open(filepath) as f:
+ with open(new_filename, "w") as f_out:
+ for line in f:
+ if not re.match(r'^apkFileName: %s' % os.path.basename(archive_name), line):
+ f_out.write(line)
+ os.remove(filepath)
+ return new_filename
+
+
class ApkContainer(Archive):
@property
def path(self):
@@ -53,6 +65,10 @@ class ApkContainer(Archive):
for root, _, files in os.walk(self._unpacked):
for f in files:
abspath = os.path.join(root, f)
+ # apktool.yml is a file created by apktool and containing metadata information.
+ # Rename it to clarify.
+ if os.path.basename(abspath) == "apktool.yml":
+ abspath = filter_apk_metadata(abspath, os.path.basename(self.source.name))
relpath = abspath[len(self._unpacked)+1:]
self._members.append(relpath)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/diffoscope.git
More information about the diffoscope
mailing list