From: Hans-Christoph Steiner Date: Fri, 10 Mar 2017 17:28:22 +0000 (+0100) Subject: include non-APKs that match metadata and fdroid-generated filenames X-Git-Tag: 0.8~109^2~1 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=6aca9068633ffac5712fe149b73b84b12c13ea0a;p=fdroidserver.git include non-APKs that match metadata and fdroid-generated filenames Since it is now possible to build and include arbitrary files, like OTA update ZIP files, the update procedure needs to look for non-APK files that match the packageName_versionCode pattern of fdroid-generated files. !193 admin#14 privileged-extension#9 --- diff --git a/fdroidserver/update.py b/fdroidserver/update.py index 203e101f..b10146f5 100644 --- a/fdroidserver/update.py +++ b/fdroidserver/update.py @@ -580,6 +580,14 @@ def scan_repo_files(apkcache, repodir, knownapks, use_date_from_file=False): repo_file['version'] = shasum # the static ID is the SHA256 unless it is set in the metadata repo_file['id'] = shasum + n = name.split('_') + if len(n) == 2: + packageName = n[0] + versionCode = n[1].split('.')[0] + if re.match(r'^-?[0-9]+$', versionCode) \ + and common.is_valid_package_name(name.split('_')[0]): + repo_file['id'] = packageName + repo_file['versioncode'] = int(versionCode) srcfilename = name + ".src.tar.gz" if os.path.exists(os.path.join(repodir, srcfilename)): repo_file['srcname'] = srcfilename diff --git a/tests/metadata/fake.ota.update.txt b/tests/metadata/fake.ota.update.txt new file mode 100644 index 00000000..264ba833 --- /dev/null +++ b/tests/metadata/fake.ota.update.txt @@ -0,0 +1,42 @@ +Categories:System +License:Apache-2.0 +Web Site:https://f-droid.org +Source Code:https://gitlab.com/fdroid/privileged-extension +Issue Tracker:https://gitlab.com/fdroid/privileged-extension/issues +Donate:https://f-droid.org/about + +Auto Name:Fake OTA Update +Summary:Tests whether OTA ZIP files are being include +Description: +F-Droid can make use of system privileges or permissions to +install, update and remove applications on its own. The only way to obtain those +privileges is to become a system app. + +This is where the Privileged Extension comes in - being a separate app and much +smaller, it can be installed as a system app and communicate with the main app +via AIDL IPC. + +This has several advantages: + +* Reduced disk usage in the system partition +* System updates don't remove F-Droid +* The process of installing into system via root is safer + +This is packaged as an OTA (Over-The-Air) update ZIP file. It must be installed +using TWRP or other Android recovery that can flash updates to the system from +the /data/data/org.fdroid.fdroid folder on the /data partition. The standalone +APK is called F-Droid Privileged Extension. +. + +Repo Type:git +Repo:https://gitlab.com/fdroid/privileged-extension.git + +Build:0.2.1,2000 + commit=0.2.1 + output=app/build/distributions/FDroidPrivilegedExtensionFromBinaries-0.2.1.zip + build=gradle assembleUpdateZipFromBinariesDebug + +Auto Update Mode:Version %v +Update Check Mode:Tags +Current Version:0.2.1 +Current Version Code:2000 diff --git a/tests/repo/index.xml b/tests/repo/index.xml index 14ee0205..e16da963 100644 --- a/tests/repo/index.xml +++ b/tests/repo/index.xml @@ -1,6 +1,6 @@ - + This is a repository of apps to be used with F-Droid. Applications in this repository are either official binaries built by the original application developers, or are binaries built from source by the admin of f-droid.org using the tools on https://gitlab.com/u/fdroid. http://foobarfoobarfoobar.onion/fdroid/repo https://foo.bar/fdroid/repo @@ -8,6 +8,31 @@ + + fake.ota.update + 2016-03-10 + 2016-03-10 + fake.ota.update_1234.zip + Tests whether OTA ZIP files are being include + <p>F-Droid can make use of system privileges or permissions to install, update and remove applications on its own. The only way to obtain those privileges is to become a system app.</p><p>This is where the Privileged Extension comes in - being a separate app and much smaller, it can be installed as a system app and communicate with the main app via AIDL IPC.</p><p>This has several advantages:</p><ul><li> Reduced disk usage in the system partition</li><li> System updates don't remove F-Droid</li><li> The process of installing into system via root is safer</li></ul><p>This is packaged as an OTA (Over-The-Air) update ZIP file. It must be installed using TWRP or other Android recovery that can flash updates to the system from the /data/data/org.fdroid.fdroid folder on the /data partition. The standalone APK is called F-Droid Privileged Extension.</p> + Apache-2.0 + System + System + https://f-droid.org + https://gitlab.com/fdroid/privileged-extension + https://gitlab.com/fdroid/privileged-extension/issues + https://f-droid.org/about + 0.2.1 + 2000 + + 897a92a4ccff4f415f6ba275b2af16d4ecaee60a983b215bddcb9f8964e7a24c + 1234 + fake.ota.update_1234.zip + 897a92a4ccff4f415f6ba275b2af16d4ecaee60a983b215bddcb9f8964e7a24c + 233 + 2016-03-10 + + obb.main.oldversion 2013-12-31 diff --git a/tests/stats/known_apks.txt b/tests/stats/known_apks.txt index 0542177b..94a40a74 100644 --- a/tests/stats/known_apks.txt +++ b/tests/stats/known_apks.txt @@ -1,3 +1,4 @@ +fake.ota.update_1234.zip 897a92a4ccff4f415f6ba275b2af16d4ecaee60a983b215bddcb9f8964e7a24c 2016-03-10 obb.main.oldversion_1444412523.apk obb.main.oldversion 2013-12-31 obb.main.twoversions_1101613.apk obb.main.twoversions 2015-10-12 obb.main.twoversions_1101615.apk obb.main.twoversions 2016-01-01