[pacman-dev] [PATCH] Integrate versionpkg into makepkg

Dan McGee dpmcgee at gmail.com
Mon Oct 29 13:37:41 EDT 2007

On 10/29/07, Aaron Griffin <aaronmgriffin at gmail.com> wrote:
> On 10/27/07, Miklos Vajna <vmiklos at frugalware.org> wrote:
> > for darcs and git, you could use curl to determine the last update of
> > the repo. they will be still ugly (not as nice as git-describe is), but
> > at least it will show when the master branch is updated
> >
> > like:
> >
> > date +%Y%m%d%H%M%S --date '`curl -I $url/HEAD 2>&1|sed -n '/^Last-Modified/s/^[^:]*: //p'`'
> >
> > and
> >
> > lynx -source -dump $url/_darcs/inventory|grep ']'|sed -n 's/.*\*\(.*\)\]./\1/;$ p'
> Doesn't this require a web interface though? I guess we're already
> pinned to some sort of web interface, but I'm just thinking outloud.
> Is there a use-case where a darcs or git repo would NOT be HTTP
> accessible?

Well if I use a git:// address in my PKGBUILD, then yeah, this method screws us.

Did we really think the git tools wouldn't do there job? The only
reason I didn't do this before is because I was just accepting it the
way it currently works for versionpkg, although now might be the time
to make this change.

The following will take ANY GIT repo url (local FS, http://, git://,
etc) and produce a nice pretty version name for you.

git-ls-remote $_gitroot $_gitname | git-describe

$git ls remote git://projects.archlinux.org/pacman.git master | git-describe

Now that wasn't too hard, now was it? The only problem is that
git-describe uses '-' characters in its version. Do we allow this, or
is that reserved as a seperator for the pkgrel? I know there are some
funny parsing issues we have to make sure we do right.


diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 831c1bd..5de7205 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -996,7 +996,7 @@ devel_check() {
                        newpkgver=$(date +%Y%m%d)
                elif [ ! -z ${_gitroot} ] && [ ! -z ${_gitname} ] ; then
                        msg "$(gettext "Determining latest git revision...")"
-                       newpkgver=$(date +%Y%m%d)
+                       newpkgver=$(git-ls-remote ${_gitroot}
${_gitname} | git-describe)
                elif [ ! -z ${_svntrunk} ] && [ ! -z ${_svnmod} ] ; then
                        msg "$(gettext "Determining latest svn revision...")"
                        newpkgver=$(svn log $_svntrunk --limit 1 | sed
-n 's/^r\([^ ]*\) .*$/\1/p')

More information about the pacman-dev mailing list