3 let fedora-dir = "%HOME/d/fedora"
6 let side-tag = "f32-build-side-999999"
9 # The magic string that must appear in %changelog when the
10 # package has been rebuilt.
11 let rebuild-name = "OCaml 4.10.0 (beta 1)"
13 # Packages that are blocked. Any dependent packages are also blocked
15 let blocked = [ "ocaml-camlp4" ]
17 # Packages that are ignored, which means they are treated as if
18 # they have been rebuilt.
19 let ignored = [ "ocaml-srpm-macros", "ocaml" ]
21 # All OCaml-related source package names
22 let other-packages = [
23 "alt-ergo", "apron", "brltty", "coccinelle", "coq",
24 "frama-c", "gappalib-coq", "graphviz", "hevea", "hivex",
25 "libguestfs", "opam", "plplot", "virt-top", "virt-v2v",
27 "flocq" # no OCaml code, but needs to be rebuilt after Coq
29 pure function get-source-packages () = {
32 for f in ocaml* %other-packages; do
33 [ -f $f/%branch/$f.spec ] && echo "*built-in-koji(\"$f\"),"
37 let source-packages = get-source-packages ()
39 # Main goal: Rebuild all packages.
40 goal all = : source-packages ;
42 # Check if the source package has been built in Koji.
43 tactic *built-in-koji (pkg) = {
44 cd %fedora-dir/%pkg/%branch
47 # Packages which are ignored are treated as if they were rebuilt already.
49 if [ %pkg = "$p" ]; then exit 0; fi
52 # If the specfile doesn't have the magic string then the
53 # package definitely needs to be rebuilt.
54 grep -sq %rebuild-name $specfile || exit 99
56 # Else we must check Koji itself.
58 buildinfo=$(%koji buildinfo $nvr)
60 # No build at all, needs rebuild.
61 echo "$buildinfo" | grep -sq "No such build" && exit 99
63 # Exists a build, find out what state it is in.
64 state=$(echo "$buildinfo" | grep ^State: | awk '{print $2}')
65 taskid=$(echo "$buildinfo" | grep ^Task: | awk '{print $2}')
69 # Complete so we don't need to rebuild.
72 # Failed builds must be examined and fixed manually.
75 # Cancel the build, we will resubmit it.
82 # Don't know what happened there, so fail.
87 *built-in-koji ("%pkg") : source-dependencies (pkg) {
88 cd %fedora-dir/%pkg/%branch
91 # We have to wait for the dependencies to become available
92 # before we can start the new build.
93 for p in $(%koji latest-build %< | awk '{print $1}'); do
94 %koji --quiet wait-repo side-tag
97 # If the specfile doesn't have the magic string then add
99 if ! grep -sq %rebuild-name $specfile; then
100 rpmdev-bumpspec -c "- "%rebuild-name *.spec
102 rpmdev-bumpspec -c "- Bump release and rebuild." *.spec
106 if [ %koji = "koji" ]; then
109 hash=$(git rev-parse HEAD)
110 %koji build "git+https://src.fedoraproject.org/rpms/"%pkg".git#$hash" %side-tag
114 # Get the source package names for a particular package.
115 # Note this is not merely the BuildRequires, since those are
116 # the binary packages. Also this will only find packages
117 # which are in the list of source-packages.
118 pure function source-dependencies (pkg) = @{
119 specfile=%fedora-dir/%pkg/%branch/%pkg.spec
121 echo -n Dependencies of %pkg: >&2
124 for r in $(rpmspec -q --buildrequires $specfile 2>/dev/null |
125 awk '{print $1}'); do
126 # Now we examine each *other* source package to see
127 # if any will create this dependency when they build.
128 for p in %source-packages; do
129 if [ "$p" != %pkg ] && \
130 rpmspec -q --provides %fedora-dir/$p/%branch/$p.spec 2>/dev/null |
134 echo "*built-in-koji(\"$p\"),"