aboutsummaryrefslogblamecommitdiffstats
path: root/upload
blob: 7969bd54813194c4ad2031441481bbe4e1a21cf5 (plain) (tree)
1
2
3
4
5
6
7
8
9





                      


            

                                           



                                              
    

                                   

                                 







                                                          


                                                                   


                   

                                     
  

                                      


                




                                 


  








                                             






                         













                                                                    
    





                                                    
  
#!/bin/bash

set -e

cd "$(dirname "${0}")"

message=
skip_build=n

for arg; do
	if test "${arg}" = skip-build; then
		skip_build=y
	elif test "${arg::8}" = message=; then
		message="${arg:8}"
	fi
done

if test ! "${skip_build}" = y; then
	makepkg --install --clean
fi

newpkg=0
pkgname="$(. PKGBUILD && echo "${pkgname}")"
pkgver="$(. PKGBUILD && echo "${pkgver}")"
pkgrel="$(pkgrel=1 && . PKGBUILD && echo "${pkgrel}")"
epoch="$(epoch=0 && . PKGBUILD && echo "${epoch}")"
install="$(install="" && . PKGBUILD && echo "${install}")"

if test ! -d .aur; then
	newpkg=1
	git clone "ssh://aur@aur.archlinux.org/${pkgname}.git" .aur
fi

version="${pkgver}"
if test ! "${epoch}" = 0; then
	version="${epoch}:${version}"
fi
if test ! "${pkgrel}" = 1; then
	version="${version}-${pkgrel}"
fi

cp PKGBUILD .aur
if test ! "${install}" = ""; then
	cp "${install}" .aur
	cd .aur
	git add "${install}"
	cd ..
fi

(
	. PKGBUILD
	cd .aur
	for file in "${source[@]}"; do
		if test -f ../"${file}"; then
		    cp ../"${file}" .
		    git add "${file}"
		fi
	done
	cd ..
)

cd .aur

mksrcinfo
git add PKGBUILD .SRCINFO

if test ${newpkg} = 1; then
	if test -z "${message}"; then
		git commit -m "Initial import, version ${version}"
	else
		git commit -m "${message}"
	fi
	git push origin master
elif test ! "${pkgrel}" = 1; then
	if test -z "${message}"; then
		git commit -m "Update package release to ${version}"
	else
		git commit -m "${message}"
	fi
	git push
else
	if test -z "${message}"; then
		git commit -m "Update to ${version}"
	else
		git commit -m "${message}"
	fi
	git push
fi