X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=stdlib%2Ffedora.gl;h=cb518bc7ab12785b6454a0c4b7b079f32d464b59;hb=4a0f02d061d551fbf3275ca4a82f0cf94f16eee5;hp=21450c71463e342aa3ea5b1e902e00052431cf14;hpb=5a456c968ee7e7bbe477ae4e756967c4aa2e3fc1;p=goals.git diff --git a/stdlib/fedora.gl b/stdlib/fedora.gl index 21450c7..cb518bc 100644 --- a/stdlib/fedora.gl +++ b/stdlib/fedora.gl @@ -26,7 +26,7 @@ # of dist git. You must use the fedpkg clone -B command to # create separate branches. # -# %fedora-branch: Working branch, eg. "master". +# %fedora-branch: Working branch, eg. "rawhide". # %fedora-tag: Build tag, eg. "f32-build". # # %fedora-rebuild-name: @@ -44,15 +44,11 @@ # %fedora-blocked: # List of packages which are blocked. Any dependent packages are # also blocked. XXX NOT IMPLEMENTED -# -# %koji: Name of koji binary, usually "koji". -# %fedpkg: Name of fedpkg binary, usually "fedpkg". # Check if the source package has been built in Koji. -tactic *koji-built (pkg) = { +predicate is-koji-built (pkg) = { cd %fedora-dir/%pkg/%fedora-branch - koji=%koji specfile=%pkg.spec # Packages which are ignored are treated as if they were rebuilt already. @@ -67,7 +63,7 @@ tactic *koji-built (pkg) = { # Else we must check Koji itself. # Koji sends some messages to stderr. nvr=$(fedpkg verrel) - buildinfo=$($koji buildinfo $nvr 2>&1 ||:) + buildinfo=$(koji buildinfo $nvr 2>&1 ||:) # No build at all, needs rebuild. echo "$buildinfo" | grep -sq "No such build" && exit 99 @@ -85,7 +81,7 @@ tactic *koji-built (pkg) = { exit 1 ;; BUILDING) # Cancel the build, we will resubmit it. - $koji cancel $taskid ||: + koji cancel $taskid ||: exit 99 ;; CANCELED|DELETED) # Do a rebuild. @@ -98,17 +94,16 @@ tactic *koji-built (pkg) = { # Rebuild a Fedora package. This rebuilds any dependencies first. goal fedora-rebuild (pkg) = -*koji-built ("%pkg") : wrap ("*koji-built", fedora-source-dependencies (pkg)) { +is-koji-built ("%pkg") : + wrap ("is-koji-built", fedora-source-dependencies (pkg)) { cd %fedora-dir/%pkg/%fedora-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 %fedora-tag $p | awk '{print $1}') - $koji wait-repo %fedora-tag --build=$nvr + nvr=$(koji --quiet latest-build %fedora-tag $p | awk '{print $1}') + while ! koji wait-repo --timeout=10000 %fedora-tag --build=$nvr; do sleep 1m; done done # Make sure the local directory is up to date. @@ -116,16 +111,25 @@ goal fedora-rebuild (pkg) = # would need to be corrected/integrated by hand. git pull + # If we're not building for Rawhide then we must use the rightmost + # (-r) flag so there's an upgrade path to Rawhide. + rightmost= + if test %fedora-branch != "rawhide"; then rightmost=-r; fi + # If the specfile doesn't have the magic string then add # that now. if ! grep -sq %fedora-rebuild-name $specfile; then - rpmdev-bumpspec -c "- "%fedora-rebuild-name *.spec + rpmdev-bumpspec -c "- "%fedora-rebuild-name $rightmost *.spec else - rpmdev-bumpspec -c "- Bump release and rebuild." *.spec + rpmdev-bumpspec -c "- Bump release and rebuild." $rightmost *.spec fi - $fedpkg commit -c - $fedpkg push - $fedpkg build --target %fedora-tag + + # Commit and push the change. + fedpkg commit -c + fedpkg push + + # Do the Koji build in the side tag. + fedpkg build --target %fedora-tag } # Get the source package names for a particular package. @@ -133,22 +137,28 @@ goal fedora-rebuild (pkg) = # the binary packages. Also this will only find packages # which are in the list of fedora-source-packages. pure function fedora-source-dependencies (pkg) returning strings = @{ + echo Calculating dependencies of %pkg >&2 + specfile=%fedora-dir/%pkg/%fedora-branch/%pkg.spec - echo Calculating dependencies of %pkg >&2 + # We will require the mapping of all source packages to the + # list of binary packages they build, so work this out in advance. + declare -A bin2src + for p in %fedora-source-packages; do + p_specfile=%fedora-dir/$p/%fedora-branch/$p.spec + p_depcache=%fedora-dir/$p/%fedora-branch/.depcache + if ! test -f $p_depcache || test $p_specfile -nt $p_depcache; then + rm -f $p_depcache + for b in $(rpmspec -q --provides $p_specfile 2>/dev/null | awk '{print $1}'); do + echo "bin2src['$b']='$p'" >> $p_depcache + done + fi + source $p_depcache + done - for r in $(rpmspec -q --buildrequires $specfile 2>/dev/null | + for b 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 %fedora-source-packages; do - if [ "$p" != %pkg ] && \ - rpmspec -q --provides %fedora-dir/$p/%fedora-branch/$p.spec 2>/dev/null | - awk '{print $1}' | - grep -sq "^$r\$" - then - echo "$p" - fi - done - done + # Find the source package that produces these binary requirements. + echo ${bin2src[$b]} + done | grep -v '^$' | sort -u }