mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-10-02 09:10:11 +02:00
Merge branch 'random-fixes-on-my-machine' into 'master'
Random fixes on my machine See merge request fdroid/fdroidserver!979
This commit is contained in:
commit
7872a3c8aa
@ -340,7 +340,8 @@ fdroid build:
|
||||
- fdroid build --verbose --latest org.fdroid.fdroid.privileged
|
||||
# each `fdroid build --on-server` run expects sudo, then uninstalls it
|
||||
- apt-get install sudo
|
||||
- fdroid build --verbose --on-server --no-tarball --latest org.fdroid.fdroid
|
||||
- currentVersionCode=`python3 -c "import yaml; print(yaml.load(open('metadata/org.fdroid.fdroid.yml'))['CurrentVersionCode'])"`
|
||||
- fdroid build --verbose --on-server --no-tarball org.fdroid.fdroid:$currentVersionCode
|
||||
|
||||
|
||||
# test the plugin API and specifically the fetchsrclibs plugin, which
|
||||
|
@ -282,6 +282,8 @@ __complete_signatures() {
|
||||
__complete_options
|
||||
return 0;;
|
||||
esac
|
||||
_filedir 'apk'
|
||||
return 0
|
||||
}
|
||||
|
||||
__complete_signindex() {
|
||||
|
@ -362,6 +362,8 @@ def read_config(opts=None):
|
||||
logging.debug(_("Reading '{config_file}'").format(config_file=config_file))
|
||||
with open(config_file, encoding='utf-8') as fp:
|
||||
config = yaml.safe_load(fp)
|
||||
if not config:
|
||||
config = {}
|
||||
elif os.path.exists(old_config_file):
|
||||
logging.warning(_("""{oldfile} is deprecated, use {newfile}""")
|
||||
.format(oldfile=old_config_file, newfile=config_file))
|
||||
|
@ -1072,7 +1072,12 @@ def download_repo_index(url_str, etag=None, verify_fingerprint=True, timeout=600
|
||||
raise VerificationException(_("No fingerprint in URL."))
|
||||
fingerprint = query['fingerprint'][0]
|
||||
|
||||
url = urllib.parse.SplitResult(url.scheme, url.netloc, url.path + '/index-v1.jar', '', '')
|
||||
if url.path.endswith('/index-v1.jar'):
|
||||
path = url.path[:-13].rstrip('/')
|
||||
else:
|
||||
path = url.path.rstrip('/')
|
||||
|
||||
url = urllib.parse.SplitResult(url.scheme, url.netloc, path + '/index-v1.jar', '', '')
|
||||
download, new_etag = net.http_get(url.geturl(), etag, timeout)
|
||||
|
||||
if download is None:
|
||||
|
@ -1675,6 +1675,17 @@ class CommonTest(unittest.TestCase):
|
||||
self.assertIsNone(config.get('stats_server'))
|
||||
self.assertIsNotNone(config.get('char_limits'))
|
||||
|
||||
def test_with_zero_size_config(self):
|
||||
"""It should set defaults if config file has nothing in it"""
|
||||
testdir = tempfile.mkdtemp(prefix=inspect.currentframe().f_code.co_name, dir=self.tmpdir)
|
||||
os.chdir(testdir)
|
||||
open('config.yml', 'w').close()
|
||||
self.assertTrue(os.path.exists('config.yml'))
|
||||
self.assertFalse(os.path.exists('config.py'))
|
||||
config = fdroidserver.common.read_config(fdroidserver.common.options)
|
||||
self.assertIsNone(config.get('stats_server'))
|
||||
self.assertIsNotNone(config.get('char_limits'))
|
||||
|
||||
def test_with_config_yml(self):
|
||||
"""Make sure it is possible to use config.yml alone."""
|
||||
testdir = tempfile.mkdtemp(
|
||||
|
@ -23,6 +23,7 @@ if localmodule not in sys.path:
|
||||
|
||||
import fdroidserver.common
|
||||
import fdroidserver.index
|
||||
import fdroidserver.net
|
||||
import fdroidserver.signindex
|
||||
import fdroidserver.publish
|
||||
from testcommon import TmpCwd
|
||||
@ -148,6 +149,17 @@ class IndexTest(unittest.TestCase):
|
||||
self.assertEqual(10, len(index['packages']))
|
||||
self.assertEqual('new_etag', new_etag)
|
||||
|
||||
@patch('fdroidserver.net.http_get')
|
||||
def test_download_repo_index_url_parsing(self, mock_http_get):
|
||||
mock_http_get.side_effect = lambda url, etag, timeout: (None, url)
|
||||
repo_url = 'https://example.org/fdroid/repo'
|
||||
index_url = 'https://example.org/fdroid/repo/index-v1.jar'
|
||||
fingerprint_url = 'https://example.org/fdroid/repo?fingerprint=' + GP_FINGERPRINT
|
||||
slash_url = 'https://example.org/fdroid/repo//?fingerprint=' + GP_FINGERPRINT
|
||||
for url in (repo_url, index_url, fingerprint_url, slash_url):
|
||||
_ignored, returned_url = fdroidserver.index.download_repo_index(url, verify_fingerprint=False)
|
||||
self.assertEqual(index_url, returned_url)
|
||||
|
||||
def test_v1_sort_packages(self):
|
||||
|
||||
i = [{'packageName': 'org.smssecure.smssecure',
|
||||
|
Loading…
Reference in New Issue
Block a user