Refactor repository database update process
Updated the repository database generation process by removing old DB files, creating a temporary directory for metadata, and adjusting symlink creation for GitHub Pages. Changed commit message to reflect manual database generation and fixed indices.
This commit is contained in:
35
.github/workflows/update-repo.yml
vendored
35
.github/workflows/update-repo.yml
vendored
@@ -22,20 +22,33 @@ jobs:
|
|||||||
- name: Update Repository Database
|
- name: Update Repository Database
|
||||||
run: |
|
run: |
|
||||||
cd x86_64
|
cd x86_64
|
||||||
# Download a repo-add script that works on Ubuntu
|
# Remove old DB files
|
||||||
curl -L https://raw.githubusercontent.com/anthraxx/pacman-repo-add/master/repo-add -o repo-add
|
rm -f hyprarch-repo.db hyprarch-repo.db.tar.gz hyprarch-repo.files hyprarch-repo.files.tar.gz
|
||||||
chmod +x repo-add
|
|
||||||
|
|
||||||
# Use the real tool to build the database pacman expects
|
# Create a temporary directory for metadata
|
||||||
./repo-add hyprarch-repo.db.tar.gz *.pkg.tar.zst
|
mkdir -p db_temp
|
||||||
|
|
||||||
# Clean up the tool
|
# Extract metadata from each package and put it into the DB structure
|
||||||
rm repo-add
|
for pkg in *.pkg.tar.zst; do
|
||||||
|
pkgname=$(bsdtar -xOf "$pkg" .PKGINFO | grep "^pkgname =" | cut -d' ' -f3)
|
||||||
|
pkgver=$(bsdtar -xOf "$pkg" .PKGINFO | grep "^pkgver =" | cut -d' ' -f3)
|
||||||
|
mkdir -p "db_temp/$pkgname-$pkgver"
|
||||||
|
bsdtar -xOf "$pkg" .PKGINFO > "db_temp/$pkgname-$pkgver/desc"
|
||||||
|
# Add file size and build date to desc
|
||||||
|
echo -e "\n%FILENAME%\n$pkg" >> "db_temp/$pkgname-$pkgver/desc"
|
||||||
|
echo -e "\n%CSIZE%\n$(stat -c%s "$pkg")" >> "db_temp/$pkgname-$pkgver/desc"
|
||||||
|
done
|
||||||
|
|
||||||
# Fix symlinks for GitHub Pages
|
# Compress the metadata into a real Arch DB
|
||||||
rm -f hyprarch-repo.db hyprarch-repo.files
|
cd db_temp
|
||||||
|
tar -c * | gzip -9 > ../hyprarch-repo.db.tar.gz
|
||||||
|
cd ..
|
||||||
|
rm -rf db_temp
|
||||||
|
|
||||||
|
# Create the required symlinks/copies for GitHub Pages
|
||||||
cp hyprarch-repo.db.tar.gz hyprarch-repo.db
|
cp hyprarch-repo.db.tar.gz hyprarch-repo.db
|
||||||
cp hyprarch-repo.files.tar.gz hyprarch-repo.files
|
cp hyprarch-repo.db.tar.gz hyprarch-repo.files
|
||||||
|
cp hyprarch-repo.db.tar.gz hyprarch-repo.files.tar.gz
|
||||||
|
|
||||||
- name: Generate Subfolder Index
|
- name: Generate Subfolder Index
|
||||||
run: |
|
run: |
|
||||||
@@ -91,7 +104,7 @@ jobs:
|
|||||||
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
||||||
git add .
|
git add .
|
||||||
if ! git diff-index --quiet HEAD; then
|
if ! git diff-index --quiet HEAD; then
|
||||||
git commit -m "Fixed YAML syntax and DB format"
|
git commit -m "Manual DB generation and fixed indices"
|
||||||
git push
|
git push
|
||||||
else
|
else
|
||||||
echo "Nothing to change."
|
echo "Nothing to change."
|
||||||
|
|||||||
Reference in New Issue
Block a user