1 (* Perform a complete Fedora OCaml rebuild, in build order. *)
11 let koji_target = "rawhide"
13 (* The name of the rebuild, and also the magic substring that must
14 * appear in the %changelog when the package has been rebuilt.
16 let rebuild_name = "OCaml 4.01.0"
18 (* Packages that have problems or we just don't want to build. *)
20 "ocaml-libvirt"; (* RHBZ#1009701 *)
21 "ocaml-lwt"; "ocaml-react"; (* loganjerry is handling *)
24 (* List of OCaml-related source package names. *)
26 let dirs = shlines "cd %s && ls -1d ocaml*" fedora_dir in
27 dirs @ [ "alt-ergo"; "apron"; "brltty"; "coccinelle"; "coq";
28 "cduce"; "frama-c"; "gappalib-coq"; "graphviz"; "hivex";
29 "js-of-ocaml"; "llvm"; "plplot"; "whenjobs"; "why3"; "xen" ]
32 List.filter (fun pkg -> not (List.mem pkg blocked)) source_packages
34 (* Dependencies of each package. (pkg, [deps ...]) *)
35 let pkg_deps = dependencies branch source_packages
37 (* Goal: rebuild all packages. *)
39 List.iter (fun pkg -> require (rebuild_started pkg)) source_packages
41 (* Goal: That 'package' has been rebuilt and exists in Koji. *)
43 let specfile = fedora_specfile pkg branch in
45 (* Note: verrel may change as we go along, so don't assign it to
49 (* Note the target must be both of these because the old verrel
50 * could exist as a koji build without it having been part of the
53 target (file_contains_string specfile rebuild_name &&
54 koji_build_state (fedora_verrel pkg branch) == `Complete);
56 (* Start the rebuild. *)
57 require (rebuild_started pkg);
59 (* Wait for the build state to reach a conclusion. *)
61 match koji_build_state (fedora_verrel pkg branch) with
68 failwith (sprintf "rebuild of package %s: deleted" pkg)
70 failwith (sprintf "rebuild of package %s: failed" pkg)
72 failwith (sprintf "rebuild of package %s: canceled" pkg)
76 (* Wait for the build to appear in Koji repo. *)
77 koji_wait_repo koji_target (fedora_verrel pkg branch)
79 (* Goal: The rebuild of the package has started, but we haven't waited
82 and rebuild_started pkg =
83 let deps = List.assoc pkg pkg_deps in
84 let specfile = fedora_specfile pkg branch in
86 (* Note the target must be both of these because the old verrel
87 * could exist as a koji build without it having been part of the
90 target (file_contains_string specfile rebuild_name &&
91 (match koji_build_state (fedora_verrel pkg branch) with
92 | `Building | `Complete -> true
93 | `Deleted | `Failed | `Canceled -> false));
95 (* All dependent packages must have been fully rebuilt and in the
98 List.iter (fun dep -> require (rebuilt dep)) deps;
100 (* A local test build must succeed. *)
101 require (local_build_succeeded pkg);
103 (* Rebuild the package in Koji, but don't wait. *)
104 koji_build ~wait:false pkg branch
106 and local_build_succeeded pkg =
107 (* The specfile must have been updated. *)
108 require (specfile_updated pkg);
111 sprintf "fedora_ocaml_local_build_%s_%s" pkg (fedora_verrel pkg branch) in
113 target (memory_exists key);
115 (* Do a local test build to ensure the Koji build will work. *)
120 " (fedora_repo pkg branch)
121 (fedora_specfile pkg branch);
125 and specfile_updated pkg =
126 let repodir = fedora_repo pkg branch in
127 let specfile = fedora_specfile pkg branch in
129 (* XXX Automate common changes. *)
130 let title = rebuild_name ^ " rebuild." in
134 rm -rf x86_64 noarch *.src.rpm
135 rpmdev-bumpspec -c %s %s
136 echo 'Please make further changes as required to the spec file %s.spec'
137 echo '(Press return key)'
140 echo 'OK to commit this change? (press ^C if not)'
143 echo 'OK to push this change? (press ^C if not)'
147 (quote title) specfile