- # 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") : source-dependencies (pkg) {
- cd %fedora-dir/%pkg/%branch
- 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 $($koji latest-build %< | awk '{print $1}'); do
- $koji --quiet wait-repo side-tag
- done
-
- # If the specfile doesn't have the magic string then add
- # that now.
- if ! grep -sq %rebuild-name $specfile; then
- rpmdev-bumpspec -c "- "%rebuild-name *.spec
- else
- rpmdev-bumpspec -c "- Bump release and rebuild." *.spec
- fi
- fedpkg commit -c
- fedpkg push
- if [ "$koji" = "koji" ]; then
- fedpkg build
- else
- hash=$(git rev-parse HEAD)
- $koji build "git+https://src.fedoraproject.org/rpms/"%pkg".git#$hash" %side-tag
- fi
- exit 1
-}
-
-# Get the source package names for a particular package.
-# Note this is not merely the BuildRequires, since those are
-# the binary packages. Also this will only find packages
-# which are in the list of source-packages.
-pure function source-dependencies (pkg) = @{
- specfile=%fedora-dir/%pkg/%branch/%pkg.spec
-
- echo -n Dependencies of %pkg: >&2
-
- echo '['
- for r in $(rpmspec -q --buildrequires $specfile 2>/dev/null |
- awk '{print $1}'); do
- # Now we examine each *other* source package to see
- # if any will create this dependency when they build.
- for p in %source-packages; do
- if [ "$p" != %pkg ] && \
- rpmspec -q --provides %fedora-dir/$p/%branch/$p.spec 2>/dev/null |
- awk '{print $1}' |
- grep -sq "^$r\$"
- then
- echo "*built-in-koji(\"$p\"),"
- echo -n '' $p >&2
+# Get the list of source packages.
+pure function get-source-packages () returning strings = {
+ cd %fedora-dir
+ for pkg in %packages; do
+ spec=$pkg/%fedora-branch/$pkg.spec
+ if [ -f $spec ]; then
+ # Check that all spec files have disabled the broken
+ # "package notes" misfeature.
+ if ! grep -sq "%%undefine _package_note_flags" $spec ; then
+ echo "ERROR: $pkg does not %%undefine _package_note_flags"
+ exit 1