3 let fedora-dir = "%HOME/d/fedora"
6 let side-tag = "f32-build-side-999999"
8 # The magic string that must appear in %changelog when the
9 # package has been rebuilt.
10 let rebuild-name = "OCaml 4.10.0 (beta 1)"
12 # Local repository that contains build dependencies.
13 let yum-repo = "koji-rawhide"
15 # Packages that are blocked. Any dependent packages are also blocked
17 let blocked = [ "ocaml-camlp4" ]
19 # Packages that are ignored, which means they are treated as if
20 # they have been rebuilt.
21 let ignored = [ "ocaml-srpm-macros", "ocaml" ]
23 # All OCaml-related source package names
24 let other-packages = [
25 "alt-ergo", "apron", "brltty", "coccinelle", "coq",
26 "frama-c", "gappalib-coq", "graphviz", "hevea", "hivex",
27 "libguestfs", "opam", "plplot", "virt-top", "virt-v2v",
29 "flocq" # no OCaml code, but needs to be rebuilt after Coq
31 pure function get-source-packages () = {
34 for f in ocaml* %other-packages; do
35 [ -f $f/%branch/$f.spec ] && echo "*built-in-koji(\"$f\"),"
39 let source-packages = get-source-packages ()
41 # Main goal: Rebuild all packages.
42 goal all = : source-packages ;
44 # Check if the source package has been built in Koji.
45 tactic *built-in-koji (pkg) = {
46 cd %fedora-dir/%pkg/%branch
49 # Packages which are ignored are treated as if they were rebuilt already.
51 if [ %pkg = "$p" ]; then exit 0; fi
54 # If the specfile doesn't have the magic string then the
55 # package definitely needs to be rebuilt.
56 grep -sq %rebuild-name $specfile || exit 99
58 # Else we must check Koji itself.
60 buildinfo=$(koji buildinfo $nvr)
62 # No build at all, needs rebuild.
63 echo "$buildinfo" | grep -sq "No such build" && exit 99
65 # Exists a build, find out what state it is in.
66 state=$(echo "$buildinfo" | grep ^State: | awk '{print $2}')
67 taskid=$(echo "$buildinfo" | grep ^Task: | awk '{print $2}')
71 # Complete so we don't need to rebuild.
74 # Failed builds must be examined and fixed manually.
77 # Cancel the build, we will resubmit it.
84 # Don't know what happened there, so fail.
89 *built-in-koji ("%pkg") : source-dependencies (pkg) {
90 cd %fedora-dir/%pkg/%branch
93 # If the specfile doesn't have the magic string then add
95 if ! grep -sq %rebuild-name $specfile; then
96 rpmdev-bumpspec -c "- "%rebuild-name *.spec
98 rpmdev-bumpspec -c "- Bump release and rebuild." *.spec
105 # Get the source package names for a particular package.
106 # Note this is not merely the BuildRequires, since those are
107 # the binary packages. Also this will only find packages
108 # which are in the list of source-packages.
109 pure function source-dependencies (pkg) = @{
110 specfile=%fedora-dir/%pkg/%branch/%pkg.spec
112 echo -n Dependencies of %pkg: >&2
115 for r in $(rpmspec -q --buildrequires $specfile 2>/dev/null |
116 awk '{print $1}'); do
117 # Now we examine each *other* source package to see
118 # if any will create this dependency when they build.
119 for p in %source-packages; do
120 if [ "$p" != %pkg ] && \
121 rpmspec -q --provides %fedora-dir/$p/%branch/$p.spec 2>/dev/null |
125 echo "*built-in-koji(\"$p\"),"