Skip to contentSkip to conversation

coccinelle: add localversion information

PATCH In review Luis R. Rodriguez 4 participants 10 messages Jul 27, 2015 – Aug 5, 2015 Kbuild

lore
Share & tools
lore
#0 lore raw

v3 cover coccinelle: add localversion information

From: "Luis R. Rodriguez" <[email protected]>

This v3 makes use of the recommended strategy by Nikolay to avoid a local variable for the version.sh. It also clarifies in the commit log on patch 2 that PGP signed tags are not required by default. If Coccinelle switches over to using PGP tags the scripts/setlocalversion file can be modified to require them, but for now this is disabled.

Lastly, in order to try to help simplify the way release managers might make a release in a linear fashion with a git tree I modified autogen.sh to accept a new argument:

./autogen --ignore_localversion

which can be used by release managers to skip the local version string when making a release. This is in contrast to my v2 series which would have otherwise required release managers to make temporary tags, delete them, and them finally add a new tag later. This is much simpler solution.

The default is to parse the localversion string then if available.

Luis R. Rodriguez (2):
autotools: simplify the way to determine version information
autotools: add localversion information

 Makefile                |   1 -
 Makefile.config.in      |   2 +
 autogen                 |   5 +++
 configure.ac            |   2 +-
 scripts/setlocalversion | 117 ++++++++++++++++++++++++++++++++++++++++++++++++
 version.sh              |   5 +++
 6 files changed, 130 insertions(+), 2 deletions(-)
 create mode 100755 scripts/setlocalversion
 create mode 100755 version.sh
Signature · 1 line
2.3.2.209.gd67f9d5.dirty
#1 lore raw

PATCH v3 1/2 autotools: simplify the way to determine version information

From: "Luis R. Rodriguez" <[email protected]>

The version information you get when you run: spatch --version comes from what ./confgure.ac ends up figuring out for you. The top level Makefile uses the same mechanism to tell you and use the version information at build time, but if the strategy is updated in one place it would need to be updated in both places.

Avoid this duplicatin of work and instead just make version information come from ./version.sh script. We also remove the Makefile version of determining the version information and instead rely on the fact that Makefile.config.in is part of AC_CONFIG_FILES() and have AC_SUBST([COCCI_VERSION], ["$PACKAGE_VERSION"]) in place.

Cc Peter Senna Tschudin <[email protected]>
Cc Nikolay Orlyuk <[email protected]>
Cc S?bastien Hinderer <[email protected]>
Cc Quentin Lambert <[email protected]>
---
 Makefile           | 1 -
 Makefile.config.in | 2 ++
 configure.ac       | 2 +-
 version.sh         | 2 ++
 4 files changed, 5 insertions(+), 2 deletions(-)
 create mode 100755 version.sh
Makefile +0 -1
index fd369415b1ec..f8c99d3bb8d8 100644
@@ -19,7 +19,6 @@ endif
 -include /etc/Makefile.coccinelle  # local customizations, if any
 
 
-VERSION=$(shell cat ./version | tr -d '\n')
 CCVERSION=$(shell cat scripts/coccicheck/README | egrep -o '[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+' | head -n1)
 PKGVERSION=$(shell dpkg-parsechangelog -ldebian/changelog.$(DISTRIB_CODENAME) 2> /dev/null \
 	 | sed -n 's/^Version: \(.*\)/\1/p' )
Makefile.config.in +2 -0
index 5eb7ac496fd3..ee23e09f29ce 100644
@@ -1,3 +1,5 @@
+VERSION=@PACKAGE_VERSION@
+
 # * for each library $1, add another entry in the same manner
 MAKELIBS=@MAKE_dynlink@ @MAKE_menhirLib@ @MAKE_pycaml@ @MAKE_pcre@ \
   @MAKE_parmap@
configure.ac +1 -1
index d4072004228c..4c610afa5a2d 100644
@@ -3,7 +3,7 @@ dnl  run 'automake -acf' to update setup/{install-sh,missing}
 
 dnl  standard initialization (we only use autoconf not automake)
 AC_PREREQ([2.68])
