1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-11-09 17:00:12 +01:00

Merge branch 'three-commits-for-things' into 'master'

four random fixes

See merge request fdroid/fdroidserver!1183
This commit is contained in:
Jochen Sprickerhof 2022-09-08 17:19:16 +00:00
commit 8eea3a6822
4 changed files with 53 additions and 32 deletions

View File

@ -582,9 +582,11 @@ docker:
- docker tag $TEST_IMAGE ${RELEASE_IMAGE}-stretch - docker tag $TEST_IMAGE ${RELEASE_IMAGE}-stretch
- echo $CI_BUILD_TOKEN | docker login -u gitlab-ci-token --password-stdin registry.gitlab.com - echo $CI_BUILD_TOKEN | docker login -u gitlab-ci-token --password-stdin registry.gitlab.com
# This avoids filling up gitlab.com free tier accounts with unused docker images. # This avoids filling up gitlab.com free tier accounts with unused docker images.
- echo "Skipping docker push to save quota on your gitlab namespace." - if test -n "$FDROID_PUSH_DOCKER_IMAGE"; then
- echo "If you want to enable the push, set FDROID_PUSH_DOCKER_IMAGE in" echo "Skipping docker push to save quota on your gitlab namespace.";
- echo "https://gitlab.com/$CI_PROJECT_NAMESPACE/fdroidserver/-/settings/ci_cd#js-cicd-variables-settings" echo "If you want to enable the push, set FDROID_PUSH_DOCKER_IMAGE in";
- test -n "$FDROID_PUSH_DOCKER_IMAGE" || exit 0 echo "https://gitlab.com/$CI_PROJECT_NAMESPACE/fdroidserver/-/settings/ci_cd#js-cicd-variables-settings";
exit 0;
fi
- docker push $RELEASE_IMAGE - docker push $RELEASE_IMAGE
- docker push $RELEASE_IMAGE-stretch - docker push $RELEASE_IMAGE-stretch

View File

@ -31,9 +31,13 @@ RUN useradd --create-home -s /bin/bash vagrant && echo -n 'vagrant:vagrant' | ch
# the provision scripts must be run in the same order as in Vagrantfile # the provision scripts must be run in the same order as in Vagrantfile
# - vagrant needs openssh-client iproute2 ssh sudo # - vagrant needs openssh-client iproute2 ssh sudo
# - ansible needs python3 # - ansible needs python3
# Debian Docker images will soon default to HTTPS for apt sources, so force it.
# https://github.com/debuerreotype/docker-debian-artifacts/issues/15
RUN printf "path-exclude=/usr/share/locale/*\npath-exclude=/usr/share/man/*\npath-exclude=/usr/share/doc/*\npath-include=/usr/share/doc/*/copyright\n" >/etc/dpkg/dpkg.cfg.d/01_nodoc \ RUN printf "path-exclude=/usr/share/locale/*\npath-exclude=/usr/share/man/*\npath-exclude=/usr/share/doc/*\npath-include=/usr/share/doc/*/copyright\n" >/etc/dpkg/dpkg.cfg.d/01_nodoc \
&& mkdir -p /usr/share/man/man1 \ && mkdir -p /usr/share/man/man1 \
&& apt-get update \ && apt-get update \
&& apt-get install apt-transport-https ca-certificates \
&& sed -i 's,http:,https:,' /etc/apt/sources.list \
&& apt-get upgrade \ && apt-get upgrade \
&& apt-get dist-upgrade \ && apt-get dist-upgrade \
&& apt-get install openssh-client iproute2 python3 openssh-server sudo \ && apt-get install openssh-client iproute2 python3 openssh-server sudo \

View File

@ -489,17 +489,11 @@ def dict_diff(source, target):
return result return result
def file_entry(filename, hashType=None, hsh=None, size=None): def file_entry(filename, hash_value=None):
meta = {} meta = {}
meta["name"] = "/" + filename.split("/", 1)[1] meta["name"] = "/" + filename.split("/", 1)[1]
if hsh: meta["sha256"] = hash_value or common.sha256sum(filename)
meta[hashType] = hsh meta["size"] = os.stat(filename).st_size
if hsh != "sha256":
meta["sha256"] = common.sha256sum(filename)
if size:
meta["size"] = size
else:
meta["size"] = os.stat(filename).st_size
return meta return meta
@ -619,13 +613,13 @@ def convert_version(version, app, repodir):
if "obbMainFile" in version: if "obbMainFile" in version:
ver["obbMainFile"] = file_entry( ver["obbMainFile"] = file_entry(
os.path.join(repodir, version["obbMainFile"]), os.path.join(repodir, version["obbMainFile"]),
"sha256", version["obbMainFileSha256"] version["obbMainFileSha256"],
) )
if "obbPatchFile" in version: if "obbPatchFile" in version:
ver["obbPatchFile"] = file_entry( ver["obbPatchFile"] = file_entry(
os.path.join(repodir, version["obbPatchFile"]), os.path.join(repodir, version["obbPatchFile"]),
"sha256", version["obbPatchFileSha256"] version["obbPatchFileSha256"],
) )
ver["manifest"] = manifest = {} ver["manifest"] = manifest = {}

