Coccinelle Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: mcgrof@do-not-panic.com (Luis R. Rodriguez)
To: cocci@systeme.lip6.fr
Subject: [Cocci] [PATCH 1/2] autotools: unify the way to determine version information
Date: Tue, 21 Jul 2015 13:51:00 -0700	[thread overview]
Message-ID: <1437511861-2205-2-git-send-email-mcgrof@do-not-panic.com> (raw)
In-Reply-To: <1437511861-2205-1-git-send-email-mcgrof@do-not-panic.com>

From: "Luis R. Rodriguez" <mcgrof@suse.com>

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. Then if we update
how we get the version information it just needs to be done
in one place.

We make the version.sh script use old shell mechanisms to be
able to work on any supported unix system.

Cc: Peter Senna Tschudin <peter.senna@gmail.com>
Cc: Nikolay Orlyuk <virkony@gmail.com>
Cc: S?bastien Hinderer <Sebastien.Hinderer@inria.fr>
Cc: Quentin Lambert <lambert.quentin@gmail.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@suse.com>
---
 Makefile     | 2 +-
 configure.ac | 2 +-
 version.sh   | 3 +++
 3 files changed, 5 insertions(+), 2 deletions(-)
 create mode 100755 version.sh

diff --git a/Makefile b/Makefile
index fd369415b1ec..cff8412019fa 100644
--- a/Makefile
+++ b/Makefile
@@ -19,7 +19,7 @@ endif
 -include /etc/Makefile.coccinelle  # local customizations, if any
 
 
-VERSION=$(shell cat ./version | tr -d '\n')
+VERSION=$(shell ./version.sh | 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' )
diff --git a/configure.ac b/configure.ac
index d4072004228c..679660956401 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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 | tr -d '\n']), [cocci at systeme.lip6.fr], [], [http://coccinelle.lip6.fr/])
 AC_CONFIG_MACRO_DIR([setup])
 AC_CONFIG_AUX_DIR([setup])
 AC_SUBST([CONFIGURE_FLAGS], ["$*"])
diff --git a/version.sh b/version.sh
new file mode 100755
index 000000000000..f18206344a76
--- /dev/null
+++ b/version.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+VERSION=`cat ./version | tr -d '\n'`
+printf '%s' $VERSION
-- 
2.3.2.209.gd67f9d5.dirty

  reply	other threads:[~2015-07-21 20:51 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-21 20:50 [Cocci] [PATCH 0/2] coccinelle: add localversion information Luis R. Rodriguez
2015-07-21 20:51 ` Luis R. Rodriguez [this message]
2015-07-23  4:18   ` [Cocci] [PATCH 1/2] autotools: unify the way to determine version information Nikolay Orlyuk
2015-07-23  7:12     ` Sébastien Hinderer
2015-07-24 18:53       ` Luis R. Rodriguez
2015-07-31 13:40         ` [Cocci] " SF Markus Elfring
2015-08-05 21:13           ` Luis R. Rodriguez
2015-07-24 17:12     ` [Cocci] [PATCH 1/2] " Luis R. Rodriguez
2015-07-26  6:55       ` Nikolay Orlyuk
2015-07-27 19:26         ` Luis R. Rodriguez
2015-07-21 20:51 ` [Cocci] [PATCH 2/2] autotools: add localversion information Luis R. Rodriguez

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=1437511861-2205-2-git-send-email-mcgrof@do-not-panic.com \
    --to=mcgrof@do-not-panic.com \
    --cc=cocci@systeme.lip6.fr \
    /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