From: Jakub Narebski <jnareb@gmail.com>
To: Jonas Fonseca <fonseca@diku.dk>
Cc: git@vger.kernel.org
Subject: Re: [RFC/PATCH 4/3] Simplify naming (versioning) of non-release tig tarball and rpm file
Date: Sun, 3 Jun 2007 23:12:59 +0200 [thread overview]
Message-ID: <200706032312.59756.jnareb@gmail.com> (raw)
In-Reply-To: <20070603091126.GA1419@diku.dk>
On Sun, 3 Jun 2007, Jonas Fonseca wrote:
> Jakub Narebski <jnareb@gmail.com> wrote Sat, Jun 02, 2007:
>> This is proposal to simplify naming of non-release tarballs and rpm file,
>> both for tig and also for git itself. Instead of using whole git-describe
>> output as version number in tarball/rpm name (BTW. it would be nice to
>> have command line switch to git-describe which would return old output,
>> without number of commits since given tag) use tag part as version number,
>> and number of commits since (plus optional marking dirty) as release
>> number.
>>
>> What do you think about this?
>
> I like the simpler and less confusing names. How about the simpler
> version below?
This version would work for tig now, but is not very generic. See also
comments below.
> BTW, I also added `make dist DIST_VERSION=X.Y` to make it easy to force
> a version. I used it when building the documentation in the release
> branch.
Nice idea.
>> diff --git a/Makefile b/Makefile
>> index b49d7f8..1e67586 100644
>> --- a/Makefile
>> +++ b/Makefile
>> @@ -17,7 +17,13 @@ ifdef DIST_VERSION
>> VERSION = $(DIST_VERSION)
>> endif
>>
>> -RPM_VERSION = $(subst -,.,$(VERSION))
>> +# $(GITDESC) looks like either x.y, or like x.y-z-g<sha1>
>> +SPLIT_VERSION := $(shell echo $(GITDESC) | \
>> + sed -e 's/^\(.*\)-\([0-9]\+\)-\(g[0-9a-f]\+\)$$/\1 \2 \3/g')
>> +RPM_VERSION = $(subst -,.,$(word 1,$(SPLIT_VERSION)))
>> +RPM_RELEASE = $(strip \
>> + $(subst -,.,$(if $(word 2,$(SPLIT_VERSION)),\
>> + $(word 2,$(SPLIT_VERSION)),0)$(WTDIRTY)))
>>
>> LDLIBS = -lcurses
>> CFLAGS = -Wall -O2 '-DVERSION="$(VERSION)"'
>
> diff --git a/Makefile b/Makefile
> index 91cb097..622a916 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -17,7 +17,11 @@ ifdef DIST_VERSION
> VERSION = $(DIST_VERSION)
> endif
>
> -RPM_VERSION = $(subst -,.,$(VERSION))
> +# Split the version "TAG-OFFSET-gSHA1-DIRTY" into "TAG OFFSET"
> +# and append 0 as a fallback offset for "exact" tagged versions.
> +RPM_VERLIST = $(filter-out g% dirty,$(subst -, ,$(VERSION))) 0
> +RPM_VERSION = $(word 1,$(RPM_VERLIST))
> +RPM_RELEASE = $(word 2,$(RPM_VERLIST))$(if $(WTDIRTY),.dirty)
>
> LDLIBS = -lcurses
> CFLAGS = -Wall -O2
I'd like to note that I wanted to make _generic_ version of generating
RPM_VERSION and RPM_RELEASE from the output of git-describe (also with
marking that working directory was in dirty state). Your simpler version
works for tags used in tig repository, but for example not necessarily
so for git repository.
I assume that "version tags" are of the form
[<prefix>]<version>
where optional <prefix> is "v" for git and linux repositories, "tig-"
for tig repository, "gitgui-" for git-gui repository. <version> starts
with a number, and usually consists of numbers separated by dots, but
it can contain also alphanumeric suffix, for example "-rc1", "-pre7",
"b" (c.f. v0.99.9b tag in git repository), etc. I assume that <version>
is the part that starts with the number.
This means that git-describe output is either of the form
[<prefix>]<version>
(if there is exact match), or of the form
[<prefix>]<version>-<number of additional commits>-g<abbreviated sha-1>
For exact match (release tarball) I'd like to have
RPM_VERSION = $(subst -,.,<version>)
RPM_RELEASE = 0
and for non-exact match to have
RPM_VERSION = $(subst -,.,<version>)
RPM_RELEASE = <number of additional commits>.g<abbreviated sha-1>
The "g<abbreviated sha-1>", which was missing from my (and yours)
proposal is needed because we can have multiple branches, and the
part before "-g<abbreviated sha-1>" could be the same for different
commits (on different branches, e.g. 'master' and 'next').
For "make dist" run from a dirty tree we want to have ".dirty" suffix
added to RPM_RELEASE.
Example: if git-describe returns v1.4.3-rc2-21-g0a7a9a1 in a dirty tree
(with uncommitted changes) I'd like to have 1.4.3.rc2 as version number
and 21.g0a7a9a1.dirty as release number, so tarball would be named
git-1.4.3.rc2-21.g0a7a9a1.dirty.tar.gz
Now to the implementation. I wanted to do the above using only Makefile
functions, if not for two complications. First I didn't know how to
get second-to-last word, or how to remove last word from variable;
trick with filter-out could work there. Second in generic version is
quite hard to distinguish using only make functions between exact and
non-exact match for arbitrary versioning (tagging versions) scheme.
P.S. Perhaps instead of RPM_VERSION we should (re)use DIST_VERSION,
and instead of RPM_RELEASE use DIST_RELEASE?
--
Jakub Narebski
Poland
prev parent reply other threads:[~2007-06-03 23:19 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-28 8:54 [PATCH (tig)] Infrastructure for tig rpm builds Jakub Narebski
2007-05-29 20:29 ` Jonas Fonseca
2007-05-29 23:31 ` Jakub Narebski
2007-05-31 13:16 ` Jonas Fonseca
2007-06-01 16:24 ` [PATCH 1/3] Remove PDF version of manual from being build and installed Jakub Narebski
2007-06-02 16:08 ` Jonas Fonseca
2007-06-01 16:27 ` [PATCH 2/3] Include documentation sources for rpmbuild with '--without docs' Jakub Narebski
2007-06-01 16:34 ` [PATCH 3/3] Refresh VERSION file when building distribution tarball in "make dist" Jakub Narebski
2007-06-02 16:12 ` Jonas Fonseca
2007-06-02 17:52 ` [RFC/PATCH 4/3] Simplify naming (versioning) of non-release tig tarball and rpm file Jakub Narebski
2007-06-03 9:11 ` Jonas Fonseca
2007-06-03 21:12 ` Jakub Narebski [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200706032312.59756.jnareb@gmail.com \
--to=jnareb@gmail.com \
--cc=fonseca@diku.dk \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).