From 0ace34fd5b337dba97c1e008eb5d962188cadd72 Mon Sep 17 00:00:00 2001 From: Johan Lorenzo Date: Mon, 23 Sep 2019 16:18:43 +0200 Subject: [PATCH] Fix false positive exception about multiple architectures --- CHANGELOG.md | 1 + mozapkpublisher/common/apk/extractor.py | 2 +- mozapkpublisher/test/common/apk/test_extractor.py | 5 ++++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cbcc8e96..f3f31c33 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). ### Fixed * Focus and Klar were sent in the same transaction, which cannot happen. +* False positive exception about multiple architectures ### Removed * `update_apk_description.py`: https://l10n.mozilla-community.org/stores_l10n/ is now retired making the script useless. diff --git a/mozapkpublisher/common/apk/extractor.py b/mozapkpublisher/common/apk/extractor.py index f280cbfc..21b34f3a 100644 --- a/mozapkpublisher/common/apk/extractor.py +++ b/mozapkpublisher/common/apk/extractor.py @@ -55,7 +55,7 @@ def extract_metadata(original_apk_path, extract_firefox_metadata): def _extract_architecture(apk_zip, original_apk_path): files_with_architecture_in_path = [ name for name in apk_zip.namelist() - if _DIRECTORY_WITH_ARCHITECTURE_METADATA in name + if name.startswith(_DIRECTORY_WITH_ARCHITECTURE_METADATA) ] if not files_with_architecture_in_path: diff --git a/mozapkpublisher/test/common/apk/test_extractor.py b/mozapkpublisher/test/common/apk/test_extractor.py index f521516f..5933da5e 100644 --- a/mozapkpublisher/test/common/apk/test_extractor.py +++ b/mozapkpublisher/test/common/apk/test_extractor.py @@ -44,7 +44,7 @@ def _create_apk_with_locale_content(temp_dir, manifest_content): def _create_apk_with_architecture_content(temp_dir, architecture=None): - random_file_in_lib = os.path.join(temp_dir, 'libmozglue.so') + random_file_in_lib = os.path.join(temp_dir, 'some_random_file') with open(random_file_in_lib, 'w'): pass @@ -53,6 +53,9 @@ def _create_apk_with_architecture_content(temp_dir, architecture=None): if architecture is not None: apk_zip.write(random_file_in_lib, 'lib/{}/libmozglue.so'.format(architecture)) + # Add content which was previously been detected as "architectures" + apk_zip.write(random_file_in_lib, 'assets/extensions/webcompat/lib/about_compat_broker.js') + return apk_path