stdlib: Fix detection of already build package when rpmautospec
authorRichard W.M. Jones <rjones@redhat.com>
Tue, 24 Jan 2023 15:36:33 +0000 (15:36 +0000)
committerRichard W.M. Jones <rjones@redhat.com>
Tue, 24 Jan 2023 15:36:33 +0000 (15:36 +0000)
Fixes: commit dc1c16833922b20e6949058a3813a595bb89194b

stdlib/fedora.gl

index 5dca4d9..ef515c6 100644 (file)
@@ -56,9 +56,14 @@ predicate is-koji-built (pkg) = {
         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 %fedora-rebuild-name $specfile || exit 99
+    if ! grep -sq "^%%autochangelog" $specfile; then
+        # If the specfile doesn't have the magic string then the
+        # package definitely needs to be rebuilt.
+        grep -sq %fedora-rebuild-name $specfile || exit 99
+    else
+        # Using autochangelog.
+        git log | grep -sq %fedora-rebuild-name || exit 99
+    fi
 
     # Else we must check Koji itself.
     # Koji sends some messages to stderr.