public inbox for powertop@lists.linux.dev
 help / color / mirror / Atom feed
From: Magnus Fromreide <magfr at lysator.liu.se>
To: powertop@lists.01.org
Subject: Re: [Powertop] [PATCH v1 2/3] configure.ac: version strings from git describe
Date: Sat, 06 Aug 2016 03:53:36 +0200	[thread overview]
Message-ID: <20160806015336.GA11403@noemi> (raw)
In-Reply-To: 1470425241-215266-3-git-send-email-joe.konno@linux.intel.com

[-- Attachment #1: Type: text/plain, Size: 3318 bytes --]

On Fri, Aug 05, 2016 at 12:27:20PM -0700, Joe Konno wrote:
> From: Joe Konno <joe.konno(a)intel.com>
> 
> There are two version strings we need during runtime: a long version
> (for reports and --version), and a short version for the ncurses UI. Use
> a utility script to generate those strings (version-long and
> version-short) which will be cat'ed by configure and bundled when 'make
> dist' is run.
> 
> Signed-off-by: Joe Konno <joe.konno(a)intel.com>

What happens if I build this from a distributed package, i.e.

./configure
make dist
ta xzf powertop-version.tar.gz
cd powertop-version
./configure
make

This would normally create a package with no git version info so the version
scripts couldn't work.

This could obviously be regarded as an unsupported case but if so then I think
it should be said so explicitly.

/MF

> ---
>  .gitignore      |  1 +
>  Makefile.am     |  2 ++
>  autogen.sh      |  1 +
>  configure.ac    |  5 ++++-
>  scripts/version | 13 +++++++++++++
>  5 files changed, 21 insertions(+), 1 deletion(-)
>  create mode 100644 scripts/version
> 
> diff --git a/.gitignore b/.gitignore
> index 7eb138a094ce..ef817dc076bd 100644
> --- a/.gitignore
> +++ b/.gitignore
> @@ -87,4 +87,5 @@ Makefile.in
>  /src/powertop
>  /stamp-h1
>  /stamp-po
> +/version*
>  tags
> diff --git a/Makefile.am b/Makefile.am
> index b519d110a118..3aabb22eca6e 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -14,4 +14,6 @@ EXTRA_DIST = \
>  	TODO \
>  	Android.mk \
>  	COPYING \
> +	version-long \
> +	version-short \
>  	autogen.sh
> diff --git a/autogen.sh b/autogen.sh
> index e210037d70e0..444f9998f806 100755
> --- a/autogen.sh
> +++ b/autogen.sh
> @@ -1,3 +1,4 @@
>  #!/bin/sh	
>  
> +sh scripts/version
>  autoreconf --install --verbose
> diff --git a/configure.ac b/configure.ac
> index 646b402101bb..ccfbf7ee0bb8 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -2,7 +2,8 @@
>  # Process this file with autoconf to produce a configure script.
>  
>  AC_PREREQ([2.68])
> -AC_INIT([powertop], [2.9-pre], [powertop(a)lists.01.org], [], [https://01.org/powertop])
> +AC_INIT([powertop], m4_esyscmd_s([cat version-long]),
> +	[powertop(a)lists.01.org], [], [https://01.org/powertop])
>  AM_INIT_AUTOMAKE([
>  	-Wall
>  	1.12.2
> @@ -149,5 +150,7 @@ AC_SEARCH_LIBS([inet_aton], [resolv], [], [
>  	AC_MSG_ERROR([libresolv is required but was not found])
>  ], [])
>  
> +AC_DEFINE([PACKAGE_SHORT_VERSION], m4_esyscmd_s([cat version-short]),
> +	[Short package version])
>  
>  AC_OUTPUT
> diff --git a/scripts/version b/scripts/version
> new file mode 100644
> index 000000000000..348b13d9f785
> --- /dev/null
> +++ b/scripts/version
> @@ -0,0 +1,13 @@
> +#!/bin/sh
> +
> +git branch > /dev/null 2>&1
> +if [ "$?" = "0" ]; then
> +	LONG=$(git describe --abbrev=7 --tags --always --dirty 2> /dev/null)
> +	SHORT=\"$(git describe --tags --abbrev=0 2> /dev/null)\"
> +else
> +	LONG="RUN-VERSION-SCRIPT-IN-GIT-REPOSITORY-ONLY"
> +	SHORT=\"$LONG\"
> +fi
> +
> +echo $LONG  > version-long
> +echo $SHORT > version-short
> -- 
> 1.8.3.1
> 
> _______________________________________________
> PowerTop mailing list
> PowerTop(a)lists.01.org
> https://lists.01.org/mailman/listinfo/powertop

             reply	other threads:[~2016-08-06  1:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-06  1:53 Magnus Fromreide [this message]
  -- strict thread matches above, loose matches on Subject: below --
2016-08-08 15:49 [Powertop] [PATCH v1 2/3] configure.ac: version strings from git describe Joe Konno
2016-08-06 12:14 
2016-08-05 19:27 Joe Konno

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=20160806015336.GA11403@noemi \
    --to=powertop@lists.01.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