From 2c234cd74603ff31f5e273ee19ecfece9618021e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Cauwelier?= Date: Sun, 16 Aug 2009 00:36:12 +0200 Subject: [PATCH] makepkg: get pkgver of a git checkout from the last commit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes issue FS#15895 "PKGBUILD git feature is systematically setting pkgver to today date, not date of the last commit" Remains to take the timezone into account, but this is not really an issue. Signed-off-by: Hervé Cauwelier --- scripts/makepkg.sh.in | 14 +++++++++++++- 1 files changed, 13 insertions(+), 1 deletions(-) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index daa9585..388df93 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1219,7 +1219,19 @@ devel_check() { elif [ -n "${_gitroot}" -a -n "${_gitname}" ] ; then [ $(type -p git) ] || return 0 msg "$(gettext "Determining latest git revision...")" - newpkgver=$(date +%Y%m%d) + if [ -d ./src/$_gitname ] ; then + cd ./src/$_gitname + git pull + else + [[ ! -d ./src/ ]] && mkdir ./src/ + git clone $_gitroot ./src/$_gitname + cd ./src/$_gitname + fi + author=$(git cat-file commit HEAD|grep author) + # FIXME tz is lost + ts=$(echo $author|cut -d'>' -f2|cut -d' ' -f2) + newpkgver=$(date -d "@$ts" +%Y%m%d) + cd ../../ elif [ -n "${_svntrunk}" -a -n "${_svnmod}" ] ; then [ $(type -p svn) ] || return 0 msg "$(gettext "Determining latest svn revision...")" -- 1.6.4