diff --git a/.github/workflows/update-repo.yml b/.github/workflows/update-repo.yml index 8092866..a74a957 100644 --- a/.github/workflows/update-repo.yml +++ b/.github/workflows/update-repo.yml @@ -27,7 +27,7 @@ jobs: - name: Update Repository Database run: | cd x86_64 - # Remove old DB and sig files to ensure a clean rebuild + # Remove old DB and sig files for a clean build rm -f hyprarch-repo.db* hyprarch-repo.files* mkdir -p db_temp @@ -36,14 +36,14 @@ jobs: # 1. Sign the package file gpg --detach-sign --batch --no-armor --local-user 236328A7F2C2001E "$pkg" - # 2. Extract and sanitize metadata - # We filter out comments (#) to avoid pacman sync errors + # 2. Extract specific metadata (Strict Cleaning) pkgname=$(bsdtar -xOf "$pkg" .PKGINFO | grep "^pkgname =" | cut -d' ' -f3) pkgver=$(bsdtar -xOf "$pkg" .PKGINFO | grep "^pkgver =" | cut -d' ' -f3) + pkgdesc=$(bsdtar -xOf "$pkg" .PKGINFO | grep "^pkgdesc =" | cut -d' ' -f3- | sed "s/['\"]//g") mkdir -p "db_temp/$pkgname-$pkgver" - # Create the 'desc' file with required Pacman formatting + # Manually construct the 'desc' file to avoid "unknown key" errors { echo "%NAME%" echo "$pkgname" @@ -51,8 +51,8 @@ jobs: echo "%VERSION%" echo "$pkgver" echo "" - # Pull other fields from PKGINFO but skip comments and already added fields - bsdtar -xOf "$pkg" .PKGINFO | grep -v "^#" | grep -v "^pkgname" | grep -v "^pkgver" + echo "%DESC%" + echo "$pkgdesc" echo "" echo "%FILENAME%" echo "$pkg" @@ -60,13 +60,16 @@ jobs: echo "%CSIZE%" echo "$(stat -c%s "$pkg")" echo "" + echo "%ISIZE%" + echo "$(bsdtar -xOf "$pkg" .PKGINFO | grep "^size =" | cut -d' ' -f3)" + echo "" echo "%PGPSIG%" gpg --detach-sign --stdout --no-armor --local-user 236328A7F2C2001E "$pkg" | base64 | tr -d '\n' echo "" } > "db_temp/$pkgname-$pkgver/desc" done - # 3. Pack the database + # 3. Compress the metadata into a real Arch DB cd db_temp tar -c * | gzip -9 > ../hyprarch-repo.db.tar.gz cd .. @@ -74,7 +77,7 @@ jobs: # 4. Sign the database itself gpg --detach-sign --batch --no-armor --local-user 236328A7F2C2001E hyprarch-repo.db.tar.gz - # 5. Create final symlink-replacements for GitHub Pages + # 5. Finalize files cp hyprarch-repo.db.tar.gz hyprarch-repo.db cp hyprarch-repo.db.tar.gz.sig hyprarch-repo.db.sig cp hyprarch-repo.db.tar.gz hyprarch-repo.files @@ -134,7 +137,7 @@ jobs: git config --global user.email "github-actions[bot]@users.noreply.github.com" git add . if ! git diff-index --quiet HEAD; then - git commit -m "Full rebuild: Signed DB and Packages (Fixed Metadata)" + git commit -m "Final Fix: Clean Metadata and GPG Signed DB" git push else echo "Nothing to change."