Merge pull request #248 from kiwix/extra_build_version

Do not overwrite release build archives.
This commit is contained in:
Matthieu Gautier 2018-09-04 18:34:39 +02:00 committed by GitHub
commit 2686d74a78
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 37 additions and 2 deletions

View File

@ -1,3 +1,4 @@
# This file reference all the versions of the depedencies we use in kiwix-build.
main_project_versions = {
'kiwix-lib': '2.0.2',
@ -8,6 +9,23 @@ main_project_versions = {
'kiwix-desktop': '2.0-alpha2'
}
# This dictionnary specify what we need to build at each release process.
# - Values are integer or None
# - If a project is not in the dict (or None), the project is not released.
# - If release_versions[project] == 0, this is the first time the project is
# build for this release, so publish src and build archives.
# - If release_versions[project] > 0, release only the build archive with a
# build postfix.
# To change this dictionnary, use the following algorithm:
# - If project version change, set release_versions[project] = 0
# - Else
# - If project depedencies have not change, remove project from release_versions
# - Else, increment the value. If no value was present, see in
# http://download.kiwikorg/releases what to set.
release_versions = {
}
# This is the "version" of the whole base_deps_versions dict.
# Change this when you change base_deps_versions.

View File

@ -13,6 +13,7 @@ from urllib.error import URLError
from kiwixbuild.versions import (
main_project_versions,
release_versions,
base_deps_versions,
base_deps_meta_version)
@ -98,6 +99,12 @@ def run_kiwix_build(target, platform,
def create_app_image():
if make_release:
postfix = main_project_versions['kiwix-desktop']
extra_postfix = release_versions.get('kiwix-desktop')
if extra_postfix is None:
# We should not make archives for release not wanted
return
if extra_postfix:
postfix = "{}-{}".format(postfix, extra_postfix)
archive_dir = RELEASE_KIWIX_ARCHIVES_DIR/'kiwix-desktop'
src_dir = SOURCE_DIR/'kiwix-desktop_release'
else:
@ -126,6 +133,12 @@ def make_archive(project, platform):
if make_release:
postfix = main_project_versions[project]
extra_postfix = release_versions.get(project)
if extra_postfix is None:
# We should not make archives for release not wanted
return
if extra_postfix:
postfix = "{}-{}".format(postfix, extra_postfix)
if project in ('kiwix-lib', 'kiwix-tools'):
archive_dir = RELEASE_KIWIX_ARCHIVES_DIR/project
else:
@ -322,7 +335,7 @@ for target in TARGETS:
make_release=make_release)
if target == 'kiwix-desktop':
create_app_image()
if make_release and PLATFORM == 'native_dyn':
if make_release and PLATFORM == 'native_dyn' and release_versions.get(target) == 0:
run_kiwix_build(target,
platform=PLATFORM,
make_release=True,
@ -332,6 +345,9 @@ for target in TARGETS:
# We have build everything. Now create archives for public deployement.
if make_release and PLATFORM == 'native_dyn':
for target in TARGETS:
if release_versions.get(target) != 0:
# Do not release project not in release_versions
continue
if target in ('kiwix-lib', 'kiwix-tools', 'kiwix-desktop'):
out_dir = DIST_KIWIX_ARCHIVES_DIR
else:
@ -346,7 +362,8 @@ if make_release and PLATFORM == 'native_dyn':
in_file = BASE_DIR/target/'meson-dist'/'{}-{}.tar.xz'.format(
target,
main_project_versions[target])
shutil.copy(str(in_file), str(out_dir/target))
if in_file.exists():
shutil.copy(str(in_file), str(out_dir/target))
elif PLATFORM == 'native_static':
for target in ('kiwix-tools', 'zim-tools', 'zimwriterfs'):
make_archive(target, 'linux-x86_64')