public inbox for powertop@lists.linux.dev
 help / color / mirror / Atom feed
To: powertop@lists.01.org
Subject: Re: [Powertop] [PATCH v1 2/3] configure.ac: version strings from git describe
Date: Sat, 06 Aug 2016 15:14:18 +0300	[thread overview]
Message-ID: <20160806121418.GA13520@obsidian> (raw)
In-Reply-To: 20160806015336.GA11403@noemi

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



On Sat, Aug 6, 2016 at 4:53 AM, Magnus Fromreide <magfr(a)lysator.liu.se> wrote:
> 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.
Version script is called from autogen, configure just uses already generated files (which are in dist tarball), so there is no problem (since it is expected that autogen is called within git repo). If one wants to support case of autogen-out-of-git-repo, he should add version script to dist and modify it like this:

---8<---
#!/bin/sh

: "${LONG_VERSION_PATH=version-long}"
: "${SHORT_VERSION_PATH=version-short}"
: "${DIST_SUFFIX=-dist}"

LONG=$(cat "${LONG_VERSION_PATH}" 2>/dev/null)
SHORT=$(cat "${SHORT_VERSION_PATH}" 2>/dev/null)

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
	[ -z "$LONG" -a -n "$SHORT" ] && LONG="${SHORT}"
	[ -z "$SHORT" -a -n "$LONG" ] && SHORT="${LONG}"

	if [ -z "$SHORT" -a -z "$LONG" ]
	then
		SHORT="${SHORT_VERSION-unknown}"
		LONG="${LONG_VERSION-unknown}"
	fi

	LONG="${LONG%${DIST_SUFFIX}}${DIST_SUFFIX}"
	SHORT="${SHORT%${DIST_SUFFIX}}${DIST_SUFFIX}"
fi

echo $LONG  > "${LONG_VERSION_PATH}"
echo $SHORT > "${SHORT_VERSION_PATH}"
--->8---

Two main points here — reading cached values at the start of the script and adding a dist prefix in order to signalize that this is out-of-repo configuration.

-- 
Eugene "eSyr" Syromyatnikov
mailto:evgSyr(a)gmail.com
xmpp:eSyr(a)jabber.{ru|org}

             reply	other threads:[~2016-08-06 12:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-06 12:14  [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  1:53 Magnus Fromreide
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=20160806121418.GA13520@obsidian \
    --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