-(* Helper function to make a full 'info' object from a version
- * number.
- *)
-let vernames version =
- Scanf.sscanf version "%d.%d.%d" (
- fun major minor release ->
- let is_stable = minor mod 2 = 0 in
- let branch =
- if is_stable then
- sprintf "stable-%d.%d" major minor
- else
- sprintf "master" in
- let package_version = sprintf "%s-%d.%d.%d" package major minor release in
- let tarball = sprintf "%s.tar.gz" package_version in
- let urlpath =
- if is_stable then
- sprintf "download/%d.%d-stable/%s" major minor tarball
- else
- sprintf "download/%d.%d-development/%s" major minor tarball in
- let url = "http://libguestfs.org/" ^ urlpath in
- { version = version;
- major = major; minor = minor; release = release;
- is_stable = is_stable;
- branch = branch;
- package_version = package_version;
- tarball = tarball;
- urlpath = urlpath;
- url = url }
- )
-
-(* Helper function to read the latest version in a repo and return
- * the version.
- *)
-let git_latest_version branch =
- let v = shout "
- cd %s/repos/%s-%s
- git describe --tags --abbrev=0
- " buildtmp package (quote branch) in
- vernames v
-
-(* Get the latest commit. *)
-let git_latest_commit branch =
- shout "
- cd %s/repos/%s-%s
- git rev-parse HEAD
- " buildtmp package (quote branch)
-
-(* Clone or update a repo to the latest version on a branch, by force.
- * It is cached in name = $buildtmp/repos/<package>-<branch>
- *)
-let git_force url branch =
- sh "
- cd %s/repos
- if [ ! -d %s-%s ]; then git clone %s %s-%s; fi
- cd %s-%s
- git checkout --force %s
- git pull
- # Copy or update gnulib
- git submodule init
- git submodule update
- " buildtmp
- package (quote branch) (quote url) package (quote branch)
- package (quote branch)
- (quote branch)