3 let fedora-dir = "%HOME/d/fedora"
6 let side-tag = "f32-ocaml"
8 let koji = "koji -p riscv64"
10 # The magic string that must appear in %changelog when the
11 # package has been rebuilt.
12 let rebuild-name = "OCaml 4.09.0 for riscv64"
14 # Packages that are blocked. Any dependent packages are also blocked
16 let blocked = [ "ocaml-camlp4" ]
18 # Packages that are ignored, which means they are treated as if
19 # they have been rebuilt.
20 #let ignored = [ "ocaml-srpm-macros", "ocaml" ]
21 let ignored = [ "ocaml-srpm-macros" ]
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 # We have to wait for the dependencies to become available
94 # before we can start the new build.
95 for p in $(%koji latest-build %< | awk '{print $1}'); do
96 %koji --quiet wait-repo side-tag
99 # If the specfile doesn't have the magic string then add
101 if ! grep -sq %rebuild-name $specfile; then
102 rpmdev-bumpspec -c "- "%rebuild-name *.spec
104 rpmdev-bumpspec -c "- Bump release and rebuild." *.spec
108 if [ %koji = "koji" ]; then
111 hash=$(git rev-parse HEAD)
112 %koji build "git+https://src.fedoraproject.org/rpms/"%pkg".git#$hash" %side-tag
116 # Get the source package names for a particular package.
117 # Note this is not merely the BuildRequires, since those are
118 # the binary packages. Also this will only find packages
119 # which are in the list of source-packages.
120 pure function source-dependencies (pkg) = @{
121 specfile=%fedora-dir/%pkg/%branch/%pkg.spec
123 echo -n Dependencies of %pkg: >&2
126 for r in $(rpmspec -q --buildrequires $specfile 2>/dev/null |
127 awk '{print $1}'); do
128 # Now we examine each *other* source package to see
129 # if any will create this dependency when they build.
130 for p in %source-packages; do
131 if [ "$p" != %pkg ] && \
132 rpmspec -q --provides %fedora-dir/$p/%branch/$p.spec 2>/dev/null |
136 echo "*built-in-koji(\"$p\"),"