diff --git a/travis/compile_all.py b/travis/compile_all.py index f8c1845..2147437 100755 --- a/travis/compile_all.py +++ b/travis/compile_all.py @@ -52,6 +52,8 @@ EXPORT_FILES = { 'include/zim/**/*.h')) } +FLATPAK_GIT_REMOTE = 'git@github.com:flathub/org.kiwix.desktop.git' + _date = date.today().isoformat() def print_message(message, *args, **kwargs): @@ -242,6 +244,29 @@ def make_deps_archive(target, full=False): 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): print_message("Copy {} to {}", what, where) command = ['scp', '-o', 'StrictHostKeyChecking=no', @@ -396,7 +421,6 @@ for target in TARGETS: make_release=True, make_dist=True) - # We have build everything. Now create archives for public deployement. if make_release and PLATFORM == 'native_dyn': for target in TARGETS: @@ -433,6 +457,8 @@ elif PLATFORM == 'armhf_static': make_archive('kiwix-tools', 'linux-armhf') elif PLATFORM == 'i586_static': make_archive('kiwix-tools', 'linux-i586') +elif make_release and PLATFORM == 'flatpak': + update_flathub_git() elif PLATFORM.startswith('android') and 'kiwix-android' in TARGETS: APK_NAME = "kiwix-{}".format(PLATFORM) source_debug_dir = HOME/'BUILD_android'/'kiwix-android'/'app'/'build'/'outputs'/'apk'/'kiwix'/'debug'