1 (* Handle Fedora builds of libguestfs. *)
12 (* Enable debugging. *)
14 Unix.putenv "LIBGUESTFS_DEBUG" "1";
15 Unix.putenv "LIBGUESTFS_TRACE" "1"
17 (* Log program output. *)
18 let from = "rjones@redhat.com"
19 let to_ = "rjones@redhat.com"
21 let package = "libguestfs"
23 (* How branches in libguestfs upstream map to branches in Fedora. *)
25 (* "1.22-stable", "f19"; *) (* F19 built by hand. *)
26 "1.26-stable", "f20"; (* F20 follows 1.26. *)
27 "1.28-stable", "f21"; (* F21 follows 1.28. *)
28 "1.29-development", "f22"; (* F22 follows development (for now). *)
29 "1.29-development", "master"; (* Rawhide follows development. *)
32 (* Goal: Latest website version has been built in every branch. *)
35 fun (wbranch, fbranch) ->
36 match website_latest_version wbranch with
39 require (fedora_built version fbranch)
42 (* Goal: Fedora has a successful build of 'version' on 'branch'. *)
43 and fedora_built version branch =
44 let specfile = fedora_specfile package branch in
46 target (file_contains_string specfile version.version &&
47 match koji_build_state (fedora_verrel package branch) with
48 | `Complete | `Building -> true
51 require (sources_uploaded version branch);
52 require (specfile_pushed version branch);
54 koji_build ~wait:true package branch
56 and sources_uploaded version branch =
57 let repodir = fedora_repo package branch in
58 let sources = repodir // "sources" in
59 let key = sprintf "libguestfs_fedora_sources_uploaded_%s" version.version in
61 target (file_contains_string sources version.version &&
63 onrun (fun () -> memory_set key "1");
65 require (repodir_up_to_date repodir);
69 fedpkg new-sources %s/%s
70 " repodir libguestfs_website_repo version.urlpath
72 and specfile_updated version branch =
73 let repodir = fedora_repo package branch in
74 let specfile = fedora_specfile package branch in
76 target (file_contains_string specfile version.version);
78 require (repodir_up_to_date repodir);
80 (* Hairy specfile editing. *)
83 email=\"Richard W.M. Jones <rjones@redhat.com>\"
84 date=`date +\"%%a %%b %%d %%Y\"`
85 cp libguestfs.spec libguestfs.spec.old
86 sed < libguestfs.spec.old \\
87 -e \"s/^Version:.*/Version: %s/\" \\
88 -e \"s/^Release:.*/Release: 1%%{?dist}/\" \\
89 -e \"/^%%changelog/a \\
90 * $date $email - 1:%s-1\\\\n\\
91 - New upstream version %s.\\\\n\\
93 rm libguestfs.spec.old
94 " repodir version.version version.version version.version
96 and specfile_committed version branch =
97 let repodir = fedora_repo package branch in
98 let key = sprintf "libguestfs_fedora_specfile_committed_%s" version.version in
100 target (memory_exists key);
101 onrun (fun () -> memory_set key "1");
103 require (specfile_updated version branch);
110 and specfile_pushed version branch =
111 let repodir = fedora_repo package branch in
112 let key = sprintf "libguestfs_fedora_specfile_pushed_%s" version.version in
114 target (memory_exists key);
115 onrun (fun () -> memory_set key "1");
117 require (repodir_up_to_date repodir);
118 require (specfile_committed version branch);
125 and repodir_up_to_date repodir =
130 if not (git_has_local_changes repodir) then