Do a git pull before bumping local version.
[fedora-ocaml-rebuild.git] / Goalfile
index e0c9434..cafef1d 100644 (file)
--- a/Goalfile
+++ b/Goalfile
@@ -6,6 +6,8 @@ let branch = "master"
 let side-tag = "f32-ocaml"
 #let koji = "koji"
 let koji = "koji -p riscv64"
+#let fedpkg = "fedpkg"
+let fedpkg = "fedpkg --user-config %HOME/d/fedora-ocaml-rebuild/fedpkg-user-config"
 
 # The magic string that must appear in %changelog when the
 # package has been rebuilt.
@@ -13,12 +15,29 @@ let rebuild-name = "OCaml 4.09.0 for riscv64"
 
 # Packages that are blocked.  Any dependent packages are also blocked
 # automatically.
-let blocked = [ "ocaml-camlp4" ]
+# XXX Not implemented, use ignore for now.
+#let 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 ignored = [ "ocaml-srpm-macros" ]
+let ignored = [ "ocaml-srpm-macros", "ocaml",
+    # These ones are only needed because blocked is not working
+    "ocaml-camlp4",
+    "cduce",
+    "guestfs-browser",
+    "ocaml-bin-prot",
+    "ocaml-bisect",
+    "ocaml-bitstring",
+    "ocaml-deriving",
+    "ocaml-json-static",
+    "ocaml-mikmatch",
+    "ocaml-openin",
+    "ocaml-pa-monad",
+    "ocaml-pgocaml",
+    "ocaml-sexplib",
+    "ocaml-type-conv",
+    "ocamldsort",
+]
 
 # All OCaml-related source package names
 let other-packages = [
@@ -44,6 +63,7 @@ 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.
@@ -56,8 +76,9 @@ tactic *built-in-koji (pkg) = {
     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)
+    buildinfo=$($koji buildinfo $nvr 2>&1 ||:)
 
     # No build at all, needs rebuild.
     echo "$buildinfo" | grep -sq "No such build" && exit 99
@@ -75,7 +96,7 @@ tactic *built-in-koji (pkg) = {
         exit 1 ;;
     BUILDING)
         # Cancel the build, we will resubmit it.
-        %koji cancel $taskid
+        $koji cancel $taskid ||:
         exit 99 ;;
     CANCELED|DELETED)
         # Do a rebuild.
@@ -88,14 +109,22 @@ tactic *built-in-koji (pkg) = {
 goal rebuild (pkg) =
 *built-in-koji ("%pkg") : 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 $(%koji latest-build %< | awk '{print $1}'); do
-        %koji --quiet wait-repo side-tag
+    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
@@ -103,14 +132,9 @@ goal rebuild (pkg) =
     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
+    $fedpkg commit -c
+    $fedpkg push
+    $fedpkg build --target %side-tag
 }
 
 # Get the source package names for a particular package.
@@ -120,7 +144,7 @@ goal rebuild (pkg) =
 pure function source-dependencies (pkg) = @{
     specfile=%fedora-dir/%pkg/%branch/%pkg.spec
 
-    echo -n Dependencies of %pkg: >&2
+    echo Calculating dependencies of %pkg >&2
 
     echo '['
     for r in $(rpmspec -q --buildrequires $specfile 2>/dev/null |
@@ -134,10 +158,8 @@ pure function source-dependencies (pkg) = @{
                  grep -sq "^$r\$"
              then
                  echo "*built-in-koji(\"$p\"),"
-                 echo -n '' $p >&2
             fi
         done
     done
     echo ']'
-    echo >&2
 }