mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-11-04 14:30:30 +03:00
Drop stats/known_apks.txt
Use repo/index-v2.json instead. Also fix deprecated datetime.utcnow().
This commit is contained in:
parent
83a3227235
commit
81c0c9d4aa
14 changed files with 33 additions and 120 deletions
|
|
@ -1898,7 +1898,6 @@ class CommonTest(unittest.TestCase):
|
|||
self.assertFalse(os.path.exists('config.yml'))
|
||||
self.assertFalse(os.path.exists('config.py'))
|
||||
config = fdroidserver.common.read_config()
|
||||
self.assertFalse(config.get('update_stats'))
|
||||
self.assertIsNotNone(config.get('char_limits'))
|
||||
|
||||
def test_with_zero_size_config(self):
|
||||
|
|
@ -1908,7 +1907,6 @@ class CommonTest(unittest.TestCase):
|
|||
self.assertTrue(os.path.exists('config.yml'))
|
||||
self.assertFalse(os.path.exists('config.py'))
|
||||
config = fdroidserver.common.read_config()
|
||||
self.assertFalse(config.get('update_stats'))
|
||||
self.assertIsNotNone(config.get('char_limits'))
|
||||
|
||||
def test_with_config_yml(self):
|
||||
|
|
|
|||
|
|
@ -25,8 +25,6 @@ mirrors = (
|
|||
'https://foo.bar/fdroid',
|
||||
)
|
||||
|
||||
update_stats = True
|
||||
|
||||
install_list = 'org.adaway'
|
||||
uninstall_list = ('com.android.vending', 'com.facebook.orca', )
|
||||
|
||||
|
|
|
|||
|
|
@ -274,7 +274,6 @@ class NightlyTest(unittest.TestCase):
|
|||
'repo_name': 'f-droid/test-nightly',
|
||||
'repo_url': mirror_url + '/repo',
|
||||
'servergitmirrors': [{"url": git_url}],
|
||||
'update_stats': True,
|
||||
}
|
||||
with open('config.yml') as fp:
|
||||
config = yaml.safe_load(fp)
|
||||
|
|
@ -347,7 +346,6 @@ class NightlyTest(unittest.TestCase):
|
|||
'repo_name': 'fdroid/test-nightly',
|
||||
'repo_url': 'https://gitlab.com/fdroid/test-nightly/-/raw/master/fdroid/repo',
|
||||
'servergitmirrors': [{"url": 'git@gitlab.com:fdroid/test-nightly'}],
|
||||
'update_stats': True,
|
||||
}
|
||||
with open('config.yml') as fp:
|
||||
config = yaml.safe_load(fp)
|
||||
|
|
|
|||
|
|
@ -273,7 +273,6 @@ cp -a \
|
|||
$WORKSPACE/tests/config \
|
||||
$WORKSPACE/tests/metadata \
|
||||
$WORKSPACE/tests/repo \
|
||||
$WORKSPACE/tests/stats \
|
||||
$REPOROOT/
|
||||
cp -a $WORKSPACE/tests/gnupghome $GNUPGHOME
|
||||
chmod 0700 $GNUPGHOME
|
||||
|
|
@ -645,14 +644,13 @@ printf '\narchive_older: 3\n' >> config.yml
|
|||
mkdir -p {repo,archive,metadata,stats}
|
||||
cp $WORKSPACE/tests/repo/com.politedroid_5.apk archive
|
||||
cp $WORKSPACE/tests/repo/com.politedroid_6.apk repo
|
||||
cp $WORKSPACE/tests/repo/index-v2.json repo
|
||||
cp $WORKSPACE/tests/metadata/com.politedroid.yml metadata
|
||||
#TODO: the timestamp of the oldest apk in the file should be used, even if that
|
||||
# doesn't exist anymore
|
||||
echo "com.politedroid_4.apk com.politedroid 2016-01-01" > stats/known_apks.txt
|
||||
echo "com.politedroid_5.apk com.politedroid 2017-01-01" >> stats/known_apks.txt
|
||||
echo "com.politedroid_6.apk com.politedroid 2018-01-01" >> stats/known_apks.txt
|
||||
$sed -i -e 's/ArchivePolicy:.*/ArchivePolicy: 1 versions/' metadata/com.politedroid.yml
|
||||
timestamp=1483228800 # $(date -u --date=2017-01-01 +%s)000
|
||||
timestamp=1498176000000 # $(date -u --date=2017-01-01 +%s)000
|
||||
pwd
|
||||
|
||||
$fdroid update --pretty --nosign
|
||||
grep -F "\"added\": $timestamp" repo/index-v1.json
|
||||
|
|
@ -1078,7 +1076,7 @@ GIT_REMOTE=`create_test_dir`
|
|||
GNUPGHOME=$REPOROOT/gnupghome
|
||||
cd $REPOROOT
|
||||
fdroid_init_with_prebuilt_keystore
|
||||
cp -a $WORKSPACE/tests/metadata $WORKSPACE/tests/repo $WORKSPACE/tests/stats $REPOROOT/
|
||||
cp -a $WORKSPACE/tests/metadata $WORKSPACE/tests/repo $REPOROOT/
|
||||
echo "binary_transparency_remote: $GIT_REMOTE" >> config.yml
|
||||
$fdroid update --verbose
|
||||
$fdroid deploy --verbose
|
||||
|
|
@ -1224,7 +1222,7 @@ $git config receive.denyCurrentBranch updateInstead
|
|||
cd $OFFLINE_ROOT
|
||||
fdroid_init_with_prebuilt_keystore
|
||||
printf '\narchive_older: 3\n' >> config.yml
|
||||
cp -a $WORKSPACE/tests/metadata $WORKSPACE/tests/repo $WORKSPACE/tests/stats $OFFLINE_ROOT/
|
||||
cp -a $WORKSPACE/tests/metadata $WORKSPACE/tests/repo $OFFLINE_ROOT/
|
||||
mkdir $OFFLINE_ROOT/unsigned
|
||||
cp $WORKSPACE/tests/urzip-release-unsigned.apk $OFFLINE_ROOT/unsigned
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ import unittest
|
|||
import uuid
|
||||
import zipfile
|
||||
from dataclasses import asdict
|
||||
from datetime import datetime, timedelta
|
||||
from datetime import datetime, timedelta, timezone
|
||||
from unittest import mock
|
||||
|
||||
if sys.version_info >= (3, 11):
|
||||
|
|
@ -592,7 +592,7 @@ class Test_SignatureDataController(unittest.TestCase):
|
|||
sdc = fdroidserver.scanner.SignatureDataController(
|
||||
'nnn', 'fff.yml', 'https://example.com/test.json'
|
||||
)
|
||||
sdc.data['last_updated'] = datetime.utcnow().timestamp()
|
||||
sdc.data['last_updated'] = datetime.now(timezone.utc).timestamp()
|
||||
sdc.check_last_updated()
|
||||
|
||||
def test_check_last_updated_exception_cache_outdated(self):
|
||||
|
|
@ -600,7 +600,9 @@ class Test_SignatureDataController(unittest.TestCase):
|
|||
'nnn', 'fff.yml', 'https://example.com/test.json'
|
||||
)
|
||||
sdc.cache_duration = timedelta(days=7)
|
||||
sdc.data['last_updated'] = (datetime.utcnow() - timedelta(days=30)).timestamp()
|
||||
sdc.data['last_updated'] = (
|
||||
datetime.now(timezone.utc) - timedelta(days=30)
|
||||
).timestamp()
|
||||
with self.assertRaises(fdroidserver.scanner.SignatureDataOutdatedException):
|
||||
sdc.check_last_updated()
|
||||
|
||||
|
|
|
|||
|
|
@ -1,18 +0,0 @@
|
|||
com.example.test.helloworld_1.apk com.example.test.helloworld 2023-02-17
|
||||
com.politedroid_3.apk com.politedroid 2017-06-23
|
||||
com.politedroid_4.apk com.politedroid 2017-06-23
|
||||
com.politedroid_5.apk com.politedroid 2017-06-23
|
||||
com.politedroid_6.apk com.politedroid 2017-06-23
|
||||
duplicate.permisssions_9999999.apk duplicate.permisssions 2017-12-22
|
||||
fake.ota.update_1234.zip fake.ota.update 2016-03-10
|
||||
info.zwanenburg.caffeinetile_4.apk info.zwanenburg.caffeinetile 2018-10-10
|
||||
no.min.target.sdk_987.apk no.min.target.sdk 2018-10-10
|
||||
obb.main.oldversion_1444412523.apk obb.main.oldversion 2013-12-31
|
||||
obb.main.twoversions_1101613.apk obb.main.twoversions 2015-10-12
|
||||
obb.main.twoversions_1101615.apk obb.main.twoversions 2016-01-01
|
||||
obb.main.twoversions_1101617.apk obb.main.twoversions 2016-06-20
|
||||
obb.mainpatch.current_1619.apk obb.mainpatch.current 2016-04-23
|
||||
obb.mainpatch.current_1619_another-release-key.apk obb.mainpatch.current 2017-06-01
|
||||
souch.smsbypass_9.apk souch.smsbypass 2018-04-26
|
||||
urzip-; Рахма́, [rɐxˈmanʲɪnəf] سيرجي_رخمانينوف 谢·.apk info.guardianproject.urzip 2016-06-23
|
||||
v1.v2.sig_1020.apk v1.v2.sig 2023-02-17
|
||||
|
|
@ -697,14 +697,10 @@ class UpdateTest(unittest.TestCase):
|
|||
|
||||
os.chdir(self.testdir)
|
||||
os.mkdir('repo')
|
||||
os.mkdir('stats')
|
||||
with open(os.path.join('stats', 'known_apks.txt'), 'w') as fp:
|
||||
fp.write('se.manyver_30.apk se.manyver 2018-10-10\n')
|
||||
filename = 'Norway_bouvet_europe_2.obf.zip'
|
||||
shutil.copy(os.path.join(self.basedir, filename), 'repo')
|
||||
knownapks = fdroidserver.common.KnownApks()
|
||||
files, fcachechanged = fdroidserver.update.scan_repo_files(dict(), 'repo', knownapks, False)
|
||||
knownapks.writeifchanged()
|
||||
self.assertTrue(fcachechanged)
|
||||
|
||||
info = files[0]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue