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.36-stable", "f26"; (* F26 follows 1.36. *)*)
27 "1.36-stable", "f25"; (* F25 follows 1.36. *)
28 "1.34-stable", "f24"; (* F24 follows 1.34. *)
29 "1.32-stable", "f23"; (* F23 follows 1.32. *)
30 "1.30-stable", "f22"; (* F22 follows 1.30. *)
33 (* Goal: Latest website version has been built in every branch. *)
36 fun (wbranch, fbranch) ->
37 match website_latest_version wbranch with
40 require (fedora_built version fbranch)
43 (* Goal: Fedora has a successful build of 'version' on 'branch'. *)
44 and fedora_built version branch =
45 let specfile = fedora_specfile package branch in
47 target (file_contains_string specfile version.version &&
48 match koji_build_state (fedora_verrel package branch) with
49 | `Complete | `Building -> true
52 require (sources_uploaded version branch);
53 require (specfile_pushed version branch);
55 koji_build ~wait:true package branch
57 and sources_uploaded version branch =
58 let repodir = fedora_repo package branch in
59 let sources = repodir // "sources" in
60 let key = sprintf "libguestfs_fedora_sources_uploaded_%s" version.version in
62 target (file_contains_string sources version.version &&
64 onrun (fun () -> memory_set key "1");
66 require (repodir_up_to_date repodir);
70 fedpkg new-sources %s/%s
71 " repodir libguestfs_website_repo version.urlpath
73 and specfile_updated version branch =
74 let repodir = fedora_repo package branch in
75 let specfile = fedora_specfile package branch in
77 target (file_contains_string specfile version.version);
79 require (repodir_up_to_date repodir);
81 (* Hairy specfile editing. *)
84 email=\"Richard W.M. Jones <rjones@redhat.com>\"
85 date=`date +\"%%a %%b %%d %%Y\"`
86 cp libguestfs.spec libguestfs.spec.old
87 sed < libguestfs.spec.old \\
88 -e \"s/^Version:.*/Version: %s/\" \\
89 -e \"s/^Release:.*/Release: 1%%{?dist}/\" \\
90 -e \"/^%%changelog/a \\
91 * $date $email - 1:%s-1\\\\n\\
92 - New upstream version %s.\\\\n\\
94 rm libguestfs.spec.old
95 " repodir version.version version.version version.version
97 and specfile_committed version branch =
98 let repodir = fedora_repo package branch in
99 let key = sprintf "libguestfs_fedora_specfile_committed_%s_%s"
100 branch version.version in
102 target (memory_exists key);
103 onrun (fun () -> memory_set key "1");
105 require (specfile_updated version branch);
112 and specfile_pushed version branch =
113 let repodir = fedora_repo package branch in
115 sprintf "libguestfs_fedora_specfile_pushed_%s_%s" branch version.version in
117 target (memory_exists key);
118 onrun (fun () -> memory_set key "1");
120 require (repodir_up_to_date repodir);
121 require (specfile_committed version branch);
128 and repodir_up_to_date repodir =
133 if not (git_has_local_changes repodir) then