From a68c6207e556e07f64b5c8a3e90aa8c0e8403f3c 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 3e918e6..db02d79 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1252,7 +1252,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 ${_gitbranch:-master}|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.3