-AC_INIT([coccinelle], m4_esyscmd([cat ./version | tr -d '\n']), [cocci at systeme.lip6.fr], [], [http://coccinelle.lip6.fr/])
+AC_INIT([coccinelle], m4_esyscmd([./version.sh]), [cocci at systeme.lip6.fr], [], [http://coccinelle.lip6.fr/])
 AC_CONFIG_MACRO_DIR([setup])
 AC_CONFIG_AUX_DIR([setup])
 AC_SUBST([CONFIGURE_FLAGS], ["$*"])
version.sh new file +2 -0
new file mode 100755
index 000000000000..02a5b7253ba9
@@ -0,0 +1,2 @@
+#!/bin/sh
+tr -d '\n' < ./version
Signature · 1 line
2.3.2.209.gd67f9d5.dirty
#2 lore raw

PATCH v3 1/2 autotools: simplify the way to determine version information

configure.ac dnl run 'automake -acf' to update setup/{install-sh,missing} · line 6

Quoted 2 lines
configure.ac +1 -1
-AC_INIT([coccinelle], m4_esyscmd([cat ./version | tr -d '\n']), [cocci at systeme.lip6.fr], [], [http://coccinelle.lip6.fr/])
+AC_INIT([coccinelle], m4_esyscmd([./version.sh]), [cocci at systeme.lip6.fr], [], [http://coccinelle.lip6.fr/])

I find such a fine-tuning of a build script interesting.

Can it be that this update will only get active if the script "configure" can be regenerated by a command like "autoreconf --install"?
http://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.69/html_node/autoreconf-Invocation.html

Regards,
Markus

#3 lore raw

PATCH v3 1/2 autotools: simplify the way to determine version information

Quoted 8 lines · SF Markus Elfring

configure.ac dnl run 'automake -acf' to update setup/{install-sh,missing} · line 6

Quoted 2 lines
configure.ac +1 -1
-AC_INIT([coccinelle], m4_esyscmd([cat ./version | tr -d '\n']), [cocci at systeme.lip6.fr], [], [http://coccinelle.lip6.fr/])
+AC_INIT([coccinelle], m4_esyscmd([./version.sh]), [cocci at systeme.lip6.fr], [], [http://coccinelle.lip6.fr/])

I find such a fine-tuning of a build script interesting.

Can it be that this update will only get active if the script "configure" can be regenerated by a command like "autoreconf --install"?
http://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.69/html_node/autoreconf-Invocation.html

I tested it and it worked so that was not needed.

Luis

#4 lore raw

PATCH v3 2/2 autotools: add localversion information

In reply to Luis R. Rodriguez

From: "Luis R. Rodriguez" <[email protected]>

When someone is building Coccinelle from source on a git tree with some modifications we currently cannot tell what type of modifications, if any, were done. Add a localversion info postix which will be pegged onto the version string *iff* the git tree used has either a change non-commited yet or if the git tree has some commits beyond what was officially released and tagged. This also lets release managers skip the local version postfix tag when preparing an official coccinelle release, by using:

./autogen --ignore_localversion

This can be used by release managers when preparing a release prior to pegging a release with a tag, so that the released default configure scripts can be commited prior to marking the git tree with a release tag. This is disabled by default, so that the only way that you won't get a postfix is if you used a blessed official release.

If you have a dirty tree with some uncommited changes the version will be postfixed with -dirty. For example if 1.0.2 was blessed and released and you had a series of uncommited changes you'd end yup with:

1.0.2-dirty

Likewise if your tree has some commits not upstream these will be reflected. For instance, say you had one extra commit, you'd end up with:

1.0.2-00001-g8870d8b0cf33

The purpose of this is to enable developers and tools within Coccinelle to be able to tell when folks have modified upstream code.

The setlocalversion file was take and modified from the Linux kernel, it was repurposed for Coccinelle by just simplifying it by hardcoding it to use the long version string if there is any delta. It also supports unsigned and un-annotated tags (how Coccinelle makes releases today), and enables folks to easily switch to forcing PGP signed tags if that is desirable at a later time. For now it does not require PGP signed tags at all. The way non-PGP tags are supported is by using 'git describe --tags', this is supported on the scripts/setlocalversion file by setting the variable TAGS by default to:

TAGS="--tags"

If coccinelle wishes to require PGP signed tags at any point in time later this line can simpy be removed or set to an empty string.

Release managers:

Say you have a linear set of history and you are about to make a 1.0.2 release, you'd can do tthis:

a) Edit the version file and bump it to 1.0.2
b) Run: git clean -f -x -d
d) Run: ./autogen --ignore_localversion
e) git commit -a -s
g) Run: git tag 1.0.2

When working from source, the average user and developer will run just ./autogen, this will peg the local version into the version string. Likewise if no git tree exists they'll get the default version string.

Cc Peter Senna Tschudin <[email protected]>
Cc Nikolay Orlyuk <[email protected]>
Cc S?bastien Hinderer <[email protected]>
Cc Quentin Lambert <[email protected]>
---
 autogen                 |   5 +++
 scripts/setlocalversion | 117 ++++++++++++++++++++++++++++++++++++++++++++++++
 version.sh              |   3 ++
 3 files changed, 125 insertions(+)
 create mode 100755 scripts/setlocalversion
autogen +5 -0
index 424edade2d46..31c0630aa403 100755
@@ -1,3 +1,8 @@
 #!/bin/sh
+if [ "$1" = "--ignore_localversion" ]; then
+	export MAKE_COCCI_RELEASE="y"
+else
+	unset MAKE_COCCI_RELEASE
+fi
 aclocal -I setup
 autoconf
scripts/setlocalversion new file +117 -0

117 lines not on this page · raw message

version.sh +3 -0
index 02a5b7253ba9..2bf6587a5760 100755
@@ -1,2 +1,5 @@
 #!/bin/sh
 tr -d '\n' < ./version
+if test "x$MAKE_COCCI_RELEASE" = "x"; then
+	./scripts/setlocalversion | tr -d '\n'
+fi
Signature · 1 line
2.3.2.209.gd67f9d5.dirty
#5 lore raw

PATCH v3 2/2 autotools: add localversion information

Quoted 8 lines

Say you have a linear set of history and you are about to make a 1.0.2 release, you'd can do tthis:

a) Edit the version file and bump it to 1.0.2
b) Run: git clean -f -x -d
d) Run: ./autogen --ignore_localversion
e) git commit -a -s
g) Run: git tag 1.0.2

The actual version release process seems to be this (extracted from Makefile.release):

        @echo "\n\tEdit ./version"
        @echo "\n\tRun ./autogen"

        $(GIT) add ./version
        $(GIT) add ./configure
        $(GIT) add setup/Makefile.in
        $(GIT) commit -m "Release $(VERSION)"
        $(GIT) tag -a -m "Release $(VERSION)" $(VERSION)
        $(GIT) push origin $(VERSION)

(except that the push doesn't seem to happen...). So the idea would be just to modify the second "echo" line to add the argument --ignore_localversion?

julia

Quoted 170 lines

When working from source, the average user and developer will run just ./autogen, this will peg the local version into the version string. Likewise if no git tree exists they'll get the default version string.

Cc Peter Senna Tschudin <[email protected]>
Cc Nikolay Orlyuk <[email protected]>
Cc S?bastien Hinderer <[email protected]>
Cc Quentin Lambert <[email protected]>
---
 autogen                 |   5 +++
 scripts/setlocalversion | 117 ++++++++++++++++++++++++++++++++++++++++++++++++
 version.sh              |   3 ++
 3 files changed, 125 insertions(+)
 create mode 100755 scripts/setlocalversion
autogen +5 -0
index 424edade2d46..31c0630aa403 100755
@@ -1,3 +1,8 @@
 #!/bin/sh
+if [ "$1" = "--ignore_localversion" ]; then
+	export MAKE_COCCI_RELEASE="y"
+else
+	unset MAKE_COCCI_RELEASE
+fi
 aclocal -I setup
 autoconf
scripts/setlocalversion new file +117 -0
new file mode 100755
index 000000000000..728b54e9ee9f
@@ -0,0 +1,117 @@
+#!/bin/sh
+#
+# Copyright (c) 2005-2006 Ryan Anderson <[email protected]>
+# Copyright (c) 2006 Rene Scharfe <[email protected]>
+# Copyright (c) 2006 Uwe Zeisberger <[email protected]>
+# Copyright (c) 2007 Aron Griffis <[email protected]>
+# Copyright (c) 2007 Theodore Ts'o <[email protected]>
+# Copyright (c) 2008 Bryan Wu <[email protected]>
+# Copyright (c) 2008 Mike Frysinger <[email protected]>
+# Copyright (c) 2008 Peter Korsgaard <[email protected]>
+# Copyright (c) 2008 Sebastian Siewior <[email protected]>
+# Copyright (c) 2008 Trent Piepho <[email protected]>
+# Copyright (c) 2009 Mike Frysinger <[email protected]>
+# Copyright (c) 2009 Nico Schottelius <[email protected]>
+# Copyright (c) 2009 Peter Korsgaard <[email protected]>
+# Copyright (c) 2010 Linus Torvalds <[email protected]>
+# Copyright (c) 2010 Michael Prokop <[email protected]>
+# Copyright (c) 2010 Micha? G?rny <[email protected]>
+# Copyright (c) 2010 Michal Marek <[email protected]>
+# Copyright (c) 2010 Milton Miller <[email protected]>
+# Copyright (c) 2011 Mike Crowe <[email protected]>
+# Copyright (c) 2012 Roland Dreier <[email protected]>
+# Copyright (c) 2013 Christian Kujau <[email protected]>
+# Copyright (c) 2013 Christophe Leroy <[email protected]>
+# Copyright (c) 2013 Franck Bui-Huu <[email protected]>
+# Copyright (c) 2015 Luis R. Rodriguez <[email protected]>
+#
+# This file is released under the GPLv2.
+#
+# Taken from the Linux kernel as of v4.2-rc2 with a few modifications
+# described below.
+#
+# This scripts adds local version information from the version
+# control systems. It was taken from the Linux kernel as of v4.2-rc2
+# and simplified for use on Coccinelle by mcgrof. The version info
+# was hard coded to use long version. The svn postfix details were
+# also removed. I also added the option to enable this script to
+# work well for trees that do not use PGP signed tags or annotated
+# tags (git tag -s or git tag -a), git describe by default will only
+# look for these tags. If you do not use these you will want to set
+# the below variable to TAGS="--tags". If  you requires --tags, consider
+# to start signing your releases "git tag -s" and use a subkey for that.
+# If you do that, consider also using another PGP subkey for annotating
+# releases as deprecated.
+#
+# Set to emtpy variable if you use properly signed tags. You should do this!
+TAGS="--tags"
+
+srctree=.
+
+scm_version()
+{
+	local short
+	short=false
+
+
+	# Check for git and a git repo.
+	if test -z "$(git rev-parse --show-cdup 2>/dev/null)" &&
+	   head=`git rev-parse --verify --short HEAD 2>/dev/null`; then
+
+		# If we are at a tagged commit (like "v2.6.30-rc6"), we ignore
+		# it, because this version is defined in the top level Makefile.
+		if [ -z "`git describe $TAGS --exact-match 2>/dev/null`" ]; then
+
+			# If only the short version is requested, don't bother
+			# running further git commands
+			if $short; then
+				echo "+"
+				return
+			fi
+			# If we are past a tagged commit (like
+			# "v2.6.30-rc5-302-g72357d5"), we pretty print it.
+			if atag="`git describe $TAGS 2>/dev/null`"; then
+				echo "$atag" | awk -F- '{printf("-%05d-%s", $(NF-1),$(NF))}'
+
+			# If we don't have a tag at all we print -g{commitish}.
+			else
+				printf '%s%s' -g $head
+			fi
+		fi
+
+		# Check for uncommitted changes
+		if git diff-index --name-only HEAD | grep -qv "^scripts/package"; then
+			printf '%s' -dirty
+		fi
+
+		# All done with git
+		return
+	fi
+
+	# Check for mercurial and a mercurial repo.
+	if test -d .hg && hgid=`hg id 2>/dev/null`; then
+		# Do we have an tagged version?  If so, latesttagdistance == 1
+		if [ "`hg log -r . --template '{latesttagdistance}'`" == "1" ]; then
+			id=`hg log -r . --template '{latesttag}'`
+			printf '%s%s' -hg "$id"
+		else
+			tag=`printf '%s' "$hgid" | cut -d' ' -f2`
+			if [ -z "$tag" -o "$tag" = tip ]; then
+				id=`printf '%s' "$hgid" | sed 's/[+ ].*//'`
+				printf '%s%s' -hg "$id"
+			fi
+		fi
+
+		# Are there uncommitted changes?
+		# These are represented by + after the changeset id.
+		case "$hgid" in
+			*+|*+\ *) printf '%s' -dirty ;;
+		esac
+
+		# All done with mercurial
+		return
+	fi
+}
+
+res="$res$(scm_version)"
+echo "$res"
version.sh +3 -1
index 02a5b7253ba9..2bf6587a5760 100755
@@ -1,2 +1,5 @@
 #!/bin/sh
 tr -d '\n' < ./version
+if test "x$MAKE_COCCI_RELEASE" = "x"; then
+	./scripts/setlocalversion | tr -d '\n'
+fi
--

2.3.2.209.gd67f9d5.dirty

_______________________________________________
Cocci mailing list
Cocci at systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

#6 lore raw

PATCH v3 2/2 autotools: add localversion information

Quoted 23 lines · Julia Lawall
Quoted 9 lines

Say you have a linear set of history and you are about to make a 1.0.2 release, you'd can do tthis:

a) Edit the version file and bump it to 1.0.2
b) Run: git clean -f -x -d
d) Run: ./autogen --ignore_localversion
e) git commit -a -s
g) Run: git tag 1.0.2

