+ target (ignored pkg ||
+ (file_contains_string specfile rebuild_name &&
+ koji_build_state (fedora_verrel pkg branch) == `Complete));
+
+ (* Ignored packages are treated as if they have been rebuilt. *)
+ if not (ignored pkg) then (
+
+ (* Start the rebuild. *)
+ require (rebuild_started pkg);
+
+ (* Wait for the build state to reach a conclusion. *)
+ let rec loop () =
+ match koji_build_state (fedora_verrel pkg branch) with
+ | `No_such_build ->
+ failwith (sprintf "rebuild of package %s: no build found" pkg)
+ | `Building ->
+ sleep 60;
+ loop ()
+ | `Complete ->
+ ()
+ | `Deleted ->
+ failwith (sprintf "rebuild of package %s: deleted" pkg)
+ | `Failed ->
+ failwith (sprintf "rebuild of package %s: failed" pkg)
+ | `Canceled ->
+ failwith (sprintf "rebuild of package %s: canceled" pkg)
+ in
+ loop ();
+
+ (* Wait for the build to appear in Koji repo. *)
+ koji_wait_repo koji_target (fedora_verrel pkg branch)
+ )
+
+(* Goal: The rebuild of the package has started, but we haven't waited
+ * for it to finish.
+ *)
+and rebuild_started pkg =
+ let deps = List.assoc pkg pkg_deps in
+ let specfile = fedora_specfile pkg branch in