public inbox for crossgcc@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] configure: support arbitrary versions via a shell script
@ 2011-11-13 23:10 Michael Hope
  2011-11-14  7:21 ` Yann E. MORIN
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Hope @ 2011-11-13 23:10 UTC (permalink / raw)
  To: Yann E. MORIN; +Cc: crossgcc

# HG changeset patch
# User Michael Hope <michael.hope@linaro.org>
# Date 1321225775 -46800
# Branch any-version
# Node ID 02572d8009f6a872ccd28d2e020b19772d7e8906
# Parent  3cd375ecdd7213104577bbd70863fa35f387bb93
configure: support arbitrary versions via a shell script

If the executable file '.version.sh' exists, then use its output for
the version.  Fall back to the contents of '.version' if the script
fails.

Note that .version.sh doesn't have to be a shell script.  I considered
making .version itself executable instead but this would cause trouble
with FAT based filesystems.

The fallback to .version is a bit dodgy.  Failing might be stricter
but is unfriendly.

Signed-off-by: Michael Hope <michael.hope@linaro.org>

diff -r 3cd375ecdd72 -r 02572d8009f6 configure
--- a/configure	Sun Nov 13 18:24:36 2011 +0100
+++ b/configure	Mon Nov 14 12:09:35 2011 +1300
@@ -2,7 +2,9 @@
 
 myname="${0##*/}"
 
-VERSION=$( cat .version )
+[ -f .version.sh -a -x .version.sh ] && VERSION=$( ./.version.sh )
+[ -z "${VERSION}" ] && VERSION=$( cat .version )
+
 DATE=$( date +%Y%m%d )
 
 PREFIX_DEFAULT=/usr/local

--
For unsubscribe information see http://sourceware.org/lists.html#faq

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] configure: support arbitrary versions via a shell script
  2011-11-13 23:10 [PATCH] configure: support arbitrary versions via a shell script Michael Hope
@ 2011-11-14  7:21 ` Yann E. MORIN
  2011-11-14 20:37   ` Michael Hope
  0 siblings, 1 reply; 5+ messages in thread
From: Yann E. MORIN @ 2011-11-14  7:21 UTC (permalink / raw)
  To: Michael Hope; +Cc: crossgcc

Michael,  All,

On Monday 14 November 2011 001022 Michael Hope wrote:
> # HG changeset patch
> # User Michael Hope <michael.hope@linaro.org>
> # Date 1321225775 -46800
> # Branch any-version
> # Node ID 02572d8009f6a872ccd28d2e020b19772d7e8906
> # Parent  3cd375ecdd7213104577bbd70863fa35f387bb93
> configure: support arbitrary versions via a shell script

I already pushed a similar change this WE:
  http://crosstool-ng.org/hg/crosstool-ng/rev/d77d04661cd9

I named the script 'version.sh', without a leading dot.

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +0/33 662376056 | Software  Designer | \ / CAMPAIGN     |   ^                |
| --==< O_o >==-- '------------.-------:  X  AGAINST      |  /e\  There is no  |
| http://ymorin.is-a-geek.org/ | (*_*) | / \ HTML MAIL    |  """  conspiracy.  |
'------------------------------'-------'------------------'--------------------'

--
For unsubscribe information see http://sourceware.org/lists.html#faq

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] configure: support arbitrary versions via a shell script
  2011-11-14  7:21 ` Yann E. MORIN
@ 2011-11-14 20:37   ` Michael Hope
  2011-11-14 21:17     ` Yann E. MORIN
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Hope @ 2011-11-14 20:37 UTC (permalink / raw)
  To: Yann E. MORIN; +Cc: crossgcc

On Mon, Nov 14, 2011 at 8:20 PM, Yann E. MORIN
<yann.morin.1998@anciens.enib.fr> wrote:
> Michael,  All,
>
> On Monday 14 November 2011 001022 Michael Hope wrote:
>> # HG changeset patch
>> # User Michael Hope <michael.hope@linaro.org>
>> # Date 1321225775 -46800
>> # Branch any-version
>> # Node ID 02572d8009f6a872ccd28d2e020b19772d7e8906
>> # Parent  3cd375ecdd7213104577bbd70863fa35f387bb93
>> configure: support arbitrary versions via a shell script
>
> I already pushed a similar change this WE:
>  http://crosstool-ng.org/hg/crosstool-ng/rev/d77d04661cd9
>
> I named the script 'version.sh', without a leading dot.