The actual version release process seems to be this (extracted from Makefile.release):

        @echo "\n\tEdit ./version"
        @echo "\n\tRun ./autogen"

        $(GIT) add ./version
        $(GIT) add ./configure
        $(GIT) add setup/Makefile.in
        $(GIT) commit -m "Release $(VERSION)"
        $(GIT) tag -a -m "Release $(VERSION)" $(VERSION)
        $(GIT) push origin $(VERSION)
Quoted 3 lines

(except that the push doesn't seem to happen...). So the idea would be just to modify the second "echo" line to add the argument --ignore_localversion?

Yes.

Luis

Quoted 14 lines

julia

Quoted 12 lines

When working from source, the average user and developer will run just ./autogen, this will peg the local version into the version string. Likewise if no git tree exists they'll get the default version string.

Cc Peter Senna Tschudin <[email protected]>
Cc Nikolay Orlyuk <[email protected]>
Cc S?bastien Hinderer <[email protected]>
Cc Quentin Lambert <[email protected]>
---
 autogen                 |   5 +++
 scripts/setlocalversion | 117

++++++++++++++++++++++++++++++++++++++++++++++++

Quoted 20 lines
Quoted 20 lines
 version.sh              |   3 ++
 3 files changed, 125 insertions(+)
 create mode 100755 scripts/setlocalversion
autogen +5 -0
index 424edade2d46..31c0630aa403 100755
@@ -1,3 +1,8 @@
 #!/bin/sh
+if [ "$1" = "--ignore_localversion" ]; then
+     export MAKE_COCCI_RELEASE="y"
+else
+     unset MAKE_COCCI_RELEASE
+fi
 aclocal -I setup
 autoconf
scripts/setlocalversion new file +0 -0
new file mode 100755
index 000000000000..728b54e9ee9f
Quoted 8 lines

scripts/setlocalversion line 5

Quoted 8 lines
scripts/setlocalversion new file +5 -0
@@ -0,0 +1,117 @@
+#!/bin/sh
+#
+# Copyright (c) 2005-2006 Ryan Anderson <[email protected]>
+# Copyright (c) 2006 Rene Scharfe <[email protected]>
+# Copyright (c) 2006 Uwe Zeisberger <

[email protected]>

Quoted 9 lines

scripts/setlocalversion

Quoted 9 lines
scripts/setlocalversion new file +9 -0
+# Copyright (c) 2007 Aron Griffis <[email protected]>
+# Copyright (c) 2007 Theodore Ts'o <[email protected]>
+# Copyright (c) 2008 Bryan Wu <[email protected]>
+# Copyright (c) 2008 Mike Frysinger <[email protected]>
+# Copyright (c) 2008 Peter Korsgaard <[email protected]>
+# Copyright (c) 2008 Sebastian Siewior <[email protected]>
+# Copyright (c) 2008 Trent Piepho <[email protected]>
+# Copyright (c) 2009 Mike Frysinger <[email protected]>
+# Copyright (c) 2009 Nico Schottelius <

[email protected]>

Quoted 19 lines
Quoted 19 lines
scripts/setlocalversion new file +19 -0
+# Copyright (c) 2009 Peter Korsgaard <[email protected]>
+# Copyright (c) 2010 Linus Torvalds <[email protected]>
+# Copyright (c) 2010 Michael Prokop <[email protected]>
+# Copyright (c) 2010 Micha? G?rny <[email protected]>
+# Copyright (c) 2010 Michal Marek <[email protected]>
+# Copyright (c) 2010 Milton Miller <[email protected]>
+# Copyright (c) 2011 Mike Crowe <[email protected]>
+# Copyright (c) 2012 Roland Dreier <[email protected]>
+# Copyright (c) 2013 Christian Kujau <[email protected]>
+# Copyright (c) 2013 Christophe Leroy <[email protected]>
+# Copyright (c) 2013 Franck Bui-Huu <[email protected]>
+# Copyright (c) 2015 Luis R. Rodriguez <[email protected]>
+#
+# This file is released under the GPLv2.
+#
+# Taken from the Linux kernel as of v4.2-rc2 with a few modifications
+# described below.
+#
+# This scripts adds local version information from the version
Quoted 8 lines

scripts/setlocalversion

Quoted 8 lines
scripts/setlocalversion new file +8 -0
+# control systems. It was taken from the Linux kernel as of v4.2-rc2
+# and simplified for use on Coccinelle by mcgrof. The version info
+# was hard coded to use long version. The svn postfix details were
+# also removed. I also added the option to enable this script to
+# work well for trees that do not use PGP signed tags or annotated
+# tags (git tag -s or git tag -a), git describe by default will only
+# look for these tags. If you do not use these you will want to set
+# the below variable to TAGS="--tags". If  you requires --tags,

consider

Quoted 1 line

scripts/setlocalversion line 42

Quoted 1 line
scripts/setlocalversion new file +1 -0
+# to start signing your releases "git tag -s" and use a subkey for

that.

Quoted 4 lines

scripts/setlocalversion

Quoted 4 lines
scripts/setlocalversion new file +4 -0
+# If you do that, consider also using another PGP subkey for annotating
+# releases as deprecated.
+#
+# Set to emtpy variable if you use properly signed tags. You should do

this!

Quoted 7 lines
Quoted 7 lines
scripts/setlocalversion new file +7 -0
+TAGS="--tags"
+
+srctree=.
+
+scm_version()
+{
+     local short
Quoted 8 lines

scripts/setlocalversion

Quoted 8 lines
scripts/setlocalversion new file +8 -0
+     short=false
+
+
+     # Check for git and a git repo.
+     if test -z "$(git rev-parse --show-cdup 2>/dev/null)" &&
+        head=`git rev-parse --verify --short HEAD 2>/dev/null`; then
+
+             # If we are at a tagged commit (like "v2.6.30-rc6"), we

ignore

Quoted 1 line

scripts/setlocalversion line 62

Quoted 1 line
scripts/setlocalversion new file +1 -0
+             # it, because this version is defined in the top level

Makefile.

Quoted 1 line

scripts/setlocalversion line 63

Quoted 1 line
scripts/setlocalversion new file +1 -0
+             if [ -z "`git describe $TAGS --exact-match 2>/dev/null`"

]; then

Quoted 2 lines

scripts/setlocalversion line 65

Quoted 2 lines
scripts/setlocalversion new file +2 -0
+
+                     # If only the short version is requested, don't

bother

Quoted 9 lines

scripts/setlocalversion

Quoted 9 lines
scripts/setlocalversion new file +9 -0
+                     # running further git commands
+                     if $short; then
+                             echo "+"
+                             return
+                     fi
+                     # If we are past a tagged commit (like
+                     # "v2.6.30-rc5-302-g72357d5"), we pretty print it.
+                     if atag="`git describe $TAGS 2>/dev/null`"; then
+                             echo "$atag" | awk -F-

'{printf("-%05d-%s", $(NF-1),$(NF))}'

Quoted 2 lines

scripts/setlocalversion line 76

Quoted 2 lines
scripts/setlocalversion new file +2 -0
+
+                     # If we don't have a tag at all we print

-g{commitish}.

Quoted 7 lines

scripts/setlocalversion

Quoted 7 lines
scripts/setlocalversion new file +7 -0
+                     else
+                             printf '%s%s' -g $head
+                     fi
+             fi
+
+             # Check for uncommitted changes
+             if git diff-index --name-only HEAD | grep -qv

"^scripts/package"; then

Quoted 10 lines

scripts/setlocalversion

Quoted 10 lines
scripts/setlocalversion new file +10 -0
+                     printf '%s' -dirty
+             fi
+
+             # All done with git
+             return
+     fi
+
+     # Check for mercurial and a mercurial repo.
+     if test -d .hg && hgid=`hg id 2>/dev/null`; then
+             # Do we have an tagged version?  If so, latesttagdistance

== 1

Quoted 1 line

scripts/setlocalversion line 94

Quoted 1 line
scripts/setlocalversion new file +1 -0
+             if [ "`hg log -r . --template '{latesttagdistance}'`" ==

"1" ]; then

Quoted 6 lines

scripts/setlocalversion

Quoted 6 lines
scripts/setlocalversion new file +6 -0
+                     id=`hg log -r . --template '{latesttag}'`
+                     printf '%s%s' -hg "$id"
+             else
+                     tag=`printf '%s' "$hgid" | cut -d' ' -f2`
+                     if [ -z "$tag" -o "$tag" = tip ]; then
+                             id=`printf '%s' "$hgid" | sed 's/[+

].*//'`

Quoted 30 lines
Quoted 30 lines
scripts/setlocalversion new file +17 -0
+                             printf '%s%s' -hg "$id"
+                     fi
+             fi
+
+             # Are there uncommitted changes?
+             # These are represented by + after the changeset id.
+             case "$hgid" in
+                     *+|*+\ *) printf '%s' -dirty ;;
+             esac
+
+             # All done with mercurial
+             return
+     fi
+}
+
+res="$res$(scm_version)"
+echo "$res"
version.sh +3 -1
index 02a5b7253ba9..2bf6587a5760 100755
@@ -1,2 +1,5 @@
 #!/bin/sh
 tr -d '\n' < ./version
