Merge pull request #286 from kiwix/fix_flatpak

Fix flatpak
This commit is contained in:
Matthieu Gautier 2019-01-29 16:55:30 +01:00 committed by GitHub
commit 2aee71075e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 10 deletions

View File

@ -8,7 +8,6 @@ pj = os.path.join
class org_kde(Dependency):
neutral = False
name = 'org.kde'
version = '5.11'
Source = NoopSource
@ -26,7 +25,7 @@ class org_kde(Dependency):
command = command.format(
remote_name = 'flathub',
name = self.target.name,
version = self.target.version
version = self.target.version()
)
run_command(command, self.buildEnv.build_dir, context, buildEnv=self.buildEnv)
@ -34,4 +33,3 @@ class org_kde(Dependency):
self.command('setup_remote', self._setup_remote)
self.command('install_sdk', self._install_sdk)

View File

@ -7,6 +7,7 @@ from .platforms import PlatformInfo
from .utils import remove_duplicates, run_command, StopBuild, Context
from .dependencies import Dependency
from .packages import PACKAGE_NAME_MAPPERS
from .versions import base_deps_versions
from ._global import (
neutralEnv, option,
add_target_step, get_target_step, target_steps,
@ -24,11 +25,14 @@ from .dependencies.base import (
SCRIPT_DIR)
import json
from shutil import copyfile
from urllib.parse import urlparse
from urllib.request import urlopen
import json
MANIFEST = {
'app-id': 'org.kiwix.desktop',
'runtime': 'org.kde.Platform',
'runtime-version': '5.11',
'runtime-version': base_deps_versions['org.kde'],
'sdk': 'org.kde.Sdk',
'command': 'kiwix-desktop',
'rename-icon': 'kiwix-desktop',
@ -57,7 +61,7 @@ MANIFEST = {
]
}
GET_REF_URL_API_TEMPLATE = 'https://api.github.com/repos{repo}/git/refs/tags/{ref}'
class FlatpakBuilder:
def __init__(self):
@ -154,6 +158,18 @@ class FlatpakBuilder:
'url': source.git_remote,
'tag': source.git_ref
}
try:
parsed = urlparse(source.git_remote)
if parsed.hostname == 'github.com':
repo = parsed.path[:-4]
api_url = GET_REF_URL_API_TEMPLATE.format(
repo = repo,
ref = source.git_ref)
with urlopen(api_url) as r:
ret = json.loads(r.read())
src['commit'] = ret['object']['sha']
except:
pass
module_sources.append(src)
for p in getattr(source, 'patches', []):
patch = {

View File

@ -1,12 +1,12 @@
# This file reference all the versions of the depedencies we use in kiwix-build.
main_project_versions = {
'kiwix-lib': '3.1.1',
'kiwix-tools': '0.8.0',
'kiwix-lib': '4.0.0',
'kiwix-tools': '0.9.0',
'libzim': '4.0.4',
'zim-tools': '1.0.0',
'zimwriterfs': '1.2',
'kiwix-desktop': '2.0-beta2'
'kiwix-desktop': '2.0-beta3'
}
# This dictionnary specify what we need to build at each release process.
@ -25,8 +25,8 @@ main_project_versions = {
release_versions = {
'libzim': None, # Depends of base deps (was 0)
'kiwix-lib': None, # Depends of libzim (was 0)
'kiwix-tools': None, # Depends of kiwix-lib and libzim (was 2)
'kiwix-lib': 0, # Depends of libzim (was 0)
'kiwix-tools': 0, # Depends of kiwix-lib and libzim (was 0)
'zim-tools': None, # Depends of libzim (was 2)
'zimwriterfs': None, # Depends of libzim (was 1)
'kiwix-desktop': 0 # Depends of kiwix-lib and libzim
@ -55,4 +55,5 @@ base_deps_versions = {
'android-ndk' : 'r13b',
'qt' : '5.10.1',
'qtwebengine' : '5.10.1',
'org.kde' : '5.12',
}