1 (* This goal script is responsible for:
2 * - testing each new commit to the libguestfs source repo
3 * - checking for new upstream releases of libguestfs
4 * - testing new upstream releases
5 * - packaging them as a source tarball
6 * - testing the source tarball on a variety of systems
7 * - if all the above works, uploading the external website
8 * Note this doesn't build the Fedora releases. See 'libguestfs_fedora.ml'.
16 (* Enable debugging. *)
18 Unix.putenv "LIBGUESTFS_DEBUG" "1";
19 Unix.putenv "LIBGUESTFS_TRACE" "1"
21 (* Log program output. *)
22 let from = "rjones@redhat.com"
23 let to_ = "rjones@redhat.com"
25 let logfile = log_program_output ()
26 let () = eprintf "logging to %s\n%!" logfile
29 let package = "libguestfs"
31 (* Goal: the website has been updated to 'version'. *)
32 let rec goal website_updated version =
33 target (url_exists version.url);
35 require (tarball_created version);
36 require (tarball_tested version);
38 (* We only update the website for the development releases. *)
39 if not version.is_stable then
40 require (website_built version);
42 require (website_cvs_checked_in version);
43 require (website_rsync_done version)
45 (* Goal: website has been rsync'd. *)
46 and website_rsync_done version =
47 target (url_contains_string "http://libguestfs.org" version.version &&
48 url_exists version.url);
53 " libguestfs_website_cvs
55 (* Goal: Tarball added to CVS and CVS checked in. *)
56 and website_cvs_checked_in version =
57 let key = sprintf "libguestfs_website_cvs_checked_in_%s" version.version in
58 target (memory_exists key);
59 onrun (fun () -> memory_set key "1");
61 require (tarball_created version);
62 require (tarball_tested version);
68 cvs ci -m \"Version %s\"
69 " libguestfs_website_cvs
70 buildtmp version.tarball version.urlpath
74 (* Goal: website (local copy) has been built. *)
75 and website_built version =
76 let index_file = sprintf "%s/index.html" libguestfs_website_cvs in
77 target (file_contains_string index_file version.version);
79 require (tarball_created version);
80 require (tarball_tested version);
82 (* We should only update the website on development releases. *)
83 assert (not version.is_stable);
86 tar zxf %s/tarballs/%s
89 echo %s > localconfigure
90 chmod +x localconfigure
93 # Copy in the builder/website templates.
94 cp $HOME/d/libguestfs/builder/website/*.xz builder/website/
99 " buildtmp version.tarball
100 version.package_version
101 (quote (libguestfs_localconfigure `Tarball))
102 (quote libguestfs_localenv)
104 (* Goal: the tarball has passed the required set of tests before
105 * a release is allowed.
107 and tarball_tested version =
108 let key = sprintf "libguestfs_tarball_tested_%s" version.version in
109 target (memory_exists key);
110 onrun (fun () -> memory_set key "1");
112 require (tarball_created version);
115 tar zxf %s/tarballs/%s
118 echo %s > localconfigure
119 chmod +x localconfigure
125 " buildtmp version.tarball
126 version.package_version
127 (quote (libguestfs_localconfigure `Tarball))
128 (quote libguestfs_localenv)
130 (* Goal: the tarball has been created from git. *)
131 and tarball_created version =
132 let filename = sprintf "%s/tarballs/%s" buildtmp version.tarball in
133 target (file_exists filename);
135 require (repo_up_to_date version.branch);
137 let repodir = sprintf "%s/repos/%s-%s" buildtmp package version.branch in
144 echo %s > localconfigure
145 chmod +x localconfigure
154 (quote (libguestfs_localconfigure `Git))
155 (quote libguestfs_localenv)
156 version.tarball buildtmp version.tarball
158 (* Goal: test a commit. *)
159 and commit_tested branch commit =
162 let subject = sprintf "goal: %s: FAILED" goalname in
163 mailto ~from ~subject (*~attach:[logfile]*) to_
166 let key = sprintf "libguestfs_commit_tested_%s" commit in
167 target (memory_exists key);
168 onrun (fun () -> memory_set key "1");
170 require (repo_up_to_date branch);
172 let repodir = sprintf "%s/repos/%s-%s" buildtmp package branch in
179 echo %s > localconfigure
180 chmod +x localconfigure
188 (quote (libguestfs_localconfigure `Git))
189 (quote libguestfs_localenv)
191 and repo_up_to_date branch =
195 (* Add a periodic job to check for new git commits and test them. *)
196 every libguestfs_query_mins minutes ~name:"new libguestfs commit" (
198 require (repo_up_to_date "master");
199 let commit = git_latest_commit "master" in
200 require (commit_tested "master" commit);
203 (* Periodic job to build new tarballs. *)
204 every libguestfs_query_mins minutes ~name:"new libguestfs version" (
206 require (repo_up_to_date "master");
207 let version = git_latest_version "master" in
208 require (website_updated version)
211 (* Allow these jobs to run from the command line. *)
215 | [commit] -> require (commit_tested "master" commit)
216 | [branch; commit] -> require (commit_tested branch commit)
218 failwith "use './libguestfs_upstream commit [<branch>] <commit>'"
222 | [version] -> require (website_updated (vernames version))
224 failwith "use './libguestfs_upstream release <version>'"