+if test "x$MAKE_COCCI_RELEASE" = "x"; then
+     ./scripts/setlocalversion | tr -d '\n'
+fi
--

2.3.2.209.gd67f9d5.dirty

Quoted 5 lines
Quoted 5 lines

_______________________________________________
Cocci mailing list
Cocci at systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://systeme.lip6.fr/pipermail/cocci/attachments/20150730/a0779861/attachment-0001.html>

#7 lore raw

[Cocci] autotools: add localversion information

In reply to Luis R. Rodriguez
Quoted 2 lines

When working from source, the average user and developer will run just ./autogen, this will peg the local version into the version string.

How do you think about to collaborate with a command like "autoreconf --install"?
http://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.69/html_node/autoreconf-Invocation.html

Do the available build scripts need any more clean-up and improvements?
https://github.com/coccinelle/coccinelle/blob/e7dd46783d6addd7efad735144d85ed8fde841ce/configure.ac#L11

Regards,
Markus

#8 lore raw

[Cocci] autotools: add localversion information

Quoted 5 lines · SF Markus Elfring
Quoted 2 lines

When working from source, the average user and developer will run just ./autogen, this will peg the local version into the version string.

How do you think about to collaborate with a command like "autoreconf --install"?
http://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.69/html_node/autoreconf-Invocation.html

