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 # Packages that are blocked. Any dependent packages are also blocked
14 let blocked = [ "ocaml-camlp4" ]
16 # Packages that are ignored, which means they are treated as if
17 # they have been rebuilt.
18 let ignored = [ "ocaml-srpm-macros", "ocaml" ]
20 # All OCaml-related source package names
21 let other-packages = [
22 "alt-ergo", "apron", "brltty", "coccinelle", "coq",
23 "frama-c", "gappalib-coq", "graphviz", "hevea", "hivex",
24 "libguestfs", "opam", "plplot", "virt-top", "virt-v2v",
26 "flocq" # no OCaml code, but needs to be rebuilt after Coq
28 pure function get-source-packages () = {
31 for f in ocaml* %other-packages; do
32 [ -f $f/%branch/$f.spec ] && echo "*built-in-koji(\"$f\"),"
36 let source-packages = get-source-packages ()
38 # Main goal: Rebuild all packages.
39 goal all = : source-packages ;
41 # Check if the source package has been built in Koji.
42 tactic *built-in-koji (pkg) = {
43 cd %fedora-dir/%pkg/%branch
46 # Packages which are ignored are treated as if they were rebuilt already.
48 if [ %pkg = "$p" ]; then exit 0; fi
51 # If the specfile doesn't have the magic string then the
52 # package definitely needs to be rebuilt.
53 grep -sq %rebuild-name $specfile || exit 99
55 # Else we must check Koji itself.
57 buildinfo=$(koji buildinfo $nvr)
59 # No build at all, needs rebuild.
60 echo "$buildinfo" | grep -sq "No such build" && exit 99
62 # Exists a build, find out what state it is in.
63 state=$(echo "$buildinfo" | grep ^State: | awk '{print $2}')
64 taskid=$(echo "$buildinfo" | grep ^Task: | awk '{print $2}')
68 # Complete so we don't need to rebuild.
71 # Failed builds must be examined and fixed manually.
74 # Cancel the build, we will resubmit it.
81 # Don't know what happened there, so fail.
86 *built-in-koji ("%pkg") : source-dependencies (pkg) {
87 cd %fedora-dir/%pkg/%branch
90 # If the specfile doesn't have the magic string then add
92 if ! grep -sq %rebuild-name $specfile; then
93 rpmdev-bumpspec -c "- "%rebuild-name *.spec
95 rpmdev-bumpspec -c "- Bump release and rebuild." *.spec
102 # Get the source package names for a particular package.
103 # Note this is not merely the BuildRequires, since those are
104 # the binary packages. Also this will only find packages
105 # which are in the list of source-packages.
106 pure function source-dependencies (pkg) = @{
107 specfile=%fedora-dir/%pkg/%branch/%pkg.spec
109 echo -n Dependencies of %pkg: >&2
112 for r in $(rpmspec -q --buildrequires $specfile 2>/dev/null |
113 awk '{print $1}'); do
114 # Now we examine each *other* source package to see
115 # if any will create this dependency when they build.
116 for p in %source-packages; do
117 if [ "$p" != %pkg ] && \
118 rpmspec -q --provides %fedora-dir/$p/%branch/$p.spec 2>/dev/null |
122 echo "*built-in-koji(\"$p\"),"