Cache the flapak state dir to speed the build.

This commit is contained in:
Matthieu Gautier 2019-06-14 16:36:56 +02:00
parent 50ba90e67c
commit 2e204a0abe
1 changed files with 23 additions and 0 deletions

View File

@ -246,6 +246,14 @@ def make_deps_archive(target=None, name=None, full=False):
print('.{}'.format(name), flush=True)
tar.add(str(name), arcname=str(name.relative_to(relative_path)))
def make_flatpak_cache_archive():
archive_name = "base_deps_{os}_{platform}.tar.xz".format(
os=TRAVIS_OS_NAME,
platform=PLATFORM)
cache = BASE_DIR/'.flatpak-builder'
with tarfile.open(str(BASE_EXPORT_DIR/archive_name), 'w:xz') as tar:
tar.add(str(cache), arcname=str(cache.relative_to(BASE_DIR)))
def update_flathub_git():
GIT_REPO_DIR = GIT_EXPORT_DIR/"org.kiwix.desktop"
@ -332,6 +340,19 @@ if PLATFORM != 'flatpak':
else:
run_kiwix_build('alldependencies', platform=PLATFORM)
make_deps_archive(name=base_dep_archive_name, full=True)
else:
base_dep_archive_name = "base_deps_{os}_{platform}.tar.xz".format(
os=TRAVIS_OS_NAME,
platform=PLATFORM)
print_message("Getting archive {}", base_dep_archive_name)
try:
local_filename = download_base_archive(base_dep_archive_name)
BASE_DIR.mkdir(parents=True)
with tarfile.open(local_filename) as f:
f.extractall(str(BASE_DIR))
except URLError:
print_message("Cannot get archive. Move on")
# A basic compilation to be sure everything is working (for a PR)
@ -369,6 +390,8 @@ if environ['TRAVIS_EVENT_TYPE'] != 'cron' and not make_release:
make_archive('kiwix-tools', 'linux-armhf')
elif PLATFORM == 'i586_static':
make_archive('kiwix-tools', 'linux-i586')
elif PLATFORM == 'flatpak':
make_flatpak_cache_archive()
sys.exit(0)