Update flathub repository.

Push new flathub manifest and patches at each new release.
This commit is contained in:
Matthieu Gautier 2019-02-20 10:46:51 +01:00
parent 6200239bba
commit 74210ece52
1 changed files with 27 additions and 1 deletions

View File

@ -52,6 +52,8 @@ EXPORT_FILES = {
'include/zim/**/*.h')) 'include/zim/**/*.h'))
} }
FLATPAK_GIT_REMOTE = 'git@github.com:flathub/org.kiwix.desktop.git'
_date = date.today().isoformat() _date = date.today().isoformat()
def print_message(message, *args, **kwargs): def print_message(message, *args, **kwargs):
@ -242,6 +244,29 @@ def make_deps_archive(target, full=False):
return relative_path/archive_name return relative_path/archive_name
def update_flathub_git():
env = dict(os.environ)
env['GIT_SSH_COMMAND'] = 'ssh -o StrictHostKeyChecking=no -i {}'.format(SSH_KEY)
env['GIT_AUTHOR_NAME'] = env['GIT_COMMITTER_NAME'] = "KiwixBot"
env['GIT_AUTHOR_EMAIL'] = env['GIT_COMMITTER_EMAIL'] = "kiwixbot@kymeria.fr"
command = ['git', 'clone', FLATPAK_GIT_REMOTE]
subprocess.check_call(command, env=env, cwd=str(HOME))
shutil.copy(str(BASE_DIR/'org.kiwix.desktop.json'),
str(HOME/'org.kiwix.desktop'))
patch_dir = KBUILD_SOURCE_DIR/'kiwixbuild'/'patches'
for dep in ('libaria2', 'mustache', 'pugixml', 'xapian'):
for f in patch_dir.glob('{}_*.patch'.format(dep)):
shutil.copy(str(f), str(HOME/'org.kiwix.desktop'/'patches'))
command = ['git', 'add', '-A', '.']
subprocess.check_call(command, env=env, cwd=str(HOME/'org.kiwix.desktop'))
command = ['git', 'commit', '-m',
'Update to version {}'.format(main_project_versions['kiwix-desktop'])]
subprocess.check_call(command, env=env, cwd=str(HOME/'org.kiwix.desktop'))
command = ['git', 'push']
subprocess.check_call(command, env=env, cwd=str(HOME/'org.kiwix.desktop'))
def scp(what, where): def scp(what, where):
print_message("Copy {} to {}", what, where) print_message("Copy {} to {}", what, where)
command = ['scp', '-o', 'StrictHostKeyChecking=no', command = ['scp', '-o', 'StrictHostKeyChecking=no',
@ -396,7 +421,6 @@ for target in TARGETS:
make_release=True, make_release=True,
make_dist=True) make_dist=True)
# We have build everything. Now create archives for public deployement. # We have build everything. Now create archives for public deployement.
if make_release and PLATFORM == 'native_dyn': if make_release and PLATFORM == 'native_dyn':
for target in TARGETS: for target in TARGETS:
@ -433,6 +457,8 @@ elif PLATFORM == 'armhf_static':
make_archive('kiwix-tools', 'linux-armhf') make_archive('kiwix-tools', 'linux-armhf')
elif PLATFORM == 'i586_static': elif PLATFORM == 'i586_static':
make_archive('kiwix-tools', 'linux-i586') make_archive('kiwix-tools', 'linux-i586')
elif make_release and PLATFORM == 'flatpak':
update_flathub_git()
elif PLATFORM.startswith('android') and 'kiwix-android' in TARGETS: elif PLATFORM.startswith('android') and 'kiwix-android' in TARGETS:
APK_NAME = "kiwix-{}".format(PLATFORM) APK_NAME = "kiwix-{}".format(PLATFORM)
source_debug_dir = HOME/'BUILD_android'/'kiwix-android'/'app'/'build'/'outputs'/'apk'/'kiwix'/'debug' source_debug_dir = HOME/'BUILD_android'/'kiwix-android'/'app'/'build'/'outputs'/'apk'/'kiwix'/'debug'