Skip to content

android build: cache p4a recipe downloads even for FRESH_CLONE builds#10744

Open
SomberNight wants to merge 1 commit into
spesmilo:masterfrom
SomberNight:202607_android_build_cache_p4a_pkgs
Open

android build: cache p4a recipe downloads even for FRESH_CLONE builds#10744
SomberNight wants to merge 1 commit into
spesmilo:masterfrom
SomberNight:202607_android_build_cache_p4a_pkgs

Conversation

@SomberNight

Copy link
Copy Markdown
Member

I propose we cache some downloads even for "fresh clone" builds (that have ELECBUILD_COMMIT env var set), with an opt-out reusing the existing ELECBUILD_NOCACHE env var. Currently ELECBUILD_NOCACHE only opts-out from the docker build cache, now I would reuse it for p4a recipe downloads.

qt-everywhere-src-6.10.2.tar.xz is 1.3 GiB, and we download it twice per arch. (once for the qt6 recipe, once for the hostqt6 recipe) It seems to me, download.qt.io is heavily rate-limiting downloads from some IPs.

When doing a release, we build 3 archs, so we download Qt six times. With this patch, we would only download it twice.
(note: I see no need to have separate caches per arch atm.)

Also, when doing multiple builds to debug reproducibility, with this patch, only the first attempt needs to download Qt (twice). Subsequent attempts hit the cache.


note: the git tag is part of the cache key out of cache-staleness paranoia. It is not the full commit though, as that would kill the reproducibility-debugging use case.

I propose we cache some downloads even for "fresh clone" builds (that have `ELECBUILD_COMMIT` env var set), with an opt-out reusing the existing `ELECBUILD_NOCACHE` env var. Currently `ELECBUILD_NOCACHE` only opts-out from the docker build cache, now I would reuse it for p4a recipe downloads.

`qt-everywhere-src-6.10.2.tar.xz` [0] is 1.3 GiB, and we download it twice per arch.
(once for the qt6 recipe, once for the hostqt6 recipe)
It seems to me, download.qt.io is heavily rate-limiting downloads from some IPs.

When doing a release, we build 3 archs, so we download Qt six times.
With this patch, we would only download it twice.
(note: I see no need to have separate caches per arch atm.)

Also, when doing multiple builds to debug reproducibility, with this patch, only the first attempt needs to download Qt (twice). Subsequent attempts hit the cache.

---

note: the git tag is part of the cache key out of cache-staleness paranoia. It is not the full commit though, as that would kill the reproducibility-debugging use case.

[0]: https://github.com/spesmilo/python-for-android/blob/8c0fcc9ef2e559918ca96ecde6e09fe521bb1427/pythonforandroid/recipes/qt6/__init__.py#L11
Comment thread contrib/android/build.sh
DOCKER_RUN_FLAGS="$DOCKER_RUN_FLAGS -v $FRESH_CLONE_BASE/downloads_cache/$GIT_TAG/p4a_packages:/home/user/wspace/electrum/.buildozer/android/platform/build-armeabi-v7a/packages"
DOCKER_RUN_FLAGS="$DOCKER_RUN_FLAGS -v $FRESH_CLONE_BASE/downloads_cache/$GIT_TAG/p4a_packages:/home/user/wspace/electrum/.buildozer/android/platform/build-arm64-v8a/packages"
DOCKER_RUN_FLAGS="$DOCKER_RUN_FLAGS -v $FRESH_CLONE_BASE/downloads_cache/$GIT_TAG/p4a_packages:/home/user/wspace/electrum/.buildozer/android/platform/build-x86/packages"
DOCKER_RUN_FLAGS="$DOCKER_RUN_FLAGS -v $FRESH_CLONE_BASE/downloads_cache/$GIT_TAG/p4a_packages:/home/user/wspace/electrum/.buildozer/android/platform/build-x86_64/packages"

@SomberNight SomberNight Jul 8, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: .buildozer/android/platform/build-$ARCH/packages is the folder p4a internally uses for caching downloads. This PR would just persist the cache through build attempts.

note2: p4a already puts a marker next to each download to detect staleness, with the version in the name. Though I remark it does not work for git clones (see plyer):

dir structure of packages folder
$ tree -L2 -a /var/tmp/electrum_build/android/downloads_cache/4.8.0/p4a_packages/
/var/tmp/electrum_build/android/downloads_cache/4.8.0/p4a_packages/
├── cffi
│   ├── .mark-v2.0.0.tar.gz
│   └── v2.0.0.tar.gz
├── hostpython3
│   ├── .mark-Python-3.11.15.tgz
│   └── Python-3.11.15.tgz
├── hostqt6
│   ├── .mark-qt-everywhere-src-6.10.2.tar.xz
│   └── qt-everywhere-src-6.10.2.tar.xz
├── libffi
│   ├── .mark-v3.4.8.tar.gz
│   └── v3.4.8.tar.gz
├── libiconv
│   ├── .mark-libiconv-1.18.tar.gz
│   └── libiconv-1.18.tar.gz
├── libsecp256k1
│   ├── .mark-1a53f4961f337b4d166c25fce72ef0dc88806618.zip
│   └── 1a53f4961f337b4d166c25fce72ef0dc88806618.zip
├── libzbar
│   ├── .mark-bb05ec54eec57f8397cb13fb9161372a281a1219.zip
│   └── bb05ec54eec57f8397cb13fb9161372a281a1219.zip
├── openssl
│   ├── .mark-openssl-3.0.21.tar.gz
│   └── openssl-3.0.21.tar.gz
├── packaging
│   ├── .mark-packaging-26.0.tar.gz
│   └── packaging-26.0.tar.gz
├── plyer
│   ├── .mark-plyer
│   └── plyer
├── pycparser
│   ├── .mark-pycparser-2.22.tar.gz
│   └── pycparser-2.22.tar.gz
├── pycryptodomex
│   ├── .mark-v3.23.0x.tar.gz
│   └── v3.23.0x.tar.gz
├── pyjnius
│   ├── .mark-1.7.0.zip
│   └── 1.7.0.zip
├── pyparsing
│   ├── .mark-pyparsing-3.0.7.tar.gz
│   └── pyparsing-3.0.7.tar.gz
├── pyqt6
│   ├── .mark-pyqt6-6.10.2.tar.gz
│   └── pyqt6-6.10.2.tar.gz
├── pyqt6sip
│   ├── .mark-pyqt6_sip-13.10.3.tar.gz
│   └── pyqt6_sip-13.10.3.tar.gz
├── pyqt_builder
│   ├── .mark-pyqt_builder-1.19.1.tar.gz
│   └── pyqt_builder-1.19.1.tar.gz
├── python3
│   ├── .mark-Python-3.11.15.tgz
│   └── Python-3.11.15.tgz
├── qt6
│   ├── .mark-qt-everywhere-src-6.10.2.tar.xz
│   └── qt-everywhere-src-6.10.2.tar.xz
├── sip
│   ├── .mark-sip-6.15.1.tar.gz
│   └── sip-6.15.1.tar.gz
├── six
│   ├── .mark-six-1.17.0.tar.gz
│   └── six-1.17.0.tar.gz
└── sqlite3
    ├── .mark-sqlite-amalgamation-3500000.zip
    └── sqlite-amalgamation-3500000.zip

24 directories, 43 files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant