diff --git a/CHANGELOG.md b/CHANGELOG.md index b76fe549..7d6497e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -69,6 +69,7 @@ milestone](https://gitlab.com/fdroid/fdroidserver/-/milestones/10) ([!692](https://gitlab.com/fdroid/fdroidserver/-/merge_requests/692)) * Major refactoring on core parts of code to be more Pythonic ([!756](https://gitlab.com/fdroid/fdroidserver/-/merge_requests/756)) +* `fdroid init` now works when installed with pip ### Removed * Removed all support for _.txt_ and _.json_ metadata diff --git a/examples/config.yml b/examples/config.yml index 7b009fde..ac1e44a0 100644 --- a/examples/config.yml +++ b/examples/config.yml @@ -52,23 +52,27 @@ # The same policy is applied to the archive repo, if there is one. # repo_maxage: 0 -repo_url: https://MyFirstFDroidRepo.org/fdroid/repo -repo_name: My First F-Droid Repo Demo -repo_description: >- - This is a repository of apps to be used with F-Droid. Applications in this - repository are either official binaries built by the original application - developers, or are binaries built from source by the admin of f-droid.org - using the tools on https://gitlab.com/u/fdroid. +# repo_url: https://MyFirstFDroidRepo.org/fdroid/repo +# repo_name: My First F-Droid Repo Demo +# repo_description: >- +# This is a repository of apps to be used with F-Droid. Applications +# in this repository are either official binaries built by the +# original application developers, or are binaries built from source +# by the admin of f-droid.org using the tools on +# https://gitlab.com/fdroid. # As above, but for the archive repo. +# +# archive_url: https://f-droid.org/archive +# archive_name: My First F-Droid Archive Demo +# archive_description: >- +# The repository of older versions of packages from the main demo repository. + # archive_older sets the number of versions kept in the main repo, with all # older ones going to the archive. Set it to 0, and there will be no archive # repository, and no need to define the other archive_ values. -archive_older: 3 -archive_url: https://f-droid.org/archive -archive_name: My First F-Droid Archive Demo -archive_description: >- - The repository of older versions of packages from the main demo repository. +# +# archive_older: 3 # The repo's icon defaults to a file called 'icon.png' in the 'icons' # folder for each section, e.g. repo/icons/icon.png and diff --git a/fdroidserver/common.py b/fdroidserver/common.py index 4218ef48..3fe24c23 100644 --- a/fdroidserver/common.py +++ b/fdroidserver/common.py @@ -146,14 +146,10 @@ default_config = { }, 'keyaliases': {}, 'repo_url': "https://MyFirstFDroidRepo.org/fdroid/repo", - 'repo_name': "My First FDroid Repo Demo", + 'repo_name': "My First F-Droid Repo Demo", 'repo_icon': "icon.png", - 'repo_description': _(''' - This is a repository of apps to be used with FDroid. Applications in this - repository are either official binaries built by the original application - developers, or are binaries built from source by f-droid.org using the - tools on https://gitlab.com/fdroid. - '''), + 'repo_description': _("""This is a repository of apps to be used with F-Droid. Applications in this repository are either official binaries built by the original application developers, or are binaries built from source by the admin of f-droid.org using the tools on https://gitlab.com/fdroid."""), + 'archive_name': 'My First F-Droid Archive Demo', 'archive_description': _('These are the apps that have been archived from the main repo.'), 'archive_older': 0, 'lint_licenses': fdroidserver.lint.APPROVED_LICENSES, diff --git a/fdroidserver/index.py b/fdroidserver/index.py index 6eae6ffe..d6d396a5 100644 --- a/fdroidserver/index.py +++ b/fdroidserver/index.py @@ -76,9 +76,10 @@ def make(apps, apks, repodir, archive): if archive: repodict['name'] = common.config['archive_name'] repodict['icon'] = common.config.get('archive_icon', common.default_config['repo_icon']) - repodict['address'] = common.config['archive_url'] repodict['description'] = common.config['archive_description'] - urlbasepath = os.path.basename(urllib.parse.urlparse(common.config['archive_url']).path) + archive_url = common.config.get('archive_url', common.config['repo_url'][:-4] + 'archive') + repodict['address'] = archive_url + urlbasepath = os.path.basename(urllib.parse.urlparse(archive_url).path) else: repodict['name'] = common.config['repo_name'] repodict['icon'] = common.config.get('repo_icon', common.default_config['repo_icon']) diff --git a/tests/repo/index-v1.json b/tests/repo/index-v1.json index 923384eb..6ca6d559 100644 --- a/tests/repo/index-v1.json +++ b/tests/repo/index-v1.json @@ -5,7 +5,7 @@ "name": "My First F-Droid Repo Demo", "icon": "icon.png", "address": "https://MyFirstFDroidRepo.org/fdroid/repo", - "description": "This is a repository of apps to be used with F-Droid. Applications in this repository are either official binaries built by the original application developers, or are binaries built from source by the admin of f-droid.org using the tools on https://gitlab.com/u/fdroid.", + "description": "This is a repository of apps to be used with F-Droid. Applications in this repository are either official binaries built by the original application developers, or are binaries built from source by the admin of f-droid.org using the tools on https://gitlab.com/fdroid.", "mirrors": [ "http://foobarfoobarfoobar.onion/fdroid/repo", "https://foo.bar/fdroid/repo" diff --git a/tests/repo/index.xml b/tests/repo/index.xml index 557be383..69b09bcf 100644 --- a/tests/repo/index.xml +++ b/tests/repo/index.xml @@ -1,7 +1,7 @@ - This is a repository of apps to be used with F-Droid. Applications in this repository are either official binaries built by the original application developers, or are binaries built from source by the admin of f-droid.org using the tools on https://gitlab.com/u/fdroid. + This is a repository of apps to be used with F-Droid. Applications in this repository are either official binaries built by the original application developers, or are binaries built from source by the admin of f-droid.org using the tools on https://gitlab.com/fdroid. http://foobarfoobarfoobar.onion/fdroid/repo https://foo.bar/fdroid/repo diff --git a/tests/run-tests b/tests/run-tests index 3e475814..693c89e6 100755 --- a/tests/run-tests +++ b/tests/run-tests @@ -309,7 +309,7 @@ cp $WORKSPACE/tests/urzip.apk \ $WORKSPACE/tests/repo/com.politedroid_[0-9].apk \ $WORKSPACE/tests/repo/obb.main.twoversions_110161[357].apk \ repo/ -$sed -i.tmp 's,archive_older: [0-9],archive_older: 3,' config.yml +printf '\narchive_older: 3\n' >> config.yml $fdroid update --pretty --nosign if which apksigner; then @@ -332,7 +332,7 @@ if ! which apksigner; then cp $WORKSPACE/tests/metadata/com.politedroid.yml metadata/ test -d repo || mkdir repo cp $WORKSPACE/tests/repo/com.politedroid_[0-9].apk repo/ - $sed -i.tmp 's,archive_older: [0-9],archive_older: 3,' config.yml + printf '\narchive_older: 3\n' >> config.yml $fdroid update --pretty --nosign test `grep '' archive/index.xml | wc -l` -eq 0 @@ -418,7 +418,7 @@ cp $WORKSPACE/tests/metadata/com.politedroid.yml metadata/ $sed -i.tmp '/ArchivePolicy:/d' metadata/com.politedroid.yml test -d repo || mkdir repo cp $WORKSPACE/tests/repo/com.politedroid_[0-9].apk repo/ -$sed -i.tmp 's,archive_older: [0-9],archive_older: 3,' config.yml +printf '\narchive_older: 3\n' >> config.yml $fdroid update --pretty --nosign test `grep '' archive/index.xml | wc -l` -eq 1 @@ -494,7 +494,7 @@ REPOROOT=`create_test_dir` cd $REPOROOT fdroid_init_with_prebuilt_keystore echo 'allow_disabled_algorithms: true' >> config.yml -$sed -i.tmp 's,archive_older: [0-9],archive_older: 3,' config.yml +printf '\narchive_older: 3\n' >> config.yml test -d metadata || mkdir metadata cp $WORKSPACE/tests/metadata/com.politedroid.yml metadata/ echo 'Summary: good test version of urzip' > metadata/info.guardianproject.urzip.yml @@ -615,6 +615,7 @@ echo_header "test for added date being set correctly for repo and archive" REPOROOT=`create_test_dir` cd $REPOROOT fdroid_init_with_prebuilt_keystore +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 @@ -1125,6 +1126,7 @@ REPOROOT=`create_test_dir` GIT_MIRROR=$REPOROOT/git-mirror cd $REPOROOT fdroid_init_with_prebuilt_keystore +printf '\narchive_older: 3\n' >> config.yml echo "servergitmirrors: $SERVER_GIT_MIRROR" >> config.yml cp $WORKSPACE/tests/repo/com.politedroid_[345].apk repo/ @@ -1193,6 +1195,7 @@ if have_git_2_3; then 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/ echo "mirrors: ['http://foo.bar/fdroid', 'http://asdflkdsfjafdsdfhkjh.onion/fdroid']" >> config.yml @@ -1282,6 +1285,7 @@ if which wget; then # clean up kill -9 $http_server_pid rm -f 127.0.0.1\:${port}/repo/*.apk 127.0.0.1\:${port}/repo/*/*/*/*.png + sleep 1 # wait for webserver thread to quit else echo "WARNING: wget not installed, skipping" fi