[pacman-dev] [PATCH] doc: Document pkgver() function

Christian Hesse list at eworm.de
Thu Apr 25 18:41:48 EDT 2013


William Giokas <1007380 at gmail.com> on Thu, 2013/04/25 17:18:
> On Thu, Apr 25, 2013 at 09:54:13PM +0000, Xyne wrote:
> > I've seen pkgver functions for Git popping up that include hashtags in the
> > version. I expect that this will become a widespread problem for
> > vercmp-based ordering if it is not discouraged. Perhaps you can add a
> > note about that in the documentation, e.g.
> 
> Git describe outputs a versionable string. If there are tags, it will
> take the latest tag (usually a version, say 4.1.0), and combine it with
> two more parts. The second part is the number of parents between the
> named tag and the current HEAD. This makes the git describe so far
> somethinglike::
> 
>     4.1.0-15
> 
> I usually call this part the revno, as it's similar to what other vcs's
> use.
> 
> But now we get to the part you're talking about, which really doesn't
> matter anymore, the hash. This I keep on the end to be sure of what
> version was built.
> 
> I brought up a more complex sed command that can be used if upstream
> uses tags like::
> 
>     1.8.1 -> 1.8.1.1 -> 1.8.2 -> 1.8.2.1
> 
> that adds a 'r' in front of the revno, so the original git describe
> looks something like::
> 
>     4.1.0-15-g99b8d78
> 
> and after it's run through the sed command it will look like::
> 
>     4.1.0.15.g99b8d78
>     (or alternately) 4.1.0.r15.g99b8d78
> 
> so it's completely versionable including the hash. The second version of
> the git pkgvers that was in there works similar to other vcs's, using
> the number of parents between the current HEAD and the initial commit::
> 
>     0.r5300.g99b8d78
> 
> The '0.r' allows a tag such as '0.1' to be greater than the current
> version.

That is a really good hint! I was suffering this problem from time to time...
Thanks a lot!

Passing the option '--long' to 'git describe' makes it print the revision and
hash even if last commit has a tag.

> I am more worried about people using the date of the last commit, which
> is just a stupid way to do it when you have one of these ways to get the
> pkgver.

The only case I do this is if the repository has no tags at all. Any better
choice then?
-- 
main(a){char*c=/*    Schoene Gruesse                         */"B?IJj;MEH"
"CX:;",b;for(a/*    Chris           get my mail address:    */=0;b=c[a++];)
putchar(b-1/(/*               gcc -o sig sig.c && ./sig    */b/42*2-3)*42);}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://mailman.archlinux.org/pipermail/pacman-dev/attachments/20130426/1f548c01/attachment.asc>


More information about the pacman-dev mailing list