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.37-development", "master"; (* Rawhide follows development. *)
26 "1.37-development", "f27"; (* F27 follows development. *)
27 "1.36-stable", "f26"; (* F26 follows 1.36. *)
28 "1.36-stable", "f25"; (* F25 follows 1.36. *)
29 "1.34-stable", "f24"; (* F24 follows 1.34. *)
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_download_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_%s"
99 branch version.version in
101 target (memory_exists key);
102 onrun (fun () -> memory_set key "1");
104 require (specfile_updated version branch);
111 and specfile_pushed version branch =
112 let repodir = fedora_repo package branch in
114 sprintf "libguestfs_fedora_specfile_pushed_%s_%s" branch version.version in
116 target (memory_exists key);
117 onrun (fun () -> memory_set key "1");
119 require (repodir_up_to_date repodir);
120 require (specfile_committed version branch);
127 and repodir_up_to_date repodir =
132 if not (git_has_local_changes repodir) then