X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=libguestfs_upstream.ml;h=a3d558fc1c92a43d4ee9682db3e7f06534cacf13;hb=8e4d36a8ec04de7ec2ae22f336708adb537a7e59;hp=be939ae5ea7e1777381c798bbc7d40b0a88c5d82;hpb=e81f5fbb75e3df83e4d01addf6e2c97c40b80ccf;p=goaljobs-goals.git diff --git a/libguestfs_upstream.ml b/libguestfs_upstream.ml index be939ae..a3d558f 100644 --- a/libguestfs_upstream.ml +++ b/libguestfs_upstream.ml @@ -11,6 +11,7 @@ open Goaljobs open Printf open Config +open Libguestfs (* Enable debugging. *) let () = @@ -20,37 +21,13 @@ let () = (* Log program output. *) let from = "rjones@redhat.com" let to_ = "rjones@redhat.com" +(* let logfile = log_program_output () let () = eprintf "logging to %s\n%!" logfile +*) let package = "libguestfs" -(* Helper object which stores everything about a version. *) -type info = { - version : string; (* The version as a normal string. *) - major : int; (* Broken-out version fields. *) - minor : int; - release: int; - is_stable : bool; (* is a stable version of libguestfs? *) - branch : string; (* 'master' or 'stable-1.xx' *) - package_version : string; (* package-version *) - tarball : string; (* package-version.tar.gz *) - urlpath : string; (* download/1.X-(stable|development)/tarball *) - url : string; (* full download URL of tarball *) -} - -(* Helper: Fetch latest gnulib into $buildtmp/repos/gnulib - * XXX Move to Gnulib module. - *) -let get_gnulib () = - sh " - cd %s/repos - if [ ! -d gnulib ]; then git clone git://git.sv.gnu.org/gnulib.git; fi - cd gnulib - git checkout --force master - git pull - " buildtmp - (* Goal: the website has been updated to 'version'. *) let rec goal website_updated version = target (url_exists version.url); @@ -67,19 +44,19 @@ let rec goal website_updated version = (* Goal: website has been rsync'd. *) and website_rsync_done version = - let key = sprintf "libguestfs_website_rsync_done_%s" version.version in - target (memory_exists key); + target (url_contains_string "http://libguestfs.org" version.version && + url_exists version.url); sh " cd %s - echo NOT RUNNING: . .rsync - " libguestfs_website_cvs; - memory_set key "1" + ./.rsync + " libguestfs_website_cvs (* Goal: Tarball added to CVS and CVS checked in. *) and website_cvs_checked_in version = let key = sprintf "libguestfs_website_cvs_checked_in_%s" version.version in target (memory_exists key); + onrun (fun () -> memory_set key "1"); require (tarball_created version); require (tarball_tested version); @@ -87,8 +64,8 @@ and website_cvs_checked_in version = sh " cd %s cp %s/tarballs/%s %s - echo NOT RUNNING: cvs add -kb %s - echo NOT RUNNING: cvs ci -m \"Version %s\" + cvs add -kb %s + cvs ci -m \"Version %s\" " libguestfs_website_cvs buildtmp version.tarball version.urlpath version.urlpath @@ -108,9 +85,11 @@ and website_built version = sh " tar zxf %s/tarballs/%s cd %s + echo %s > localconfigure chmod +x localconfigure - echo %s > localenv . + echo %s > localenv + ./localconfigure make make website @@ -125,15 +104,18 @@ and website_built version = and tarball_tested version = let key = sprintf "libguestfs_tarball_tested_%s" version.version in target (memory_exists key); + onrun (fun () -> memory_set key "1"); require (tarball_created version); sh " tar zxf %s/tarballs/%s cd %s + echo %s > localconfigure chmod +x localconfigure - echo %s > localenv . + echo %s > localenv + ./localconfigure make make check-release @@ -157,7 +139,7 @@ and tarball_created version = echo %s > localconfigure chmod +x localconfigure - echo %s > localenv . + echo %s > localenv ./localconfigure make @@ -174,11 +156,12 @@ and commit_tested branch commit = onfail ( fun _ -> let subject = sprintf "goal: %s: FAILED" goalname in - mailto ~from ~subject ~attach:[logfile] to_ + mailto ~from ~subject (*~attach:[logfile]*) to_ ); let key = sprintf "libguestfs_commit_tested_%s" commit in target (memory_exists key); + onrun (fun () -> memory_set key "1"); let repodir = sprintf "%s/repos/%s-%s" buildtmp package branch in require (directory_exists repodir); @@ -198,81 +181,13 @@ and commit_tested branch commit = " repodir commit (quote (libguestfs_localconfigure `Git)) - (quote libguestfs_localenv); - - memory_set key "1" - -(* 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/- - *) -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) + (quote libguestfs_localenv) let () = (* Add a periodic job to check for new git commits and test them. *) every libguestfs_query_mins minutes ~name:"new libguestfs commit" ( fun () -> - git_force "https://github.com/libguestfs/libguestfs.git" "master"; - + git_force "master"; let commit = git_latest_commit "master" in require (commit_tested "master" commit); ); @@ -280,8 +195,23 @@ let () = (* Periodic job to build new tarballs. *) every libguestfs_query_mins minutes ~name:"new libguestfs version" ( fun () -> - git_force "https://github.com/libguestfs/libguestfs.git" "master"; - + git_force "master"; let version = git_latest_version "master" in require (website_updated version) ) + +(* Allow these jobs to run from the command line. *) +let () = + publish "commit" ( + function + | [commit] -> require (commit_tested "master" commit) + | [branch; commit] -> require (commit_tested branch commit) + | _ -> + failwith "use './libguestfs_upstream commit [] '" + ); + publish "release" ( + function + | [version] -> require (website_updated (vernames version)) + | _ -> + failwith "use './libguestfs_upstream release '" + )