X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=Goalfile;h=35909e0987af4191cd3150320700d8cfcfaf2b6f;hb=3a10c0c2da969efc3b9b3aa153aac7dcc673c0fe;hp=2961971ffb4e77eb3e31f2c798099500189c4495;hpb=63839acb139d5381ee4615a7f467db9521e4305a;p=fedora-ocaml-rebuild.git diff --git a/Goalfile b/Goalfile index 2961971..35909e0 100644 --- a/Goalfile +++ b/Goalfile @@ -1,9 +1,11 @@ # See README. +include "fedora.gl" + let fedora-dir = "%HOME/d/fedora" -let branch = "master" -let side-tag = "f32-build-side-18015" +let fedora-branch = "master" +let fedora-tag = "f32-build-side-18015" let koji = "koji" #let koji = "koji -p riscv64" let fedpkg = "fedpkg" @@ -11,16 +13,16 @@ let fedpkg = "fedpkg" # The magic string that must appear in %changelog when the # package has been rebuilt. -let rebuild-name = "OCaml 4.10.0+beta1 rebuild." +let fedora-rebuild-name = "OCaml 4.10.0+beta1 rebuild." # Packages that are blocked. Any dependent packages are also blocked # automatically. # XXX Not implemented, use ignore for now. -#let blocked = [ "ocaml-camlp4" ] +#let fedora-blocked = [ "ocaml-camlp4" ] # Packages that are ignored, which means they are treated as if # they have been rebuilt. -let ignored = [ "ocaml-srpm-macros", "ocaml", +let fedora-ignored = [ "ocaml-srpm-macros", "ocaml", # These ones are only needed because blocked is not working "ocaml-camlp4", "cduce", @@ -51,112 +53,10 @@ let other-packages = [ pure function get-source-packages () returning strings = { cd %fedora-dir for f in ocaml* %other-packages; do - [ -f $f/%branch/$f.spec ] && echo "$f" + [ -f $f/%fedora-branch/$f.spec ] && echo "$f" done } -let source-packages = wrap ("*koji-built", get-source-packages ()) +let fedora-source-packages = get-source-packages () # Main goal: Rebuild all packages. -goal all = : source-packages ; - -# Check if the source package has been built in Koji. -tactic *koji-built (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) = -*koji-built ("%pkg") : wrap ("*koji-built", 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 - done - - # Make sure the local directory is up to date. - # This should also fail if there are local changes, which - # would need to be corrected/integrated by hand. - git pull - - # 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 - $fedpkg build --target %side-tag -} - -# 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) returning strings = @{ - specfile=%fedora-dir/%pkg/%branch/%pkg.spec - - echo Calculating dependencies of %pkg >&2 - - 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 "$p" - fi - done - done -} +goal all = : wrap ("*koji-built", fedora-source-packages)