summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2012-08-20 11:15:14 -0400
committerLuke Shumaker <LukeShu@sbcglobal.net>2012-08-24 23:04:13 -0400
commitd35b4a4bbd7f0e61558f30e22234f20a2e4b1ce7 (patch)
tree7f6edf5368e9299956594592fccf666aba415b62
parentec5e6d90294f3322b7015b422db948770ecb41b6 (diff)
makepkg: properly detect the last rev for all VCS types, remove darcslukeshu-versiondetect
The automatic version detection for VCS systems was inconsistant/incomplete. In completing it, I removed darcs from the list. I believe that this is acceptable because: * darcs isn't packaged for Arch * I couldn't find a PKGBUILD that uses it, in an official repo or the AUR To sumarize how each of the other VCS systems changed: * cvs: use "r{rev}" instead of the current date * git: use the date down to the minute of the last commit, rather than the current date. * svn: use "r{rev}" instead of "{rev} * bzr: use "r{rev}" instead of "{rev} * hg: use "r{rev}" instead of "{rev}, don't do a pull before
-rw-r--r--scripts/makepkg.sh.in33
1 files changed, 7 insertions, 26 deletions
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index b30e9d04..d447ddfc 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -1812,7 +1812,6 @@ devel_check() {
# Also do a check to make sure we have the VCS tool available.
local vcs=()
- [[ -n ${_darcstrunk} && -n ${_darcsmod} ]] && vcs+=("darcs")
[[ -n ${_cvsroot} && -n ${_cvsmod} ]] && vcs+=("cvs")
[[ -n ${_gitroot} && -n ${_gitname} ]] && vcs+=("git")
[[ -n ${_svntrunk} && -n ${_svnmod} ]] && vcs+=("svn")
@@ -1833,41 +1832,23 @@ devel_check() {
msg "$(gettext "Determining latest %s revision...")" "$vcs"
+ # Prefix with 'r' if not formatted like a date
case "$vcs" in
- darcs)
- newpkgver=$(date +%Y%m%d)
- ;;
cvs)
- newpkgver=$(date +%Y%m%d)
+ newpkgver=r$(cd $_cvsmod && cvs log -N 2>/dev/null|sed -n 's/revision //p'|sed 1q)
;;
git)
- newpkgver=$(date +%Y%m%d)
+ # Take date down to the minute since git commit IDs aren't numeric/increasing
+ newpkgver=$(date -u +%Y%m%d.%H%M -d "`cd $_gitname && git log -n1 --date=iso --format=format:'%cd'`")
;;
svn)
- newpkgver=$(LC_ALL=C svn info $_svntrunk | sed -n 's/^Last Changed Rev: \([0-9]*\)$/\1/p')
+ newpkgver=r$(LC_ALL=C svn info $_svntrunk | sed -n 's/^Last Changed Rev: \([0-9]*\)$/\1/p')
;;
bzr)
- newpkgver=$(bzr revno ${_bzrtrunk})
+ newpkgver=r$(bzr revno $_bzrtrunk)
;;
hg)
- if pushd "./src/$_hgrepo" > /dev/null; then
- local ret=0
- hg pull || ret=$?
- if (( ! ret )); then
- hg update
- elif (( ret != 1 )); then
- return 1
- fi
- else
- [[ ! -d ./src/ ]] && mkdir ./src/
- hg clone "$_hgroot/$_hgrepo" "./src/$_hgrepo"
- if ! pushd "./src/$_hgrepo" > /dev/null; then
- warning "$(gettext "An error occured while determining the hg version number.")"
- return 0
- fi
- fi
- newpkgver=$(hg tip --template "{rev}")
- popd > /dev/null
+ newpkgver=r$(cd $_hgrepo && hg tip --template "{rev}")
;;
esac