Huh? I'll do the least work possible to muck with autoconf crap.

Quoted 2 lines

Do the available build scripts need any more clean-up and improvements?
https://github.com/coccinelle/coccinelle/blob/e7dd46783d6addd7efad735144d85ed8fde841ce/configure.ac#L11

That's such a general and braod question. The answer is: like with any system, tons, so take your pick and work on it if you wish.

Luis

#9 lore raw

v3 cover coccinelle: add localversion information

In reply to Luis R. Rodriguez
Quoted 19 lines · Luis R. Rodriguez

From: "Luis R. Rodriguez" <[email protected]>

This v3 makes use of the recommended strategy by Nikolay to avoid a local variable for the version.sh. It also clarifies in the commit log on patch 2 that PGP signed tags are not required by default. If Coccinelle switches over to using PGP tags the scripts/setlocalversion file can be modified to require them, but for now this is disabled.

Lastly, in order to try to help simplify the way release managers might make a release in a linear fashion with a git tree I modified autogen.sh to accept a new argument:

./autogen --ignore_localversion

which can be used by release managers to skip the local version string when making a release. This is in contrast to my v2 series which would have otherwise required release managers to make temporary tags, delete them, and them finally add a new tag later. This is much simpler solution.

Quoted 5 lines

The default is to parse the localversion string then if available.

Luis R. Rodriguez (2):
autotools: simplify the way to determine version information
autotools: add localversion information

S?bastien, Nikolay, are you folks OK with this being merged?

Luis