From bd6afa436513dd8b564eb1d70b9d0ebd15877704 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20P=C3=B6hn?= Date: Wed, 24 Apr 2024 12:45:29 +0200 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=90=9B=20index=20fix:=20skip=20altsto?= =?UTF-8?q?re=20when=20no=20IPAs=20present?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fdroidserver/index.py | 4 ++++ tests/index.TestCase | 2 ++ 2 files changed, 6 insertions(+) diff --git a/fdroidserver/index.py b/fdroidserver/index.py index 5a179487..ec99c8ae 100644 --- a/fdroidserver/index.py +++ b/fdroidserver/index.py @@ -1766,6 +1766,10 @@ def make_altstore(apps, apks, config, repodir, pretty=False): https://faq.altstore.io/distribute-your-apps/make-a-source https://faq.altstore.io/distribute-your-apps/updating-apps """ + if not any(Path('repo').glob('*.ipa')): + # no IPA files present in repo, nothing to do here, exiting early + return + indent = 2 if pretty else None # for now alt-store support is english only for lang in ['en']: diff --git a/tests/index.TestCase b/tests/index.TestCase index 6e8ec89b..2f137608 100755 --- a/tests/index.TestCase +++ b/tests/index.TestCase @@ -869,6 +869,8 @@ class AltstoreIndexTest(unittest.TestCase): with tempfile.TemporaryDirectory() as tmpdir, TmpCwd(tmpdir): repodir = Path(tmpdir) / 'repo' repodir.mkdir() + with open(repodir / "fake.ipa", "w") as f: + f.write("") fdroidserver.index.make_altstore( apps, From 005a33732c599a466e1955d0316b230a9b863eef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20P=C3=B6hn?= Date: Wed, 24 Apr 2024 11:56:07 +0000 Subject: [PATCH 2/2] apply review suggestions --- fdroidserver/index.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fdroidserver/index.py b/fdroidserver/index.py index ec99c8ae..fc1b663c 100644 --- a/fdroidserver/index.py +++ b/fdroidserver/index.py @@ -1766,7 +1766,7 @@ def make_altstore(apps, apks, config, repodir, pretty=False): https://faq.altstore.io/distribute-your-apps/make-a-source https://faq.altstore.io/distribute-your-apps/updating-apps """ - if not any(Path('repo').glob('*.ipa')): + if not any(Path(repodir).glob('*.ipa')): # no IPA files present in repo, nothing to do here, exiting early return