public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/golang] rawhide: Update packit workflow and remove F42
@ 2026-06-03 15:40 
  0 siblings, 0 replies; only message in thread
From:  @ 2026-06-03 15:40 UTC (permalink / raw)
  To: git-commits

            A new commit has been pushed.

            Repo   : rpms/golang
            Branch : rawhide
            Commit : 0c2c202f233543f23661a6d945faa4267e468a12
            Author : Alejandro Sáez <asm@redhat.com>
            Date   : 2026-06-03T17:39:35+02:00
            Stats  : +120/-7 in 2 file(s)
            URL    : https://src.fedoraproject.org/rpms/golang/c/0c2c202f233543f23661a6d945faa4267e468a12?branch=rawhide

            Log:
            Update packit workflow and remove F42

Until this point, packit didn't handle the Provides section of the
specfile.

Now it will run update-bundled-provides.sh as part of the update
process. I was only able to test this with a very small set of changes
so it might not be ready. Also my knowledge of AWK is very limited.

---
diff --git a/.packit.yaml b/.packit.yaml
index 23ccf82..9aaca23 100644
--- a/.packit.yaml
+++ b/.packit.yaml
@@ -10,15 +10,10 @@ upstream_tag_template: go{version}
 actions:
   changelog-entry:
     - bash -c "echo - New release ${PACKIT_PROJECT_VERSION}"
+  fix-spec-file:
+    - bash -c "cd $PACKIT_DOWNSTREAM_REPO && ./update-bundled-provides.sh golang.spec"
 
 jobs:
-  # Fedora 42 follows Go 1.25
-  # https://pagure.io/fesco/issue/3570
-  - job: pull_from_upstream
-    trigger: release
-    dist_git_branches: fedora-42
-    upstream_tag_include: "^go1.25.+"
-
   # Fedora 43 follows Go 1.25
   - job: pull_from_upstream
     trigger: release

diff --git a/update-bundled-provides.sh b/update-bundled-provides.sh
new file mode 100755
index 0000000..3e55a73
--- /dev/null
+++ b/update-bundled-provides.sh
@@ -0,0 +1,118 @@
+#!/bin/bash
+# update-bundled-provides.sh - Automate bundled dependency updates for golang package
+#
+# This script automates the workflow of extracting Go sources, running
+# bundled-deps.sh, and updating the bundled provides section in golang.spec.
+# It's designed to work both in Packit automation and as a manual tool for
+# maintainers of this package. It's clearly not package agnostic. Please use
+# with caution.
+#
+# Usage: ./update-bundled-provides.sh [SPEC_FILE]
+#
+# Copyright (C) 2026 Alejandro Sáez
+# License: GPLv2+
+
+set -euo pipefail
+
+SPEC_FILE="${1:-golang.spec}"
+MARKER="# Bundled/Vendored provides generated by bundled-deps.sh"
+
+# Step 1: Check if sources are extracted by looking for modules.txt files
+if ! find . -name "modules.txt" -type f 2>/dev/null | grep -q .; then
+    echo "INFO: Sources not extracted, extracting now..."
+
+    # Use fedpkg to download and extract sources
+    # This handles the lookaside cache and source extraction properly
+    if ! fedpkg sources 2>&1; then
+        echo "ERROR: Failed to download sources with fedpkg sources"
+        exit 1
+    fi
+
+    # Extract sources using fedpkg prep
+    if ! fedpkg prep 2>&1; then
+        echo "ERROR: Failed to extract sources with fedpkg prep"
+        exit 1
+    fi
+
+    echo "INFO: Sources extracted successfully"
+fi
+
+# Step 2: Generate bundled provides (strip blank lines from output)
+echo "INFO: Running bundled-deps.sh to generate provides..."
+PROVIDES=$(./bundled-deps.sh | sed '/^$/d')
+
+# Step 3: Validate output
+if [ -z "$PROVIDES" ]; then
+    echo "ERROR: bundled-deps.sh produced no output"
+    exit 1
+fi
+
+if ! echo "$PROVIDES" | grep -q "Provides: bundled"; then
+    echo "ERROR: bundled-deps.sh output does not contain 'Provides: bundled'"
+    echo "Output was: $PROVIDES"
+    exit 1
+fi
+
+# Step 4: Verify marker comment exists in spec file
+if ! grep -q "$MARKER" "$SPEC_FILE"; then
+    echo "ERROR: Marker comment not found in $SPEC_FILE"
+    echo "Expected: $MARKER"
+    exit 1
+fi
+
+# Step 5: Update spec file using awk to replace the bundled provides section
+echo "INFO: Updating $SPEC_FILE with new bundled provides..."
+
+TEMP_FILE=$(mktemp)
+
+awk -v marker="$MARKER" -v provides="$PROVIDES" '
+    BEGIN {
+        in_section = 0
+    }
+
+    # When we find the marker, print it and the new provides
+    $0 ~ marker {
+        print marker " based on the in tree module data"
+        print provides
+        in_section = 1
+        next
+    }
+
+    # Skip lines in the bundled provides section until we hit a blank line
+    in_section && /^$/ {
+        print ""
+        in_section = 0
+        next
+    }
+
+    # Skip other lines in the section
+    in_section {
+        next
+    }
+
+    # Print all other lines unchanged
+    !in_section {
+        print
+    }
+' "$SPEC_FILE" > "$TEMP_FILE"
+
+# Verify the temp file is not empty
+if [ ! -s "$TEMP_FILE" ]; then
+    echo "ERROR: awk processing produced empty output"
+    rm -f "$TEMP_FILE"
+    exit 1
+fi
+
+# Verify the marker still exists in the output
+if ! grep -q "$MARKER" "$TEMP_FILE"; then
+    echo "ERROR: Marker comment lost during processing"
+    rm -f "$TEMP_FILE"
+    exit 1
+fi
+
+# Replace the spec file with the updated version
+mv "$TEMP_FILE" "$SPEC_FILE"
+
+# Count how many provides were added
+PROVIDES_COUNT=$(echo "$PROVIDES" | wc -l)
+echo "INFO: Successfully updated $SPEC_FILE with $PROVIDES_COUNT bundled provides"

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-06-03 15:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-03 15:40 [rpms/golang] rawhide: Update packit workflow and remove F42 

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox