mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-11-04 22:40:29 +03:00
index.xml cannot handle APKs with the same packageName/versionCode
Really, it is the fdroidclient parser of index.xml that fails, due to the hardcoded expectation that there will only ever be a single APK for any given versionCode. We keep index.xml backwards compatible for old clients, and use index-v1.json to support new things. Having multiple APKs that have the same packageName and versionCode will break the client v0.103.* since that version uses index-v1.json, but still has the hard- coded database parsing stuff. #153
This commit is contained in:
parent
4053f03d77
commit
ceac6d25cb
2 changed files with 18 additions and 7 deletions
|
|
@ -294,9 +294,12 @@ def make_v0(apps, apks, repodir, repodict, requestsdict):
|
||||||
|
|
||||||
# Get a list of the apks for this app...
|
# Get a list of the apks for this app...
|
||||||
apklist = []
|
apklist = []
|
||||||
|
versionCodes = []
|
||||||
for apk in apks:
|
for apk in apks:
|
||||||
if apk['packageName'] == appid:
|
if apk['packageName'] == appid:
|
||||||
apklist.append(apk)
|
if apk['versionCode'] not in versionCodes:
|
||||||
|
apklist.append(apk)
|
||||||
|
versionCodes.append(apk['versionCode'])
|
||||||
|
|
||||||
if len(apklist) == 0:
|
if len(apklist) == 0:
|
||||||
continue
|
continue
|
||||||
|
|
|
||||||
|
|
@ -241,7 +241,7 @@ diff $WORKSPACE/tests/repo/index.xml repo/index.xml
|
||||||
|
|
||||||
|
|
||||||
#------------------------------------------------------------------------------#
|
#------------------------------------------------------------------------------#
|
||||||
echo_header 'rename apks with `fdroid update --rename-apks`'
|
echo_header 'rename apks with `fdroid update --rename-apks`, --nosign for speed'
|
||||||
|
|
||||||
REPOROOT=`create_test_dir`
|
REPOROOT=`create_test_dir`
|
||||||
cd $REPOROOT
|
cd $REPOROOT
|
||||||
|
|
@ -255,17 +255,24 @@ test -d metadata || mkdir metadata
|
||||||
cp $WORKSPACE/tests/metadata/info.guardianproject.urzip.yml metadata/
|
cp $WORKSPACE/tests/metadata/info.guardianproject.urzip.yml metadata/
|
||||||
test -d repo || mkdir repo
|
test -d repo || mkdir repo
|
||||||
cp $WORKSPACE/tests/urzip.apk "repo/asdfiuhk urzip-πÇÇπÇÇ现代汉语通用字-български-عربي1234 ö.apk"
|
cp $WORKSPACE/tests/urzip.apk "repo/asdfiuhk urzip-πÇÇπÇÇ现代汉语通用字-български-عربي1234 ö.apk"
|
||||||
$fdroid update --rename-apks
|
$fdroid update --rename-apks --pretty --nosign
|
||||||
test -e repo/info.guardianproject.urzip_100.apk
|
test -e repo/info.guardianproject.urzip_100.apk
|
||||||
|
grep -F 'info.guardianproject.urzip_100.apk' repo/index-v1.json repo/index.xml
|
||||||
cp $WORKSPACE/tests/urzip-release.apk repo/
|
cp $WORKSPACE/tests/urzip-release.apk repo/
|
||||||
$fdroid update --rename-apks
|
$fdroid update --rename-apks --pretty --nosign
|
||||||
test -e repo/info.guardianproject.urzip_100.apk
|
test -e repo/info.guardianproject.urzip_100.apk
|
||||||
test -e repo/info.guardianproject.urzip_100_b4964fd.apk
|
test -e repo/info.guardianproject.urzip_100_b4964fd.apk
|
||||||
|
grep -F 'info.guardianproject.urzip_100.apk' repo/index-v1.json repo/index.xml
|
||||||
|
grep -F 'info.guardianproject.urzip_100_b4964fd.apk' repo/index-v1.json
|
||||||
|
! grep -F 'info.guardianproject.urzip_100_b4964fd.apk' repo/index.xml
|
||||||
cp $WORKSPACE/tests/urzip-release.apk repo/
|
cp $WORKSPACE/tests/urzip-release.apk repo/
|
||||||
$fdroid update --rename-apks
|
$fdroid update --rename-apks --pretty --nosign
|
||||||
test -e repo/info.guardianproject.urzip_100.apk
|
test -e repo/info.guardianproject.urzip_100.apk
|
||||||
test -e repo/info.guardianproject.urzip_100_b4964fd.apk
|
test -e repo/info.guardianproject.urzip_100_b4964fd.apk
|
||||||
test -e duplicates/repo/info.guardianproject.urzip_100_b4964fd.apk
|
test -e duplicates/repo/info.guardianproject.urzip_100_b4964fd.apk
|
||||||
|
grep -F 'info.guardianproject.urzip_100.apk' repo/index-v1.json repo/index.xml
|
||||||
|
grep -F 'info.guardianproject.urzip_100_b4964fd.apk' repo/index-v1.json
|
||||||
|
! grep -F 'info.guardianproject.urzip_100_b4964fd.apk' repo/index.xml
|
||||||
|
|
||||||
|
|
||||||
#------------------------------------------------------------------------------#
|
#------------------------------------------------------------------------------#
|
||||||
|
|
@ -528,8 +535,9 @@ echo "accepted_formats = ['txt']" >> config.py
|
||||||
cp $WORKSPACE/tests/repo/obb.mainpatch.current_1619.apk $REPOROOT/repo/
|
cp $WORKSPACE/tests/repo/obb.mainpatch.current_1619.apk $REPOROOT/repo/
|
||||||
cp $WORKSPACE/tests/repo/obb.mainpatch.current_1619_another-release-key.apk $REPOROOT/repo/
|
cp $WORKSPACE/tests/repo/obb.mainpatch.current_1619_another-release-key.apk $REPOROOT/repo/
|
||||||
$fdroid update --pretty
|
$fdroid update --pretty
|
||||||
grep -F 'obb.mainpatch.current_1619.apk' repo/index.xml
|
grep -F 'obb.mainpatch.current_1619.apk' repo/index.xml repo/index-v1.json
|
||||||
grep -F 'obb.mainpatch.current_1619_another-release-key.apk' repo/index.xml
|
grep -F 'obb.mainpatch.current_1619_another-release-key.apk' repo/index-v1.json
|
||||||
|
! grep -F 'obb.mainpatch.current_1619_another-release-key.apk' repo/index.xml
|
||||||
# die if there are exact duplicates
|
# die if there are exact duplicates
|
||||||
cp $WORKSPACE/tests/repo/obb.mainpatch.current_1619.apk $REPOROOT/repo/duplicate.apk
|
cp $WORKSPACE/tests/repo/obb.mainpatch.current_1619.apk $REPOROOT/repo/duplicate.apk
|
||||||
! $fdroid update
|
! $fdroid update
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue