[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Doubts in Sigar packaging

On Wed, 15 Sep 2010 08:21:29 +1000
Matthew Palmer <mpalmer@debian.org> wrote:

> On Tue, Sep 14, 2010 at 01:51:22PM -0300, Thiago Franco de Moraes
> wrote:
> >  
> > * The Source is in git [3]. I'm not using the last stable version
> > because I wasn't able to compile it. What's the policy to version
> > packages from git? I'm using this way:
> > 
> > sigar-1.7.0~git833ca18ecfc1f3f45eaf8544d8cdafef6603772d
> > 
> > after git is the commit version I'm using.
> Yeah, that isn't going to work -- what if the next SHA you want to
> package is 12345[blah]... it'll look like a lesser version to dpkg.
> What you need to do is select a monotonically increasing number to
> work from.  I think the most common option is to just take the date
> of the last commit in the repo and use that, so something like
> sigar-1.7.0~git20100915.  Assuming that you don't want to package two
> versions from the same day, that should work just fine.

I had a similar problem when I moved roxterm to git [1]. I only use
git-derived versions for testing between releases but it's still useful.
Here's a bit of script that can help:

    Date=`git log --date=iso | grep -m1 '^Date:' | sed 's/^Date:\s*//'`
    Rev=`date -d "$Date" -u +'%Y%m%d%H%M%S'`

It can be done in one line with nested $() but I prefer shorter more
readable lines. And you can get rid of the %H%M%S if you're not going to
do it more than once a day.

[1] I wanted to use bzr for this very reason, but SourceForge's version
is very old and I couldn't push to it with the version in Debian

Reply to: