X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=stdlib%2Ffedora.gl;h=ada6a40e109d256fbc827f6065e95d22c0b8e911;hb=830b616204b3c08429440381349c86c8073ac161;hp=32e19228ad0e5c4669cf1822f605c1158d01be28;hpb=69f0ac6d4b9a1fd1b2985cefe95d4f06d55004f3;p=goals.git diff --git a/stdlib/fedora.gl b/stdlib/fedora.gl index 32e1922..ada6a40 100644 --- a/stdlib/fedora.gl +++ b/stdlib/fedora.gl @@ -50,8 +50,8 @@ # Check if the source package has been built in Koji. -tactic *koji-built (pkg) = { - cd %fedora-dir/%pkg/%branch +predicate is-koji-built (pkg) = { + cd %fedora-dir/%pkg/%fedora-branch koji=%koji specfile=%pkg.spec @@ -98,7 +98,8 @@ 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 @@ -133,22 +134,32 @@ 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 binpkgs + for p in %fedora-source-packages; do + binpkgs[$p]="$( + rpmspec -q --provides %fedora-dir/$p/%fedora-branch/$p.spec 2>/dev/null | + awk '{print $1}' + )" + done 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 %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" + if [ "$p" != %pkg ]; then + for f in ${binpkgs[$p]}; do + if [ "$f" = "$r" ]; then + echo "$p" + fi + done fi done - done + done | sort -u }