summaryrefslogblamecommitdiff
path: root/abump.in
blob: 03d1bd0dc1ae85772b9b02be1ebda5aa3f0511db (plain) (tree)
1
2
3
4

         

                














                               
                                         











                                                                                    
                                                  




                           





                                                              
                                           


              


                           

                    

                           



                       

                              



                                  
 
#!/bin/sh

program=${0##*/}

die() {
	echo "$@" >&2
	exit 1
}

# version bump a pkg

do_bump() {
	pkgname=${1%-[0-9]*}
	pkgver=${1#${pkgname}-}

	APORTS=$HOME/aports

	set -e

	cd $APORTS/*/$pkgname || return 1
	section=${PWD%/*}
	section=${section##*/}

	msg="$section/$pkgname: upgrade to $pkgver"
	echo "$msg"
	
	( . ./APKBUILD; type package | grep -q function ) || die "package() missing"
		
	sed -i -e "s/^pkgver=.*/pkgver=$pkgver/" \
		-e "s/^pkgrel=.*/pkgrel=0/" \
		APKBUILD

	abuild $abuild_opts checksum all || exit 1

	git add APKBUILD
	git commit -m"$msg"
}

usage() {
	echo "$program - utility to bump pkgver in APKBUILDs"
	echo "usage: $program [-hR]"
	echo ""
	echo "  -h  show this help"
	echo "  -R  run abuild with -R for recursive building"
	echo "  -k  keep existing packages"
	exit 0
}

keep=
recursive="-r"
while getopts "hkR" opt; do
	case $opt in
	h) usage;;
	k) keep="-k";;
	R) recursive="-R";;
	esac
done
shift $(( $OPTIND - 1))

abuild_opts="$recursive $keep"

while [ $# -gt 0 ]; do
	( do_bump "$1" ) || exit 1
	shift
done