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.39-development", "master"; (* Rawhide follows development. *)
26 "1.39-development", "f29"; (* F29 follows development. *)
27 "1.38-stable", "f28"; (* F28 follows 1.38. *)
28 "1.38-stable", "f27"; (* F27 follows 1.38. *)
29 "1.36-stable", "f26"; (* F26 follows 1.36. *)
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);
67 if not version.is_stable then (
70 fedpkg new-sources %s/%s
71 " repodir libguestfs_download_repo version.urlpath
75 fedpkg new-sources %s/%s %s/%s.sig
77 libguestfs_download_repo version.urlpath
78 libguestfs_download_repo version.urlpath
81 and specfile_updated version branch =
82 let repodir = fedora_repo package branch in
83 let specfile = fedora_specfile package branch in
85 target (file_contains_string specfile version.version);
87 require (repodir_up_to_date repodir);
89 (* Hairy specfile editing. *)
92 email=\"Richard W.M. Jones <rjones@redhat.com>\"
93 date=`date +\"%%a %%b %%d %%Y\"`
94 cp libguestfs.spec libguestfs.spec.old
95 sed < libguestfs.spec.old \\
96 -e \"s/^Version:.*/Version: %s/\" \\
97 -e \"s/^Release:.*/Release: 1%%{?dist}/\" \\
98 -e \"/^%%changelog/a \\
99 * $date $email - 1:%s-1\\\\n\\
100 - New upstream version %s.\\\\n\\
102 rm libguestfs.spec.old
103 " repodir version.version version.version version.version
105 and specfile_committed version branch =
106 let repodir = fedora_repo package branch in
107 let key = sprintf "libguestfs_fedora_specfile_committed_%s_%s"
108 branch version.version in
110 target (memory_exists key);
111 onrun (fun () -> memory_set key "1");
113 require (specfile_updated version branch);
120 and specfile_pushed version branch =
121 let repodir = fedora_repo package branch in
123 sprintf "libguestfs_fedora_specfile_pushed_%s_%s" branch version.version in
125 target (memory_exists key);
126 onrun (fun () -> memory_set key "1");
128 require (repodir_up_to_date repodir);
129 require (specfile_committed version branch);
136 and repodir_up_to_date repodir =
141 if not (git_has_local_changes repodir) then