View File

@ -88,28 +88,49 @@ class UpdateTest(unittest.TestCase):
fdroidserver.common.config = None fdroidserver.common.config = None
fdroidserver.common.options = None fdroidserver.common.options = None
def testInsertStoreMetadata(self): def test_insert_store_metadata(self):
tmptestsdir = tempfile.mkdtemp(
prefix=inspect.currentframe().f_code.co_name, dir=self.tmpdir
)
os.chdir(tmptestsdir)
config = dict() config = dict()
fdroidserver.common.fill_config_defaults(config) fdroidserver.common.fill_config_defaults(config)
fdroidserver.update.config = config fdroidserver.update.config = config
os.chdir(os.path.join(localmodule, 'tests'))
shutil.rmtree(os.path.join('repo', 'info.guardianproject.urzip'), ignore_errors=True) repo_dir = os.path.join(self.basedir, 'repo')
os.mkdir('metadata')
shutil.rmtree(os.path.join('build', 'com.nextcloud.client'), ignore_errors=True) for packageName in (
shutil.copytree(os.path.join('source-files', 'com.nextcloud.client'), 'obb.mainpatch.current',
os.path.join('build', 'com.nextcloud.client')) 'org.videolan.vlc',
):
shutil.rmtree(os.path.join('build', 'com.nextcloud.client.dev'), ignore_errors=True) shutil.copytree(
shutil.copytree(os.path.join('source-files', 'com.nextcloud.client.dev'), os.path.join(repo_dir, packageName),
os.path.join('build', 'com.nextcloud.client.dev')) os.path.join('repo', packageName)
)
shutil.rmtree(os.path.join('build', 'eu.siacs.conversations'), ignore_errors=True) for packageName in (
shutil.copytree(os.path.join('source-files', 'eu.siacs.conversations'), 'info.guardianproject.checkey',
os.path.join('build', 'eu.siacs.conversations')) 'info.guardianproject.urzip',
'org.smssecure.smssecure',
):
if not os.path.exists('metadata'):
os.mkdir('metadata')
shutil.copytree(
os.path.join(self.basedir, 'metadata', packageName),
os.path.join('metadata', packageName)
)
for packageName in (
'com.nextcloud.client',
'com.nextcloud.client.dev',
'eu.siacs.conversations',
):
shutil.copytree(
os.path.join(self.basedir, 'source-files', packageName),
os.path.join(tmptestsdir, 'build', packageName),
)
testfilename = 'icon_yAfSvPRJukZzMMfUzvbYqwaD1XmHXNtiPBtuPVHW-6s=.png' testfilename = 'icon_yAfSvPRJukZzMMfUzvbYqwaD1XmHXNtiPBtuPVHW-6s=.png'
testfile = os.path.join('repo', 'org.videolan.vlc', 'en-US', 'icon.png') testfile = os.path.join(repo_dir, 'org.videolan.vlc', 'en-US', 'icon.png')
cpdir = os.path.join('metadata', 'org.videolan.vlc', 'en-US') cpdir = os.path.join('metadata', 'org.videolan.vlc', 'en-US')
cpfile = os.path.join(cpdir, testfilename) cpfile = os.path.join(cpdir, testfilename)
os.makedirs(cpdir, exist_ok=True) os.makedirs(cpdir, exist_ok=True)
@ -155,7 +176,7 @@ class UpdateTest(unittest.TestCase):
self.assertEqual(6, len(apps)) self.assertEqual(6, len(apps))
for packageName, app in apps.items(): for packageName, app in apps.items():
self.assertTrue('localized' in app) self.assertTrue('localized' in app, packageName)
self.assertTrue('en-US' in app['localized']) self.assertTrue('en-US' in app['localized'])
self.assertEqual(1, len(app['localized'])) self.assertEqual(1, len(app['localized']))
if packageName == 'info.guardianproject.urzip': if packageName == 'info.guardianproject.urzip':