From 674786db96203102b9b76cf8a15bdbf414c5f848 Mon Sep 17 00:00:00 2001 From: Jochen Sprickerhof Date: Fri, 25 Jun 2021 09:08:54 +0200 Subject: [PATCH] [checkupdates] Ignore broken submodule In case the app repository has a broken submodule, checkupdates failed and did not search for any version updates. Ignoring the error let's us at least find new version in the main repo (which is probably the right place anyhow) and thus an improvement. --- fdroidserver/checkupdates.py | 2 ++ tests/run-tests | 44 ++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/fdroidserver/checkupdates.py b/fdroidserver/checkupdates.py index 975a223b..483c46ef 100644 --- a/fdroidserver/checkupdates.py +++ b/fdroidserver/checkupdates.py @@ -373,6 +373,8 @@ def try_init_submodules(app, last_build, vcs): vcs.initsubmodules() except NoSubmodulesException: logging.info("No submodules present for {}".format(_getappname(app))) + except VCSException: + logging.info("submodule broken for {}".format(_getappname(app))) # Return all directories under startdir that contain any of the manifest diff --git a/tests/run-tests b/tests/run-tests index 42374742..a6178a23 100755 --- a/tests/run-tests +++ b/tests/run-tests @@ -1332,6 +1332,50 @@ if have_git_2_3; then grep "CurrentVersionCode: 2" metadata/fake.yml fi +#------------------------------------------------------------------------------# +echo_header "checkupdates ignore broken submodule" + +if have_git_2_3; then + ROOT=$(create_test_dir) + cd "$ROOT" + mkdir foo bar + cd foo + git init + echo a > a + git add a + GIT_COMMITTER_NAME="Test" GIT_COMMITTER_EMAIL="no@mail" git commit -m a --author "Author " + + cd ../bar + git init + git submodule add "file://$(pwd)/../foo" baz + GIT_COMMITTER_NAME="Test" GIT_COMMITTER_EMAIL="no@mail" git commit -am a --author "Author " + git tag 2 + + cd ../foo + # delete the commit referenced in bar + GIT_COMMITTER_NAME="Test" GIT_COMMITTER_EMAIL="no@mail" git commit --amend -m aa --author "Author " + git reflog expire --expire=now --all + git gc --aggressive --prune=now + + cd .. + mkdir repo + mkdir metadata + echo "RepoType: git" >> metadata/fake.yml + echo "Repo: file://$(pwd)/bar" >> metadata/fake.yml + echo "Builds:" >> metadata/fake.yml + echo " - versionName: 1" >> metadata/fake.yml + echo " versionCode: 1" >> metadata/fake.yml + echo " submodules: true" >> metadata/fake.yml + echo "AutoUpdateMode: Version" >> metadata/fake.yml + echo "UpdateCheckMode: Tags" >> metadata/fake.yml + echo "UpdateCheckData: '|||'" >> metadata/fake.yml + echo "CurrentVersion: 1" >> metadata/fake.yml + echo "CurrentVersionCode: 1" >> metadata/fake.yml + + $fdroid checkupdates --allow-dirty + grep "CurrentVersionCode: 2" metadata/fake.yml +fi + #------------------------------------------------------------------------------#