- for f in ocaml* %other-packages; do
- [ -f $f/%branch/$f.spec ] && echo "$f"
- done
-}
-let source-packages = wrap ("*built-in-koji", get-source-packages ())
-
-# Main goal: Rebuild all packages.
-goal all = : source-packages ;
-
-# Check if the source package has been built in Koji.
-tactic *built-in-koji (pkg) = {
- cd %fedora-dir/%pkg/%branch
- koji=%koji
- specfile=%pkg.spec
-
- # Packages which are ignored are treated as if they were rebuilt already.
- for p in %ignored; do
- if [ %pkg = "$p" ]; then exit 0; fi
- done
-
- # If the specfile doesn't have the magic string then the
- # package definitely needs to be rebuilt.
- grep -sq %rebuild-name $specfile || exit 99
-
- # Else we must check Koji itself.
- # Koji sends some messages to stderr.
- nvr=$(fedpkg verrel)
- buildinfo=$($koji buildinfo $nvr 2>&1 ||:)
-
- # No build at all, needs rebuild.
- echo "$buildinfo" | grep -sq "No such build" && exit 99
-
- # Exists a build, find out what state it is in.
- state=$(echo "$buildinfo" | grep ^State: | awk '{print $2}')
- taskid=$(echo "$buildinfo" | grep ^Task: | awk '{print $2}')
-
- case "$state" in
- COMPLETE)
- # Complete so we don't need to rebuild.
- exit 0 ;;
- FAILED)
- # Failed builds must be examined and fixed manually.
- exit 1 ;;
- BUILDING)
- # Cancel the build, we will resubmit it.
- $koji cancel $taskid ||:
- exit 99 ;;
- CANCELED|DELETED)
- # Do a rebuild.
- exit 99 ;;
- esac
- # Don't know what happened there, so fail.
- exit 1
-}
-
-goal rebuild (pkg) =
-*built-in-koji ("%pkg") : wrap ("*built-in-koji", source-dependencies (pkg)) {
- cd %fedora-dir/%pkg/%branch
- fedpkg=%fedpkg
- koji=%koji
- specfile=%pkg.spec
-
- # We have to wait for the dependencies to become available
- # before we can start the new build.
- for p in %<; do
- nvr=$($koji --quiet latest-build %side-tag $p | awk '{print $1}')
- $koji wait-repo %side-tag --build=$nvr