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.33-development", "master"; (* Rawhide follows development. *)
26 "1.33-development", "f24"; (* F24 follows development, for now. *)
27 "1.32-stable", "f23"; (* F23 follows 1.32. *)
28 "1.30-stable", "f22"; (* F22 follows 1.30. *)
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);
68 fedpkg new-sources %s/%s
69 " repodir libguestfs_website_repo version.urlpath
71 and specfile_updated version branch =
72 let repodir = fedora_repo package branch in
73 let specfile = fedora_specfile package branch in
75 target (file_contains_string specfile version.version);
77 require (repodir_up_to_date repodir);
79 (* Hairy specfile editing. *)
82 email=\"Richard W.M. Jones <rjones@redhat.com>\"
83 date=`date +\"%%a %%b %%d %%Y\"`
84 cp libguestfs.spec libguestfs.spec.old
85 sed < libguestfs.spec.old \\
86 -e \"s/^Version:.*/Version: %s/\" \\
87 -e \"s/^Release:.*/Release: 1%%{?dist}/\" \\
88 -e \"/^%%changelog/a \\
89 * $date $email - 1:%s-1\\\\n\\
90 - New upstream version %s.\\\\n\\
92 rm libguestfs.spec.old
93 " repodir version.version version.version version.version
95 and specfile_committed version branch =
96 let repodir = fedora_repo package branch in
97 let key = sprintf "libguestfs_fedora_specfile_committed_%s_%s"
98 branch 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
113 sprintf "libguestfs_fedora_specfile_pushed_%s_%s" branch version.version in
115 target (memory_exists key);
116 onrun (fun () -> memory_set key "1");
118 require (repodir_up_to_date repodir);
119 require (specfile_committed version branch);
126 and repodir_up_to_date repodir =
131 if not (git_has_local_changes repodir) then