[checkupdates] update submodules according to tag

In case the version information is inside a submodule we need to
checkout the submodule at the version of the tag we test.

Found with org.courville.nova.

Closes: #622
This commit is contained in:
Jochen Sprickerhof 2022-03-10 09:51:36 +01:00
parent f368bd4106
commit 0c390c943d
2 changed files with 49 additions and 0 deletions

View File

@ -141,6 +141,7 @@ def check_tags(app, pattern):
for tag in tags:
logging.debug("Check tag: '{0}'".format(tag))
vcs.gotorevision(tag)
try_init_submodules(app, last_build, vcs)
if app.UpdateCheckData:
filecode, codeex, filever, verex = app.UpdateCheckData.split('|')

View File

@ -1367,6 +1367,54 @@ $fdroid checkupdates --allow-dirty
grep "CurrentVersionCode: 2" metadata/fake.yml
#------------------------------------------------------------------------------#
echo_header "checkupdates check version in submodule"
ROOT=$(create_test_dir)
cd "$ROOT"
mkdir app sub
cd sub
$git init
echo 1 > ver
$git add ver
$git commit -m 1
cd ../app
$git init
$git submodule add "file://$(pwd)/../sub"
$git commit -am 1
$git tag 1
cd ../sub
echo 2 > ver
$git commit -am 2
cd ../app
$git init
$git submodule update --remote
$git commit -am 2
cd ..
mkdir repo
mkdir metadata
cat > metadata/fake.yml <<EOF
RepoType: git
Repo: file://$(pwd)/app
Builds:
- versionName: 0
versionCode: 0
submodules: true
AutoUpdateMode: Version
UpdateCheckMode: Tags
UpdateCheckData: 'sub/ver|(\d)||'
CurrentVersion: 0
CurrentVersionCode: 0
EOF
$fdroid checkupdates --allow-dirty --auto -v
grep "CurrentVersionCode: 1" metadata/fake.yml
#------------------------------------------------------------------------------#
# remove this to prevent git conflicts and complaining