AUR/Paru Deployment Guide โ
Publishing OpenPets to the Arch User Repository (AUR) for Arch Linux users.
๐ฆ Package Information โ
Package Name: openpetsPKGBUILD Location: distribution-templates/PKGBUILDAUR URL: https://aur.archlinux.org/packages/openpets
Installation Commands:
paru -S openpets
# or
yay -S openpets๐ Initial Setup โ
Prerequisites โ
AUR Account
- Create account at: https://aur.archlinux.org/register
- Add SSH key to your account
SSH Key Setup
bash# Generate SSH key ssh-keygen -t ed25519 -C "aur@yourname.com" -f ~/.ssh/aur # Add to AUR account cat ~/.ssh/aur.pub # Paste at: https://aur.archlinux.org/account/Clone AUR Repository
bashgit clone ssh://aur@aur.archlinux.org/openpets.git
๐ PKGBUILD Structure โ
Current PKGBUILD โ
# Maintainer: Raggle <support@raggle.co>
pkgname=openpets
pkgver=1.0.4
pkgrel=1
pkgdesc="AI plugin infrastructure and shared utilities for OpenCode"
arch=('any')
url="https://pets.raggle.co"
license=('MIT')
depends=('nodejs>=18' 'npm')
optdepends=(
'tsx: TypeScript execution support'
'opencode: OpenCode AI coding assistant'
)
source=("https://registry.npmjs.org/$pkgname/-/$pkgname-$pkgver.tgz")
sha256sums=('PLACEHOLDER_CHECKSUM')
noextract=("$pkgname-$pkgver.tgz")
package() {
npm install -g \
--prefix="$pkgdir/usr" \
--cache "$srcdir/npm-cache" \
"$pkgname@$pkgver"
find "$pkgdir/usr" -type d -name '.cache' -exec rm -r {} +
find "$pkgdir/usr" -type f -name 'package.json' \
-execdir sed -i '/_where/d' {} +
find "$pkgdir/usr" -type d -exec chmod 755 {} +
find "$pkgdir/usr" -type f -exec chmod 644 {} +
chmod 755 "$pkgdir/usr/bin/pets"
chmod 755 "$pkgdir/usr/bin/pets-mcp"
install -Dm644 \
"$pkgdir/usr/lib/node_modules/$pkgname/README.md" \
"$pkgdir/usr/share/doc/$pkgname/README.md"
if [ -f "$pkgdir/usr/lib/node_modules/$pkgname/LICENSE" ]; then
install -Dm644 \
"$pkgdir/usr/lib/node_modules/$pkgname/LICENSE" \
"$pkgdir/usr/share/licenses/$pkgname/LICENSE"
fi
}๐ Publishing to AUR โ
1. Update PKGBUILD โ
After publishing to npm:
./scripts/update-openpets-checksums.shThis updates:
pkgversha256sums- Generates
.SRCINFO
2. Copy to AUR Repository โ
cp distribution-templates/PKGBUILD openpets-aur/
cp distribution-templates/.SRCINFO openpets-aur/3. Commit and Push โ
cd openpets-aur
git add PKGBUILD .SRCINFO
git commit -m "Update to version 1.0.4"
# Push to AUR
GIT_SSH_COMMAND="ssh -i ~/.ssh/aur" git push origin master๐งช Testing PKGBUILD โ
Build Locally โ
# Copy PKGBUILD to test directory
mkdir -p /tmp/test-openpets
cp distribution-templates/PKGBUILD /tmp/test-openpets/
cd /tmp/test-openpets
# Build package
makepkg -si
# Test installation
pets --version
pets --help
# Cleanup
sudo pacman -R openpets
cd /tmp && rm -rf test-openpetsValidate PKGBUILD โ
# Check syntax
bash -n PKGBUILD
# Lint with namcap
namcap PKGBUILD
# Check built package
makepkg -f
namcap openpets-1.0.4-1-any.pkg.tar.zst๐ฆ PKGBUILD Components โ
Metadata โ
pkgname=openpets # Package name
pkgver=1.0.4 # Version (auto-updated)
pkgrel=1 # Release number (bump for PKGBUILD changes)
pkgdesc="..." # Short description
arch=('any') # Architecture-independent
url="https://pets.raggle.co" # Homepage
license=('MIT') # LicenseDependencies โ
depends=('nodejs>=18' 'npm') # Required
optdepends=( # Optional
'tsx: TypeScript execution support'
'opencode: OpenCode AI coding assistant'
)Source โ
source=("https://registry.npmjs.org/$pkgname/-/$pkgname-$pkgver.tgz")
sha256sums=('...') # Checksum for verification
noextract=("...") # Don't auto-extractPackage Function โ
package() {
# Install via npm
npm install -g --prefix="$pkgdir/usr" ...
# Cleanup
find ... -name '.cache' -exec rm -r {} +
# Fix permissions
find ... -type d -exec chmod 755 {} +
find ... -type f -exec chmod 644 {} +
chmod 755 "$pkgdir/usr/bin/pets"
# Install docs/license
install -Dm644 README.md ...
}๐ฅ User Installation โ
Using AUR Helper (Paru) โ
paru -S openpetsUsing AUR Helper (Yay) โ
yay -S openpetsManual Installation โ
# Clone AUR package
git clone https://aur.archlinux.org/openpets.git
cd openpets
# Build and install
makepkg -siUpgrade โ
paru -Syu openpets
# or
yay -Syu openpetsUninstall โ
sudo pacman -R openpets๐ Updating Package โ
When New Version Released โ
# 1. Update checksums
./scripts/update-openpets-checksums.sh
# 2. Copy to AUR repo
cp distribution-templates/{PKGBUILD,.SRCINFO} openpets-aur/
# 3. Test build
cd openpets-aur
makepkg -f
# 4. Commit and push
git add PKGBUILD .SRCINFO
git commit -m "Update to version 1.0.5"
GIT_SSH_COMMAND="ssh -i ~/.ssh/aur" git pushWhen Fixing PKGBUILD โ
If only changing PKGBUILD (no version change):
# Bump pkgrel
pkgrel=2 # was 1
# Regenerate .SRCINFO
makepkg --printsrcinfo > .SRCINFO
# Commit and push
git add PKGBUILD .SRCINFO
git commit -m "Fix PKGBUILD: [description]"
git push๐จ AUR Best Practices โ
Naming โ
- โ
Use simple lowercase name:
openpets - โ Match upstream package name
- โ Don't add unnecessary suffixes
PKGBUILD Quality โ
# Validate
namcap PKGBUILD
namcap *.pkg.tar.zst
# Common checks
- Dependencies complete and minimal
- Correct permissions
- Documentation installed
- No unnecessary files
- Checksum matches.SRCINFO โ
Always regenerate after PKGBUILD changes:
makepkg --printsrcinfo > .SRCINFONever edit .SRCINFO directly!
๐ค Automation โ
Auto-Update Script โ
#!/bin/bash
# scripts/update-aur.sh
set -e
VERSION=$(npm view openpets version)
TARBALL_URL="https://registry.npmjs.org/openpets/-/openpets-$VERSION.tgz"
SHA256=$(curl -sL "$TARBALL_URL" | sha256sum | cut -d' ' -f1)
cd openpets-aur
# Update PKGBUILD
sed -i "s/pkgver=.*/pkgver=$VERSION/" PKGBUILD
sed -i "s/sha256sums=.*/sha256sums=('$SHA256')/" PKGBUILD
sed -i "s/pkgrel=.*/pkgrel=1/" PKGBUILD
# Generate .SRCINFO
makepkg --printsrcinfo > .SRCINFO
# Commit and push
git add PKGBUILD .SRCINFO
git commit -m "Update to version $VERSION"
GIT_SSH_COMMAND="ssh -i ~/.ssh/aur" git push
echo "โ AUR package updated to $VERSION"GitHub Actions โ
Include in .github/workflows/publish-distributions.yml:
- name: Update AUR
run: |
eval $(ssh-agent -s)
ssh-add - <<< "${{ secrets.AUR_SSH_KEY }}"
git clone ssh://aur@aur.archlinux.org/openpets.git aur-repo
cp distribution-templates/PKGBUILD aur-repo/
cp distribution-templates/.SRCINFO aur-repo/
cd aur-repo
git config user.name "Raggle Bot"
git config user.email "bot@raggle.co"
git add PKGBUILD .SRCINFO
git commit -m "Update to version ${{ steps.version.outputs.VERSION }}"
git push๐ Troubleshooting โ
Build Fails โ
Check logs:
makepkg -f 2>&1 | tee build.logCommon issues:
- Missing dependencies โ Add to
depends=() - Network error โ Check npm registry
- Permission error โ Fix in
package()function
Can't Push to AUR โ
Check SSH:
ssh -i ~/.ssh/aur aur@aur.archlinux.orgShould see: "Hi [username]! You've successfully authenticated..."
Package Marked Out-of-Date โ
Someone flagged it as outdated. Update and push:
# Update to latest version
./scripts/update-aur.sh
# Users will see update available๐ Package Info โ
View Package on AUR โ
Visit: https://aur.archlinux.org/packages/openpets
Check Package Status โ
# Query installed package
pacman -Qi openpets
# List files
pacman -Ql openpets
# Check orphans
pacman -QdtVote Statistics โ
Users can vote for packages on AUR. More votes = more visibility.
Encourage users to vote:
# In AUR web interface:
# "Vote for this package"๐ Release Checklist โ
When releasing new version:
- [ ] Publish to npm
- [ ] Run
./scripts/update-openpets-checksums.sh - [ ] Test PKGBUILD locally:
makepkg -si - [ ] Verify package works:
pets --version - [ ] Copy to AUR repo
- [ ] Commit and push to AUR
- [ ] Verify on aur.archlinux.org
- [ ] Test user installation:
paru -S openpets