That sounds good.  There's a minor bug in your version:  ./configure
--help uses the version from .version instead of version.sh as
do_help() is called before version.sh is updated.

Then again, it had a similar problem before the patch: ./configure
--help would report crosstool-NG-hg instead of the full
crosstool-NG-hg-revno-foo.

Let me know if it's important and I can make a patch,

-- Michael

--
For unsubscribe information see http://sourceware.org/lists.html#faq

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] configure: support arbitrary versions via a shell script
  2011-11-14 20:37   ` Michael Hope
@ 2011-11-14 21:17     ` Yann E. MORIN
  2011-11-15  2:42       ` Michael Hope
  0 siblings, 1 reply; 5+ messages in thread
From: Yann E. MORIN @ 2011-11-14 21:17 UTC (permalink / raw)
  To: Michael Hope; +Cc: crossgcc

Michael, All,

On Monday 14 November 2011 21:37:15 Michael Hope wrote:
> That sounds good.  There's a minor bug in your version:  ./configure
> --help uses the version from .version instead of version.sh as
> do_help() is called before version.sh is updated.
> 
> Then again, it had a similar problem before the patch: ./configure
> --help would report crosstool-NG-hg instead of the full
> crosstool-NG-hg-revno-foo.

Indeed, the /issue/ was there previously as well.
So, it is not a regression! ;-)

> Let me know if it's important and I can make a patch,

I understand it could be confusing.
 - the easy way is to remove the version string from the help entry;
 - the proper way would be to move the version computation upward, but
   it needs ${sed} that is available only after the tests, which do not
   get run for --help.

So, we could just move the version calculations upward, print the pristine
version string in --help, and just mangle the string at the moment we need
it and can do it.

If the sight of the incorrect version string is absolutely untenable for
you, if your screen turns itself off so you don't get to see it, if you
lose your sanity at the mere thought of seeing the raw version, then by
all means, send a patch! ;-)

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

--
For unsubscribe information see http://sourceware.org/lists.html#faq

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] configure: support arbitrary versions via a shell script
  2011-11-14 21:17     ` Yann E. MORIN
@ 2011-11-15  2:42       ` Michael Hope
  0 siblings, 0 replies; 5+ messages in thread
From: Michael Hope @ 2011-11-15  2:42 UTC (permalink / raw)
  To: Yann E. MORIN; +Cc: crossgcc

On Tue, Nov 15, 2011 at 10:17 AM, Yann E. MORIN
<yann.morin.1998@anciens.enib.fr> wrote:
> Michael, All,
>
> On Monday 14 November 2011 21:37:15 Michael Hope wrote:
>> That sounds good.  There's a minor bug in your version:  ./configure
>> --help uses the version from .version instead of version.sh as
>> do_help() is called before version.sh is updated.
>>
>> Then again, it had a similar problem before the patch: ./configure
>> --help would report crosstool-NG-hg instead of the full
>> crosstool-NG-hg-revno-foo.
>
> Indeed, the /issue/ was there previously as well.
> So, it is not a regression! ;-)
>
>> Let me know if it's important and I can make a patch,
>
> I understand it could be confusing.
>  - the easy way is to remove the version string from the help entry;
>  - the proper way would be to move the version computation upward, but
>   it needs ${sed} that is available only after the tests, which do not
>   get run for --help.
>
> So, we could just move the version calculations upward, print the pristine
> version string in --help, and just mangle the string at the moment we need
> it and can do it.
>
> If the sight of the incorrect version string is absolutely untenable for
> you, if your screen turns itself off so you don't get to see it, if you
> lose your sanity at the mere thought of seeing the raw version, then by
> all means, send a patch! ;-)

The current version is fine,

-- Michael the nit-picker

--
For unsubscribe information see http://sourceware.org/lists.html#faq

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-11-15  2:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-13 23:10 [PATCH] configure: support arbitrary versions via a shell script Michael Hope
2011-11-14  7:21 ` Yann E. MORIN
2011-11-14 20:37   ` Michael Hope
2011-11-14 21:17     ` Yann E. MORIN
2011-11-15  2:42       ` Michael Hope

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 read-only IMAP folder(s) and NNTP newsgroup(s).