Skip to content

Instantly share code, notes, and snippets.

@pyropeter
Created August 26, 2010 19:41
Show Gist options
  • Save pyropeter/552081 to your computer and use it in GitHub Desktop.
Save pyropeter/552081 to your computer and use it in GitHub Desktop.
AUR-tools
#!/usr/bin/env bash
set -e
set -u
# Does like everything you can do with a PKGBUILD:
# * Builds source package
# * TODO: Runs namcap on PKGBUILD
# * Builds binary package
# * Runs namcap on the binary package
# Usage: aurit.sh <path-to-makepkg-style-build-dir>
# currently only works with pathes of depth 1 (e.g. foo/)
src=$1
tmp=`dirname $1`/`basename $1`_tmp
# ----------------- Packaging --------------
echo "===== Packaging... =============================================="
cd $src
makepkg --source
mv *.src.tar.gz ..
cd ..
# ----------------- Building --------------
echo "===== Testing... ================================================"
cp -r $src $tmp
cd $tmp
makepkg
echo "Running namcap..."
namcap *.pkg.tar.xz
cp *.pkg.tar.xz ..
cd ..
rm --one-file-system -r $tmp
echo "Done."
#!/bin/bash
set -e
set -u
set -o pipefail
# Bumps PKGBUILD's version: set pkgver, pkgrel=1, update md5sums
# Usage: bumpversion.sh <path-to-makepkg-style-build-dir> <new-version>
# currently only works with pathes of depth 1 (e.g. foo/)
oldfile=PKGBUILD.bak_pre$2
tmpfile=PKGBUILD_bumpversion
cd $1
while [ -e "$oldfile" ]; do
oldfile="${oldfile}_"
done
mv PKGBUILD $oldfile
sed "s/^pkgver=.*$/pkgver=$2/; s/^pkgrel=.*$/pkgrel=1/" $oldfile > PKGBUILD
sed "s/^md5sums=(.*)$/`makepkg -g | tr -d '\n' | sed 's/\s\s*/ /g'`/" PKGBUILD > $tmpfile
mv $tmpfile PKGBUILD
cd ..
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment