Compare commits

..

14 Commits

Author SHA1 Message Date
be36ea7105 Bump to 0.3.7.250932 2025-05-11 16:49:23 +04:00
a2c1a28d6f Nuke F-Droid 2025-05-11 16:40:03 +04:00
Pete Fotheringham
581d2e5fe4 Disable commiting and pushing to master 2025-05-02 22:05:22 +01:00
Pete Fotheringham
f504760d3c Merge pull request #45 from karlbaumg/karlbaumg-patch-2
Revert microg.xml path
2025-04-07 21:39:33 +01:00
Karl Baumgartner
761206bc33 Revert microg.xml path
Using /system for this file is hard-coded in MicroG but it breaks  LineageOS device builds with strict requirements around what modules go into system. Reverting to unblock the builds for now.
2025-04-02 13:15:51 +03:00
Pete Fotheringham
c3477ab2b8 Merge pull request #43 Fix microg.xml path from karlbaumg/karlbaumg-patch-1
Fix microg.xml path
2025-03-23 06:46:32 +00:00
Karl Baumgartner
765749285c Fix microg.xml path 2025-03-22 04:10:27 +03:00
Updater Robot
0594cee1c8 Update FDroid to 1.22.0 2025-03-15 13:44:09 +00:00
Pete Fotheringham
210c61bc40 Add link to 17.1 build problems issue 2025-02-21 14:01:41 +00:00
Pete Fotheringham
0f82fa4ec0 Update README.md: add infor about Signature Spoofing in 17.1 2025-02-21 07:08:35 +00:00
Pete Fotheringham
cfb34985d9 Merge pull request #41 from lineageos4microg/pf-remove-backends
Remove microG location backends
2025-02-16 19:50:07 +00:00
Pete Fotheringham
1fd9552a8e Remove references to deleted backends 2025-02-15 20:37:41 +00:00
Pete Fotheringham
122b0a20a0 remove NominatimGeocoderBackend 2025-02-15 19:05:41 +00:00
Pete Fotheringham
2c4778041d remove IchnaeaNlpBackend 2025-02-15 19:04:46 +00:00
30 changed files with 7 additions and 382 deletions

View File

@@ -1,24 +0,0 @@
name: Updater
on:
schedule:
- cron: '37 13 * * *'
workflow_dispatch:
jobs:
Update-Apks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
- run: pipx install pipenv
- uses: actions/setup-python@v4
with:
python-version: '3.9'
cache: 'pipenv'
cache-dependency-path: 'updater/Pipfile.lock'
- run: pipenv install
working-directory: updater
- run: pipenv run python main.py
working-directory: updater

View File

@@ -1 +0,0 @@
1021051

View File

@@ -1,13 +0,0 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := FDroid
LOCAL_SRC_FILES := FDroid.apk
LOCAL_MODULE_CLASS := APPS
LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)
LOCAL_CERTIFICATE := PRESIGNED
# these lines may break builds before 19.1 so make them conditional
ifneq ($(call math_gt_or_eq, $(PLATFORM_SDK_VERSION), 31),)
LOCAL_OPTIONAL_USES_LIBRARIES := androidx.window.extensions androidx.window.sidecar
endif
LOCAL_PRODUCT_MODULE := true
include $(BUILD_PREBUILT)

Binary file not shown.

View File

@@ -1 +0,0 @@
2130

View File

@@ -1,20 +0,0 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := privapp-permissions-org.fdroid.fdroid.privileged.xml
LOCAL_MODULE_CLASS := ETC
LOCAL_MODULE_PATH := $(TARGET_OUT_PRODUCT_ETC)/permissions
LOCAL_SRC_FILES := $(LOCAL_MODULE)
include $(BUILD_PREBUILT)
include $(CLEAR_VARS)
LOCAL_MODULE := FDroidPrivilegedExtension
LOCAL_SRC_FILES := FDroidPrivilegedExtension.apk
LOCAL_MODULE_CLASS := APPS
LOCAL_PRIVILEGED_MODULE := true
LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)
LOCAL_CERTIFICATE := PRESIGNED
LOCAL_REQUIRED_MODULES := privapp-permissions-org.fdroid.fdroid.privileged.xml
LOCAL_PRODUCT_MODULE := true
include $(BUILD_PREBUILT)

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<permissions>
<privapp-permissions package="org.fdroid.fdroid.privileged">
<permission name="android.permission.DELETE_PACKAGES"/>
<permission name="android.permission.INSTALL_PACKAGES"/>
</privapp-permissions>
</permissions>

