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.41-development", "master"; (* Rawhide follows development. *)
26 "1.40-stable", "f31"; (* F31 follows development. *)
27 "1.40-stable", "f30"; (* F30 follows development. *)
28 "1.40-stable", "f29"; (* F29 follows development. *)
31 (* Goal: Latest website version has been built in every branch. *)
34 fun (wbranch, fbranch) ->
35 match website_latest_version wbranch with
38 require (fedora_built version fbranch)
41 (* Goal: Fedora has a successful build of 'version' on 'branch'. *)
42 and fedora_built version branch =
43 let specfile = fedora_specfile package branch in
45 target (file_contains_string specfile version.version &&
46 match koji_build_state (fedora_verrel package branch) with
47 | `Complete | `Building -> true
50 require (sources_uploaded version branch);
51 require (specfile_pushed version branch);
53 koji_build ~wait:true package branch
55 and sources_uploaded version branch =
56 let repodir = fedora_repo package branch in
57 let sources = repodir // "sources" in
58 let key = sprintf "libguestfs_fedora_sources_uploaded_%s" version.version in
60 target (file_contains_string sources version.version &&
62 onrun (fun () -> memory_set key "1");
64 require (repodir_up_to_date repodir);
66 if not version.is_stable then (
69 fedpkg new-sources %s/%s
70 " repodir libguestfs_download_repo version.urlpath
74 fedpkg new-sources %s/%s %s/%s.sig
76 libguestfs_download_repo version.urlpath
77 libguestfs_download_repo version.urlpath
80 and specfile_updated version branch =
81 let repodir = fedora_repo package branch in
82 let specfile = fedora_specfile package branch in
84 target (file_contains_string specfile version.version);
86 require (repodir_up_to_date repodir);
88 (* Hairy specfile editing. *)
91 email=\"Richard W.M. Jones <rjones@redhat.com>\"
92 date=`date +\"%%a %%b %%d %%Y\"`
93 cp libguestfs.spec libguestfs.spec.old
94 sed < libguestfs.spec.old \\
95 -e \"s/^Version:.*/Version: %s/\" \\
96 -e \"s/^Release:.*/Release: 1%%{?dist}/\" \\
97 -e \"/^%%changelog/a \\
98 * $date $email - 1:%s-1\\\\n\\
99 - New upstream version %s.\\\\n\\
101 rm libguestfs.spec.old
102 " repodir version.version version.version version.version
104 and specfile_committed version branch =
105 let repodir = fedora_repo package branch in
106 let key = sprintf "libguestfs_fedora_specfile_committed_%s_%s"
107 branch version.version in
109 target (memory_exists key);
110 onrun (fun () -> memory_set key "1");
112 require (specfile_updated version branch);
119 and specfile_pushed version branch =
120 let repodir = fedora_repo package branch in
122 sprintf "libguestfs_fedora_specfile_pushed_%s_%s" branch version.version in
124 target (memory_exists key);
125 onrun (fun () -> memory_set key "1");
127 require (repodir_up_to_date repodir);
128 require (specfile_committed version branch);
135 and repodir_up_to_date repodir =
140 if not (git_has_local_changes repodir) then