mirror of
				https://github.com/f-droid/fdroidserver.git
				synced 2025-11-04 14:30:30 +03:00 
			
		
		
		
	Merge branch 'three-commits-for-things' into 'master'
four random fixes See merge request fdroid/fdroidserver!1183
This commit is contained in:
		
						commit
						8eea3a6822
					
				
					 4 changed files with 53 additions and 32 deletions
				
			
		| 
						 | 
				
			
			@ -582,9 +582,11 @@ docker:
 | 
			
		|||
    - docker tag $TEST_IMAGE ${RELEASE_IMAGE}-stretch
 | 
			
		||||
    - 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.
 | 
			
		||||
    - echo "Skipping docker push to save quota on your gitlab namespace."
 | 
			
		||||
    - echo "If you want to enable the push, set FDROID_PUSH_DOCKER_IMAGE in"
 | 
			
		||||
    - echo "https://gitlab.com/$CI_PROJECT_NAMESPACE/fdroidserver/-/settings/ci_cd#js-cicd-variables-settings"
 | 
			
		||||
    - test -n "$FDROID_PUSH_DOCKER_IMAGE" || exit 0
 | 
			
		||||
    - if test -n "$FDROID_PUSH_DOCKER_IMAGE"; then
 | 
			
		||||
          echo "Skipping docker push to save quota on your gitlab namespace.";
 | 
			
		||||
          echo "If you want to enable the push, set FDROID_PUSH_DOCKER_IMAGE in";
 | 
			
		||||
          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-stretch
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
# - vagrant needs openssh-client iproute2 ssh sudo
 | 
			
		||||
# - 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 \
 | 
			
		||||
	&& mkdir -p /usr/share/man/man1 \
 | 
			
		||||
	&& 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 dist-upgrade \
 | 
			
		||||
	&& apt-get install openssh-client iproute2 python3 openssh-server sudo \
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -489,17 +489,11 @@ def dict_diff(source, target):
 | 
			
		|||
    return result
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def file_entry(filename, hashType=None, hsh=None, size=None):
 | 
			
		||||
def file_entry(filename, hash_value=None):
 | 
			
		||||
    meta = {}
 | 
			
		||||
    meta["name"] = "/" + filename.split("/", 1)[1]
 | 
			
		||||
    if hsh:
 | 
			
		||||
        meta[hashType] = hsh
 | 
			
		||||
    if hsh != "sha256":
 | 
			
		||||
        meta["sha256"] = common.sha256sum(filename)
 | 
			
		||||
    if size:
 | 
			
		||||
        meta["size"] = size
 | 
			
		||||
    else:
 | 
			
		||||
        meta["size"] = os.stat(filename).st_size
 | 
			
		||||
    meta["sha256"] = hash_value or common.sha256sum(filename)
 | 
			
		||||
    meta["size"] = os.stat(filename).st_size
 | 
			
		||||
    return meta
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -619,13 +613,13 @@ def convert_version(version, app, repodir):
 | 
			
		|||
    if "obbMainFile" in version:
 | 
			
		||||
        ver["obbMainFile"] = file_entry(
 | 
			
		||||
            os.path.join(repodir, version["obbMainFile"]),
 | 
			
		||||
            "sha256", version["obbMainFileSha256"]
 | 
			
		||||
            version["obbMainFileSha256"],
 | 
			
		||||
        )
 | 
			
		||||
 | 
			
		||||
    if "obbPatchFile" in version:
 | 
			
		||||
        ver["obbPatchFile"] = file_entry(
 | 
			
		||||
            os.path.join(repodir, version["obbPatchFile"]),
 | 
			
		||||
            "sha256", version["obbPatchFileSha256"]
 | 
			
		||||
            version["obbPatchFileSha256"],
 | 
			
		||||
        )
 | 
			
		||||
 | 
			
		||||
    ver["manifest"] = manifest = {}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -88,28 +88,49 @@ class UpdateTest(unittest.TestCase):
 | 
			
		|||
        fdroidserver.common.config = 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()
 | 
			
		||||
        fdroidserver.common.fill_config_defaults(config)
 | 
			
		||||
        fdroidserver.update.config = config
 | 
			
		||||
        os.chdir(os.path.join(localmodule, 'tests'))
 | 
			
		||||
 | 
			
		||||
        shutil.rmtree(os.path.join('repo', 'info.guardianproject.urzip'), ignore_errors=True)
 | 
			
		||||
 | 
			
		||||
        shutil.rmtree(os.path.join('build', 'com.nextcloud.client'), ignore_errors=True)
 | 
			
		||||
        shutil.copytree(os.path.join('source-files', 'com.nextcloud.client'),
 | 
			
		||||
                        os.path.join('build', 'com.nextcloud.client'))
 | 
			
		||||
 | 
			
		||||
        shutil.rmtree(os.path.join('build', 'com.nextcloud.client.dev'), ignore_errors=True)
 | 
			
		||||
        shutil.copytree(os.path.join('source-files', 'com.nextcloud.client.dev'),
 | 
			
		||||
                        os.path.join('build', 'com.nextcloud.client.dev'))
 | 
			
		||||
 | 
			
		||||
        shutil.rmtree(os.path.join('build', 'eu.siacs.conversations'), ignore_errors=True)
 | 
			
		||||
        shutil.copytree(os.path.join('source-files', 'eu.siacs.conversations'),
 | 
			
		||||
                        os.path.join('build', 'eu.siacs.conversations'))
 | 
			
		||||
        repo_dir = os.path.join(self.basedir, 'repo')
 | 
			
		||||
        os.mkdir('metadata')
 | 
			
		||||
        for packageName in (
 | 
			
		||||
                'obb.mainpatch.current',
 | 
			
		||||
                'org.videolan.vlc',
 | 
			
		||||
        ):
 | 
			
		||||
            shutil.copytree(
 | 
			
		||||
                os.path.join(repo_dir, packageName),
 | 
			
		||||
                os.path.join('repo', packageName)
 | 
			
		||||
            )
 | 
			
		||||
        for packageName in (
 | 
			
		||||
                'info.guardianproject.checkey',
 | 
			
		||||
                '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'
 | 
			
		||||
        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')
 | 
			
		||||
        cpfile = os.path.join(cpdir, testfilename)
 | 
			
		||||
        os.makedirs(cpdir, exist_ok=True)
 | 
			
		||||
| 
						 | 
				
			
			@ -155,7 +176,7 @@ class UpdateTest(unittest.TestCase):
 | 
			
		|||
 | 
			
		||||
        self.assertEqual(6, len(apps))
 | 
			
		||||
        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.assertEqual(1, len(app['localized']))
 | 
			
		||||
            if packageName == 'info.guardianproject.urzip':
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue