On Wed, Oct 30, 2013 at 09:49:11PM -0700, Anatol Pomozov wrote:
> Hi
> 
> On Wed, Oct 30, 2013 at 8:51 PM, Jerome Leclanche <[email protected]> wrote:
> > As someone who maintains a lot of git packages, I wish, I really wish
> > there was a *standardized* way of writing a pkgver that would output
> > the appropriate format whether there are tags pushed upstream or not.
> 
> That is what I intended to propose next.
> 
> As the regexp become more complicated it is better if makepkg will
> take care of generating the package version. I think makepkg should
> have a shell function, something like 'generate_pkgver_vcs()' that
> user can use in pkgver().
> 
> e.g.
> 
> pkgver() {
>   cd repo
>   generate_pkgver_vcs()
> }
> 
> This function will
> 1) Find what VCS is used
> 2) Generate appropriate VCS version
> 

I would urge you to look at one of the newer features of pacman,
makepkg-template. You can do such things as this very easily. I already
maintain a small and probably awful repository[1]/package[2] with a few
VCS pkgver functions that you can use. Mostly they have been taken from
the wiki, though I do have a nice, long sed expression that does the
'r' prefixing (I wrote that talk article).

[1]: http://git.kaictl.net/wgiokas/makepkg-templates.git/
[2]: https://aur.archlinux.org/packages/makepkg-templates-ks-git/

--SNIP--
> >> Another issue is a repo that has no tags. Here is a recommendation
> >> from the wiki page:
> >>
> >> printf "%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short 
> >> HEAD)"
> >>
> >> that will use number of commits (a large number e.g. 3000). The
> >> problem arises when the project creates first tag e.g. 0.1. I suggest
> >> to fix this problem by using "0" as a tag version (and add prefix 'r'
> >> like in the previous item). This makes sure that non-tagged version is
> >> always less that a tagged version.
> >>
> >> So pkgver() will look like:
> >>
> >> printf "0.r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short 
> >> HEAD)"
> >>
> >> Let me know if you have any objections. If not then I'll update the wiki 
> >> page.

This is not needed at all. If the project starts using tags, use an
epoch= to set all versions from then on to be greater than the original
versions with rev-list.

Thanks,
-- 
William Giokas | KaiSforza | http://kaictl.net/
GnuPG Key: 0x73CD09CF
Fingerprint: F73F 50EF BBE2 9846 8306  E6B8 6902 06D8 73CD 09CF

Attachment: pgpSkJ8stADbS.pgp
Description: PGP signature

Reply via email to