Add a option to kiwix-build.py to build release version of subproject.

With `--make-release` option, kiwix-build.py will build the tagged
version of the subproject.
This commit is contained in:
Matthieu Gautier 2017-11-28 16:30:20 +00:00
parent 9823f7ae48
commit e4f8b6c7a9
3 changed files with 22 additions and 5 deletions

View File

@ -276,9 +276,11 @@ class Libzim(Dependency):
class Source(GitClone):
git_remote = "https://github.com/openzim/libzim.git"
git_dir = "libzim"
release_git_ref = "3.0.0"
Builder = MesonBuilder
class ZimTools(Dependency):
name = "zim-tools"
dependencies = ['libzim']
@ -336,6 +338,7 @@ class Kiwixlib(Dependency):
class Source(GitClone):
git_remote = "https://github.com/kiwix/kiwix-lib.git"
git_dir = "kiwix-lib"
release_git_ref = "1.0.1"
class Builder(MesonBuilder):
@property
@ -359,6 +362,7 @@ class KiwixTools(Dependency):
class Source(GitClone):
git_remote = "https://github.com/kiwix/kiwix-tools.git"
git_dir = "kiwix-tools"
release_git_ref = "0.3.0"
class Builder(MesonBuilder):
@property

View File

@ -123,22 +123,33 @@ class ReleaseDownload(Source):
class GitClone(Source):
git_ref = "master"
base_git_ref = "master"
release_git_ref = "master"
@property
def source_dir(self):
return self.git_dir
if self.buildEnv.make_release:
return "{}_release".format(self.git_dir)
else:
return self.git_dir
@property
def git_path(self):
return pj(self.buildEnv.source_dir, self.git_dir)
return pj(self.buildEnv.source_dir, self.source_dir)
@property
def git_ref(self):
if self.buildEnv.make_release:
return self.release_git_ref
else:
return self.base_git_ref
def _git_clone(self, context):
context.force_native_build = True
if os.path.exists(self.git_path):
raise SkipCommand()
command = "git clone --depth=1 --branch {} {} {}".format(
self.git_ref, self.git_remote, self.git_dir)
self.git_ref, self.git_remote, self.source_dir)
self.buildEnv.run_command(command, self.buildEnv.source_dir, context)
def _git_update(self, context):

View File

@ -979,7 +979,9 @@ def parse_args():
parser.add_argument('--skip-source-prepare', action='store_true',
help="Skip the source download part")
parser.add_argument('--build-deps-only', action='store_true',
help=("Build only the dependencies of the specified targets."))
help="Build only the dependencies of the specified targets.")
parser.add_argument('--make-release', action='store_true',
help="Build a release version")
subgroup = parser.add_argument_group('advanced')
subgroup.add_argument('--no-cert-check', action='store_true',
help="Skip SSL certificate verification during download")