View File

@@ -1 +0,0 @@
84022612

Binary file not shown.

View File

@@ -1 +0,0 @@
244735012

Binary file not shown.

View File

@@ -1 +0,0 @@
8

View File

@@ -1 +0,0 @@
20036

View File

@@ -1,9 +0,0 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := IchnaeaNlpBackend
LOCAL_SRC_FILES := IchnaeaNlpBackend.apk
LOCAL_MODULE_CLASS := APPS
LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)
LOCAL_CERTIFICATE := PRESIGNED
LOCAL_PRODUCT_MODULE := true
include $(BUILD_PREBUILT)

View File

@@ -1 +0,0 @@
20042

View File

@@ -1,9 +0,0 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := NominatimGeocoderBackend
LOCAL_SRC_FILES := NominatimGeocoderBackend.apk
LOCAL_MODULE_CLASS := APPS
LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)
LOCAL_CERTIFICATE := PRESIGNED
LOCAL_PRODUCT_MODULE := true
include $(BUILD_PREBUILT)

View File

@@ -1,3 +1,7 @@
# This is fork of lineageos4microg/android_vendor_partner_gms
Refer to https://github.com/lineageos4microg/android_vendor_partner_gms to get original repo.
# microG Mobile Services
This is a collection of FOSS APKs, coupled with the respective Makefiles for an
@@ -15,9 +19,9 @@ Example manifest:
</manifest>
```
Note 1. You do not need to set `CUSTOM_PACKAGES` for the packages to be included when building with [our Docker engine](https://github.com/lineageos4microg/docker-lineage-cicd).
Note 1. You do not need to set `CUSTOM_PACKAGES` for the packages to be included when building with [our Docker engine](https://github.com/lineageos4microg/docker-lineage-cicd). LineageOS did not make those changes in the 17.1 branch, so to make a 17.1 build, you will need to apply the changes to `AndroidManifest.xml` and `strings.xml` from [the Android Q LOS 17.1 branch-specific patch](https://github.com/lineageos4microg/docker-lineage-cicd/blob/35b7190bda4f2988845f09e028d266a23fd8b559/src/signature_spoofing_patches/android_frameworks_base-Q.patch). You do not need to apply the other changes in that patch. (See [this issue, and all it's comments](https://github.com/lineageos4microg/android_vendor_partner_gms/issues/42#issuecomment-2674105896) for more information about this)
Note 2. LineageOS now support ***restricted*** signature spoofing, so it is no longer neccessary to patch their sources, unless you want ***unrestricted*** signature spoofing
Note 2. LineageOS now support ***restricted*** signature spoofing, in 18.1 and later branches, so it is no longer neccessary to patch their sources, unless you want ***unrestricted*** signature spoofing
~~For the microG packages to work, signature spoofing must be enabled, by patching the LineageOS sources before building.~~
- ~~If you are building with [our Docker engine](https://github.com/lineageos4microg/docker-lineage-cicd), this is done automatically according to the values of the `SIGNATURE_SPOOFING` variable - see [here](https://github.com/lineageos4microg/docker-lineage-cicd#signature-spoofing). By default, this variable is set to `restricted`, allowing only system apps (those built-in to the ROM) to 'spoof' the signature of another app.~~
- ~~If you are building manually, you can download and include the patches from [here](https://github.com/lineageos4microg/docker-lineage-cicd/tree/master/src/signature_spoofing_patches). If you follow the [microG patching instructions](https://github.com/microg/GmsCore/wiki/Signature-Spoofing), you ROM will allow _**any**_ app, not only system apps, to spoof app signatures. To apply only 'restricted' signature spoofing, you should do something similar to what the Docker engine `build.sh` does in [this code](https://github.com/lineageos4microg/docker-lineage-cicd/blob/c77eabe036a1620499a8c087b732e039e0734656/src/build.sh#L229C1-L231C1).~~
@@ -38,16 +42,9 @@ The symptoms of the problem as some apps from this repo (e.g. FakeStore and GmsC
---------------
The included APKs are:
* FDroid packages (binaries sourced from [here](https://f-droid.org/packages/org.fdroid.fdroid/) and [here](https://f-droid.org/packages/org.fdroid.fdroid.privileged/))
* FDroid: a catalogue of FOSS (Free and Open Source Software) applications for the Android platform
* FDroid Privileged Extension: a FDroid extension to ease the installation/removal of apps
* additional_repos.xml: a simple package to include the [microG FDroid repository](https://microg.org/fdroid.html) in the ROM (requires FDroid >= 1.5)
* microG packages (binaries sourced from [here](https://microg.org/download.html))
* GmsCore: the main component of microG, a FOSS reimplementation of the Google Play Services (requires GsfProxy and FakeStore for full functionality)
* GsfProxy: a GmsCore proxy for legacy GCM compatibility
* FakeStore: an empty package that mocks the existence of the Google Play Store
* IchnaeaNlpBackend: Network location provider using Mozilla Location Service
* NominatimGeocoderBackend: Geocoder backend that uses OSM Nominatim service.
These are official unmodified prebuilt binaries, signed by the
corresponding developers.
These are official unmodified prebuilt binaries, signed by the corresponding developers.

View File

@@ -1,9 +0,0 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := additional_repos.xml
LOCAL_MODULE_CLASS := ETC
LOCAL_MODULE_PATH := $(TARGET_OUT_PRODUCT_ETC)/org.fdroid.fdroid
LOCAL_SRC_FILES := additional_repos.xml
include $(BUILD_PREBUILT)

View File

@@ -1,34 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="additional_repos">
<!-- name -->
<item>microG F-Droid repo</item>
<!-- address -->
<item>https://microg.org/fdroid/repo</item>
<!-- description -->
<item>This is a repository of microG apps to be used with F-Droid. Applications in this repository are signed official binaries built by the microG Team from the corresponding source code.</item>
<!-- version -->
<item>19</item>
<!-- enabled -->
<item>1</item>
<!-- push requests -->
<item>ignore</item>
<!-- pubkey -->
<item>308202ed308201d5a003020102020426ffa009300d06092a864886f70d01010b05003027310b300906035504061302444531183016060355040a130f4e4f47415050532050726f6a656374301e170d3132313030363132303533325a170d3337303933303132303533325a3027310b300906035504061302444531183016060355040a130f4e4f47415050532050726f6a65637430820122300d06092a864886f70d01010105000382010f003082010a02820101009a8d2a5336b0eaaad89ce447828c7753b157459b79e3215dc962ca48f58c2cd7650df67d2dd7bda0880c682791f32b35c504e43e77b43c3e4e541f86e35a8293a54fb46e6b16af54d3a4eda458f1a7c8bc1b7479861ca7043337180e40079d9cdccb7e051ada9b6c88c9ec635541e2ebf0842521c3024c826f6fd6db6fd117c74e859d5af4db04448965ab5469b71ce719939a06ef30580f50febf96c474a7d265bb63f86a822ff7b643de6b76e966a18553c2858416cf3309dd24278374bdd82b4404ef6f7f122cec93859351fc6e5ea947e3ceb9d67374fe970e593e5cd05c905e1d24f5a5484f4aadef766e498adf64f7cf04bddd602ae8137b6eea40722d0203010001a321301f301d0603551d0e04160414110b7aa9ebc840b20399f69a431f4dba6ac42a64300d06092a864886f70d01010b0500038201010007c32ad893349cf86952fb5a49cfdc9b13f5e3c800aece77b2e7e0e9c83e34052f140f357ec7e6f4b432dc1ed542218a14835acd2df2deea7efd3fd5e8f1c34e1fb39ec6a427c6e6f4178b609b369040ac1f8844b789f3694dc640de06e44b247afed11637173f36f5886170fafd74954049858c6096308fc93c1bc4dd5685fa7a1f982a422f2a3b36baa8c9500474cf2af91c39cbec1bc898d10194d368aa5e91f1137ec115087c31962d8f76cd120d28c249cf76f4c70f5baa08c70a7234ce4123be080cee789477401965cfe537b924ef36747e8caca62dfefdd1a6288dcb1c4fd2aaa6131a7ad254e9742022cfd597d2ca5c660ce9e41ff537e5a4041e37</item>
<!-- name -->
<item>microG F-Droid archive</item>
<!-- address -->
<item>https://microg.org/fdroid/archive</item>
<!-- description -->
<item>The repository of older versions of applications from the main repository.</item>
<!-- version -->
<item>19</item>
<!-- enabled -->
<item>0</item>
<!-- push requests -->
<item>ignore</item>
<!-- pubkey -->
<item>308202ed308201d5a003020102020426ffa009300d06092a864886f70d01010b05003027310b300906035504061302444531183016060355040a130f4e4f47415050532050726f6a656374301e170d3132313030363132303533325a170d3337303933303132303533325a3027310b300906035504061302444531183016060355040a130f4e4f47415050532050726f6a65637430820122300d06092a864886f70d01010105000382010f003082010a02820101009a8d2a5336b0eaaad89ce447828c7753b157459b79e3215dc962ca48f58c2cd7650df67d2dd7bda0880c682791f32b35c504e43e77b43c3e4e541f86e35a8293a54fb46e6b16af54d3a4eda458f1a7c8bc1b7479861ca7043337180e40079d9cdccb7e051ada9b6c88c9ec635541e2ebf0842521c3024c826f6fd6db6fd117c74e859d5af4db04448965ab5469b71ce719939a06ef30580f50febf96c474a7d265bb63f86a822ff7b643de6b76e966a18553c2858416cf3309dd24278374bdd82b4404ef6f7f122cec93859351fc6e5ea947e3ceb9d67374fe970e593e5cd05c905e1d24f5a5484f4aadef766e498adf64f7cf04bddd602ae8137b6eea40722d0203010001a321301f301d0603551d0e04160414110b7aa9ebc840b20399f69a431f4dba6ac42a64300d06092a864886f70d01010b0500038201010007c32ad893349cf86952fb5a49cfdc9b13f5e3c800aece77b2e7e0e9c83e34052f140f357ec7e6f4b432dc1ed542218a14835acd2df2deea7efd3fd5e8f1c34e1fb39ec6a427c6e6f4178b609b369040ac1f8844b789f3694dc640de06e44b247afed11637173f36f5886170fafd74954049858c6096308fc93c1bc4dd5685fa7a1f982a422f2a3b36baa8c9500474cf2af91c39cbec1bc898d10194d368aa5e91f1137ec115087c31962d8f76cd120d28c249cf76f4c70f5baa08c70a7234ce4123be080cee789477401965cfe537b924ef36747e8caca62dfefdd1a6288dcb1c4fd2aaa6131a7ad254e9742022cfd597d2ca5c660ce9e41ff537e5a4041e37</item>
</string-array>
</resources>

View File

@@ -2,8 +2,3 @@ PRODUCT_PACKAGES += \
GmsCore \
GsfProxy \
FakeStore \
IchnaeaNlpBackend \
NominatimGeocoderBackend \
FDroid \
FDroidPrivilegedExtension \
additional_repos.xml

3
updater/.gitignore vendored
View File

@@ -1,3 +0,0 @@
/.idea
/*.iml
__pycache__

View File

@@ -1,12 +0,0 @@
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"
[packages]
requests-cache = "==0.9.1"
[dev-packages]
[requires]
python_version = "3.9"

107
updater/Pipfile.lock generated
View File

@@ -1,107 +0,0 @@
{
"_meta": {
"hash": {
"sha256": "43267acd3e0a2938456d3924e25339a1da500cb295a1afee2e8a41843ba8af63"
},
"pipfile-spec": 6,
"requires": {
"python_version": "3.9"
},
"sources": [
{
"name": "pypi",
"url": "https://pypi.org/simple",
"verify_ssl": true
}
]
},
"default": {
"appdirs": {
"hashes": [
"sha256:7d5d0167b2b1ba821647616af46a749d1c653740dd0d2415100fe26e27afdf41",
"sha256:a841dacd6b99318a741b166adb07e19ee71a274450e68237b4650ca1055ab128"
],
"version": "==1.4.4"
},
"attrs": {
"hashes": [
"sha256:2d27e3784d7a565d36ab851fe94887c5eccd6a463168875832a1be79c82828b4",
"sha256:626ba8234211db98e869df76230a137c4c40a12d72445c45d5f5b716f076e2fd"
],
"markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'",
"version": "==21.4.0"
},
"cattrs": {
"hashes": [
"sha256:211800f725cdecedcbcf4c753bbd22d248312b37d130f06045434acb7d9b34e1",
"sha256:35dd9063244263e63bd0bd24ea61e3015b00272cead084b2c40d788b0f857c46"
],
"markers": "python_version >= '3.7' and python_version < '4.0'",
"version": "==1.10.0"
},
"certifi": {
"hashes": [
"sha256:78884e7c1d4b00ce3cea67b44566851c4343c120abd683433ce934a68ea58872",
"sha256:d62a0163eb4c2344ac042ab2bdf75399a71a2d8c7d47eac2e2ee91b9d6339569"
],
"version": "==2021.10.8"
},
"charset-normalizer": {
"hashes": [
"sha256:2842d8f5e82a1f6aa437380934d5e1cd4fcf2003b06fed6940769c164a480a45",
"sha256:98398a9d69ee80548c762ba991a4728bfc3836768ed226b3945908d1a688371c"
],
"markers": "python_version >= '3'",
"version": "==2.0.11"
},
"idna": {
"hashes": [
"sha256:84d9dd047ffa80596e0f246e2eab0b391788b0503584e8945f2368256d2735ff",
"sha256:9d643ff0a55b762d5cdb124b8eaa99c66322e2157b69160bc32796e824360e6d"
],
"markers": "python_version >= '3'",
"version": "==3.3"
},
"requests": {
"hashes": [
"sha256:68d7c56fd5a8999887728ef304a6d12edc7be74f1cfa47714fc8b414525c9a61",
"sha256:f22fa1e554c9ddfd16e6e41ac79759e17be9e492b3587efa038054674760e72d"
],
"markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5'",
"version": "==2.27.1"
},
"requests-cache": {
"hashes": [
"sha256:3e3384c48dca231ee4c49e7ba53162bc0d99e16721baf085bfba1552d065d151",
"sha256:7737f83f0f48481a904bb9a9402233db5090931e46f9644c502646a573848d35"
],
"index": "pypi",
"version": "==0.9.1"
},
"six": {
"hashes": [
"sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926",
"sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254"
],
"markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'",
"version": "==1.16.0"
},
"url-normalize": {
"hashes": [
"sha256:d23d3a070ac52a67b83a1c59a0e68f8608d1cd538783b401bc9de2c0fac999b2",
"sha256:ec3c301f04e5bb676d333a7fa162fa977ad2ca04b7e652bfc9fac4e405728eed"
],
"markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5'",
"version": "==1.4.3"
},
"urllib3": {
"hashes": [
"sha256:000ca7f471a233c2251c6c7023ee85305721bfdf18621ebff4fd17a8653427ed",
"sha256:0e7c33d9a63e7ddfcb86780aac87befc2fbddf46c58dbb487e0855f7ceec283c"
],
"markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4' and python_version < '4.0'",
"version": "==1.26.8"
}
},
"develop": {}
}

View File

@@ -1,11 +0,0 @@
import subprocess
def get_apk_certificate(file: str):
output = subprocess.check_output(['keytool', '-printcert', '-rfc', '-jarfile', file], text=True)
lines = output.split("\n")
return '\n'.join(lines[
lines.index('-----BEGIN CERTIFICATE-----'):
(lines.index('-----END CERTIFICATE-----')+1)
])

View File

@@ -1,17 +0,0 @@
import subprocess
user_name = 'Updater Robot'
user_email = 'robot@nowhere.invalid'
def add_commit_push(directory: str, message: str):
diff = subprocess.run(['git', 'diff', '--cached', '--exit-code'], capture_output=True, text=True)
if diff.returncode != 0:
status = subprocess.run(['git', 'status'], capture_output=True, text=True)
raise Exception('Unknown staged changes found: {}'.format(status.stdout))
subprocess.run(['git', 'add', '--all', directory], check=True)
subprocess.run(['git', '-c', 'user.name={}'.format(user_name), '-c', 'user.email={}'.format(user_email),
'commit', '--message', message])
subprocess.run(['git', 'push'])

View File

@@ -1,47 +0,0 @@
import urllib.request
from os import path
import certificates
import git
from sources import ApkRelease, fdroid_recommended_release
def update_if_needed(module: str, release: ApkRelease):
module_dir = path.abspath(path.join(path.dirname(__file__), '..', module))
with open(path.join(module_dir, '.version_code'), 'r+') as version_code_file:
version_code = int(version_code_file.read())
if version_code < release.version_code:
print('updating {} to {}'.format(module, release.version_name))
apk_filename = path.join(module_dir, '{}.apk'.format(module))
old_sig = certificates.get_apk_certificate(apk_filename)
print('downloading {} ...'.format(release.download_url))
urllib.request.urlretrieve(release.download_url, apk_filename)
new_sig = certificates.get_apk_certificate(apk_filename)
if old_sig != new_sig:
raise Exception('Signature mismatch for {} old sig: {} new sig: {}'.format(module, old_sig, new_sig))
version_code_file.seek(0)
version_code_file.write(str(release.version_code))
version_code_file.truncate()
version_code_file.close()
print('commit and push...')
git.add_commit_push(module_dir, 'Update {} to {}'.format(module, release.version_name))
elif version_code > release.version_code:
print('{} ahead of suggested version ({} > {})'.format(module, version_code, release.version_code))
elif version_code == release.version_code:
print('{} up to date.'.format(module))
fdroid_main_repo = 'https://www.f-droid.org/repo'
fdroid_microg_repo = 'https://microg.org/fdroid/repo'
update_if_needed('FakeStore', fdroid_recommended_release(fdroid_microg_repo, 'com.android.vending'))
update_if_needed('FDroid', fdroid_recommended_release(fdroid_main_repo, 'org.fdroid.fdroid'))
update_if_needed('FDroidPrivilegedExtension', fdroid_recommended_release(fdroid_main_repo, 'org.fdroid.fdroid.privileged'))
update_if_needed('GmsCore', fdroid_recommended_release(fdroid_microg_repo, 'com.google.android.gms'))
update_if_needed('GsfProxy', fdroid_recommended_release(fdroid_microg_repo, 'com.google.android.gsf'))
update_if_needed('NominatimGeocoderBackend', fdroid_recommended_release(fdroid_main_repo, 'org.microg.nlp.backend.nominatim'))

View File

@@ -1,38 +0,0 @@
from xml.dom import minidom, pulldom
import requests_cache
requests_session = requests_cache.CachedSession('updater', backend='memory')
class ApkRelease:
version_name: str
version_code: int
download_url: str
def __init__(self, version_name: str, version_code: int, download_url: str):
self.version_name = version_name
self.version_code = version_code
self.download_url = download_url
def _child_el_content(el: minidom.Element, tag_name: str):
return el.getElementsByTagName(tag_name).item(0).firstChild.data
def fdroid_recommended_release(repo: str, application_id: str):
with requests_session.get('{}/index.xml'.format(repo)) as r:
doc = pulldom.parseString(r.text)
for event, node in doc:
if event == pulldom.START_ELEMENT and node.tagName == 'application':
if node.getAttribute('id') == application_id:
doc.expandNode(node)
marketvercode = _child_el_content(node, 'marketvercode')
for p in node.getElementsByTagName('package'):
if _child_el_content(p, 'versioncode') == marketvercode:
return ApkRelease(
_child_el_content(p, 'version'),
int(marketvercode),
'{}/{}'.format(repo, _child_el_content(p, 'apkname'))
)
raise Exception('Did not find {} in repo {}'.format(application_id, repo))