All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] next try to update gettext version
@ 2014-06-10 10:08 Ruediger Meier
  2014-06-10 10:08 ` [PATCH] build-sys: use gettext 0.18.3 if possible Ruediger Meier
       [not found] ` <53974319.7040608@gmail.com>
  0 siblings, 2 replies; 11+ messages in thread
From: Ruediger Meier @ 2014-06-10 10:08 UTC (permalink / raw)
  To: util-linux

From: Ruediger Meier <ruediger.meier@ga-group.nl>

This patch is just a proposal. Is it not too ugly to do it that way?
For a final patch I would improve shell portability and error
handling.

Ruediger Meier (1):
  build-sys: use gettext 0.18.3 if possible

 autogen.sh   | 31 ++++++++++++++++++++++++++++++-
 configure.ac |  3 ++-
 2 files changed, 32 insertions(+), 2 deletions(-)

-- 
1.8.4.5


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

* [PATCH] build-sys: use gettext 0.18.3 if possible
  2014-06-10 10:08 [PATCH] next try to update gettext version Ruediger Meier
@ 2014-06-10 10:08 ` Ruediger Meier
  2014-06-10 11:52   ` Karel Zak
  2014-06-10 13:57   ` Pádraig Brady
       [not found] ` <53974319.7040608@gmail.com>
  1 sibling, 2 replies; 11+ messages in thread
From: Ruediger Meier @ 2014-06-10 10:08 UTC (permalink / raw)
  To: util-linux

From: Ruediger Meier <ruediger.meier@ga-group.nl>

We add a little hack for backward compatibility on systems with
older gettext installed

See 0576dbd3 and 81ed13ed.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
---
 autogen.sh   | 31 ++++++++++++++++++++++++++++++-
 configure.ac |  3 ++-
 2 files changed, 32 insertions(+), 2 deletions(-)

diff --git a/autogen.sh b/autogen.sh
index 48e26ad..7bbcc75 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -13,6 +13,34 @@ THEDIR=`pwd`
 cd $srcdir
 DIE=0
 
+autopoint_fun ()
+{
+	# we have to deal with set -e ...
+	rm -f configure.ac.autogenbak
+	ret="0"
+	GT_VER_MIN="0.18"
+	GT_VER_DEF=$(sed -n 's/AM_GNU_GETTEXT_VERSION(\[\(.*\)\])/\1/p' configure.ac)
+	GT_VER_HAVE="$(gettext --version | head -n 1 | sed 's/.* //g')"
+
+	tmp=$(echo -e "$GT_VER_MIN\n$GT_VER_HAVE" | sort -V | tail -n1)
+	tmp=$(echo -e "$GT_VER_DEF\n$tmp" | sort -V | head -n1)
+
+	if [ "$tmp" != "$GT_VER_DEF" ]; then
+		echo "warning, force autopoint to use old gettext $tmp"
+		sed -i.autogenbak configure.ac \
+			-e "s/\(AM_GNU_GETTEXT_VERSION\).*/\1([$tmp])/"
+	fi
+
+	autopoint "$@" || ret=$?
+	ret=$?
+
+	if [ "$tmp" != "$GT_VER_DEF" ]; then
+		mv configure.ac.autogenbak configure.ac
+	fi
+
+	return $ret
+}
+
 test -f sys-utils/mount.c || {
 	echo
 	echo "You must run this script in the top-level util-linux directory"
@@ -66,6 +94,7 @@ fi
 
 echo
 echo "Generate build-system by:"
+
 echo "   autopoint:  $(autopoint --version | head -1)"
 echo "   aclocal:    $(aclocal --version | head -1)"
 echo "   autoconf:   $(autoconf --version | head -1)"
@@ -77,7 +106,7 @@ rm -rf autom4te.cache
 
 set -e
 po/update-potfiles
-autopoint --force $AP_OPTS
+autopoint_fun --force $AP_OPTS
 if ! grep -q datarootdir po/Makefile.in.in; then
 	echo autopoint does not honor dataroot variable, patching.
 	sed -i -e 's/^datadir *=\(.*\)/datarootdir = @datarootdir@\
diff --git a/configure.ac b/configure.ac
index 107184b..ba31abc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -152,7 +152,8 @@ UL_SET_ARCH([HPPA], [hppa*])
 
 AC_SYS_LARGEFILE
 
-AM_GNU_GETTEXT_VERSION([0.18])
+dnl we want this gettext version but still allow older ones via autogen.sh
+AM_GNU_GETTEXT_VERSION([0.18.3])
 AM_GNU_GETTEXT([external])
 
 AS_IF([test -d "$srcdir/po"], [
-- 
1.8.4.5


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

* Re: [PATCH] build-sys: use gettext 0.18.3 if possible
  2014-06-10 10:08 ` [PATCH] build-sys: use gettext 0.18.3 if possible Ruediger Meier
@ 2014-06-10 11:52   ` Karel Zak
  2014-06-10 12:04     ` Ruediger Meier
  2014-06-10 13:57   ` Pádraig Brady
  1 sibling, 1 reply; 11+ messages in thread
From: Karel Zak @ 2014-06-10 11:52 UTC (permalink / raw)
  To: Ruediger Meier; +Cc: util-linux

On Tue, Jun 10, 2014 at 12:08:51PM +0200, Ruediger Meier wrote:
> We add a little hack for backward compatibility on systems with
> older gettext installed
> 
> See 0576dbd3 and 81ed13ed.
> 
> Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
> ---
>  autogen.sh   | 31 ++++++++++++++++++++++++++++++-
>  configure.ac |  3 ++-
>  2 files changed, 32 insertions(+), 2 deletions(-)

 Ah, I see, it seems like another pin for our gettext voodoo doll.

 Applied.

    Karel

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

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

* Re: [PATCH] build-sys: use gettext 0.18.3 if possible
  2014-06-10 11:52   ` Karel Zak
@ 2014-06-10 12:04     ` Ruediger Meier
  2014-06-10 12:16       ` Karel Zak
  2014-06-10 12:23       ` Karel Zak
  0 siblings, 2 replies; 11+ messages in thread
From: Ruediger Meier @ 2014-06-10 12:04 UTC (permalink / raw)
  To: Karel Zak; +Cc: util-linux

On Tuesday 10 June 2014, Karel Zak wrote:
> On Tue, Jun 10, 2014 at 12:08:51PM +0200, Ruediger Meier wrote:
> > We add a little hack for backward compatibility on systems with
> > older gettext installed
> >
> > See 0576dbd3 and 81ed13ed.
> >
> > Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
> > ---
> >  autogen.sh   | 31 ++++++++++++++++++++++++++++++-
> >  configure.ac |  3 ++-
> >  2 files changed, 32 insertions(+), 2 deletions(-)
>
>  Ah, I see, it seems like another pin for our gettext voodoo doll.

Hehe.

>  Applied.

Ooops, in the cover letter I've mentioned that the new function would 
probably need some more small portability/safety fixes before final 
patch. Anyway I'll send them later.

One more thing. Since we have "0.18.3" now in configure.ac you should 
take care to release it next time on a system where at least this 
version is available. It wouldn't look nice if we ship files from 
different version.

cu,
Rudi

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

* Re: [PATCH] build-sys: use gettext 0.18.3 if possible
  2014-06-10 12:04     ` Ruediger Meier
@ 2014-06-10 12:16       ` Karel Zak
  2014-06-10 12:23       ` Karel Zak
  1 sibling, 0 replies; 11+ messages in thread
From: Karel Zak @ 2014-06-10 12:16 UTC (permalink / raw)
  To: Ruediger Meier; +Cc: util-linux

On Tue, Jun 10, 2014 at 02:04:42PM +0200, Ruediger Meier wrote:
> On Tuesday 10 June 2014, Karel Zak wrote:
> > On Tue, Jun 10, 2014 at 12:08:51PM +0200, Ruediger Meier wrote:
> > > We add a little hack for backward compatibility on systems with
> > > older gettext installed
> > >
> > > See 0576dbd3 and 81ed13ed.
> > >
> > > Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
> > > ---
> > >  autogen.sh   | 31 ++++++++++++++++++++++++++++++-
> > >  configure.ac |  3 ++-
> > >  2 files changed, 32 insertions(+), 2 deletions(-)
> >
> >  Ah, I see, it seems like another pin for our gettext voodoo doll.
> 
> Hehe.
> 
> >  Applied.
> 
> Ooops, in the cover letter I've mentioned that the new function would 
> probably need some more small portability/safety fixes before final 
> patch. Anyway I'll send them later.

Sorry, fingers were faster than brain...

> One more thing. Since we have "0.18.3" now in configure.ac you should 
> take care to release it next time on a system where at least this 
> version is available. It wouldn't look nice if we ship files from 
> different version.

Sure, I always follow his rule.

 $ gettext --version | head -1
 gettext (GNU gettext-runtime) 0.18.3


    Karel

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

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

* Re: [PATCH] build-sys: use gettext 0.18.3 if possible
  2014-06-10 12:04     ` Ruediger Meier
  2014-06-10 12:16       ` Karel Zak
@ 2014-06-10 12:23       ` Karel Zak
  2014-06-10 13:41         ` Ruediger Meier
  1 sibling, 1 reply; 11+ messages in thread
From: Karel Zak @ 2014-06-10 12:23 UTC (permalink / raw)
  To: Ruediger Meier; +Cc: util-linux

On Tue, Jun 10, 2014 at 02:04:42PM +0200, Ruediger Meier wrote:
> Ooops, in the cover letter I've mentioned that the new function would 
> probably need some more small portability/safety fixes before final 
> patch. Anyway I'll send them later.

It seems travis does not like the patch.

    Karel

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

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

* Re: [PATCH] build-sys: use gettext 0.18.3 if possible
  2014-06-10 12:23       ` Karel Zak
@ 2014-06-10 13:41         ` Ruediger Meier
  0 siblings, 0 replies; 11+ messages in thread
From: Ruediger Meier @ 2014-06-10 13:41 UTC (permalink / raw)
  To: Karel Zak; +Cc: util-linux

On Tuesday 10 June 2014, Karel Zak wrote:
> On Tue, Jun 10, 2014 at 02:04:42PM +0200, Ruediger Meier wrote:
> > Ooops, in the cover letter I've mentioned that the new function
> > would probably need some more small portability/safety fixes before
> > final patch. Anyway I'll send them later.
>
> It seems travis does not like the patch.

Hehe, that's the shell portability I had guessed.

Looks like travis' /bin/sh does not have option "-e" for echo:
  warning, force autopoint to use old gettext "-e 0.18"
  ...
  is older. Please upgrade to gettext-"-e 0.18" or newer.

cu,
Rudi

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

* Re: [PATCH] build-sys: use gettext 0.18.3 if possible
  2014-06-10 10:08 ` [PATCH] build-sys: use gettext 0.18.3 if possible Ruediger Meier
  2014-06-10 11:52   ` Karel Zak
@ 2014-06-10 13:57   ` Pádraig Brady
  2014-06-10 15:25     ` Ruediger Meier
  1 sibling, 1 reply; 11+ messages in thread
From: Pádraig Brady @ 2014-06-10 13:57 UTC (permalink / raw)
  To: Ruediger Meier; +Cc: util-linux

On 06/10/2014 11:08 AM, Ruediger Meier wrote:
> autopoint_fun ()
> +{
> +	# we have to deal with set -e ...
> +	rm -f configure.ac.autogenbak
> +	ret="0"
> +	GT_VER_MIN="0.18"
> +	GT_VER_DEF=$(sed -n 's/AM_GNU_GETTEXT_VERSION(\[\(.*\)\])/\1/p' configure.ac)
> +	GT_VER_HAVE="$(gettext --version | head -n 1 | sed 's/.* //g')"
> +
> +	tmp=$(echo -e "$GT_VER_MIN\n$GT_VER_HAVE" | sort -V | tail -n1)
> +	tmp=$(echo -e "$GT_VER_DEF\n$tmp" | sort -V | head -n1)

You seem to be relying on coreutils here, using sort -V and tail -n
Note echo is exceptionally non portable. Better to use printf instead.

thanks,
Pádraig.

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

* Re: [PATCH] build-sys: use gettext 0.18.3 if possible
  2014-06-10 13:57   ` Pádraig Brady
@ 2014-06-10 15:25     ` Ruediger Meier
  2014-06-10 17:51       ` Ruediger Meier
  0 siblings, 1 reply; 11+ messages in thread
From: Ruediger Meier @ 2014-06-10 15:25 UTC (permalink / raw)
  To: Pádraig Brady; +Cc: util-linux

On Tuesday 10 June 2014, Pádraig Brady wrote:
> On 06/10/2014 11:08 AM, Ruediger Meier wrote:
> > autopoint_fun ()
> > +{
> > +	# we have to deal with set -e ...
> > +	rm -f configure.ac.autogenbak
> > +	ret="0"
> > +	GT_VER_MIN="0.18"
> > +	GT_VER_DEF=$(sed -n 's/AM_GNU_GETTEXT_VERSION(\[\(.*\)\])/\1/p'
> > configure.ac) +	GT_VER_HAVE="$(gettext --version | head -n 1 | sed
> > 's/.* //g')" +
> > +	tmp=$(echo -e "$GT_VER_MIN\n$GT_VER_HAVE" | sort -V | tail -n1)
> > +	tmp=$(echo -e "$GT_VER_DEF\n$tmp" | sort -V | head -n1)
>
> You seem to be relying on coreutils here, using sort -V and tail -n

Yes, I've guessed it's hard to do it fully portable. It's IMO already 
not safely possible parse gettext --version.

To not write much more ugly shell code to handle all this I think about 
only touching configure.ac if all of these commands above succeed as 
expected.
In other words: If it's not easily possible to find an older but good 
gettext version then don't do anything - user has to edit configure.ac 
manually or update to 0.18.3.


Another possibility would be just to hardcode these few allowed 
alternative versions:
---
altver=$(gettext --version |\
	sed -n 's/.* \(0\.18\|0\.18\.[1-2]\)$/\1/p')
test -n "$altver" && # sed configure.ac ...
autopoint ...
---
Very short and portable but to be maintained when version is updated in 
configure.ac

BTW does anybody know what kind of version string you get when using 
gettext from git or beta releae?


> Note echo is exceptionally non portable. Better to use printf
> instead.
>
> thanks,
> Pádraig.
> --
> To unsubscribe from this list: send the line "unsubscribe util-linux"
> in the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



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

* Re: [PATCH] build-sys: use gettext 0.18.3 if possible
  2014-06-10 15:25     ` Ruediger Meier
@ 2014-06-10 17:51       ` Ruediger Meier
  0 siblings, 0 replies; 11+ messages in thread
From: Ruediger Meier @ 2014-06-10 17:51 UTC (permalink / raw)
  To: Pádraig Brady; +Cc: util-linux

On Tuesday 10 June 2014, Ruediger Meier wrote:
> On Tuesday 10 June 2014, Pdraig Brady wrote:
> >
> > You seem to be relying on coreutils here, using sort -V and tail -n
>

> Another possibility would be just to hardcode these few allowed
> alternative versions:
> [...]
> Very short and portable but to be maintained when version is updated
> in configure.ac

Ok, now I've choosed this compromise, see the full function below or 
patch here
https://github.com/karelzak/util-linux/pull/97

------------
# provide simple gettext backward compatibility
autopoint_fun ()
{
	# check against this hardcoded set of alternative gettext versions
	gt_ver=`gettext --version |\
		sed -n -e 's/.* \(0\.18\|0\.18\.[1-2]\)$/\1/p'`

	if [ -n "$gt_ver" ]; then
		echo "warning, force autopoint to use old gettext $gt_ver"
		rm -f configure.ac.autogenbak
		sed -i.autogenbak configure.ac \
			-e "s/\(AM_GNU_GETTEXT_VERSION\).*/\1([$gt_ver])/"
	fi

	autopoint "$@" || ret=$?
	ret=$?

	if [ -n "$gt_ver" ]; then
		mv configure.ac.autogenbak configure.ac
	fi

	return $ret
}
---------

Note, sed -i is also not portable but we are using it already at another 
place.

Also note that my first more generic solution with "sort --version-sort" 
was almost useless anyway because autopoint itself can also only deal 
with a few hardcoded versions, and it would not work for rc or beta 
versions, see

$ grep -A12 "Check whether the version" /usr/bin/autopoint
# Check whether the version number is supported.
case "$ver" in
  0.10.35 | 0.10.36 | 0.10.37 | 0.10.38 | 0.10.39 | 0.10.40 | \
  0.11 | 0.11.1 | 0.11.2 | 0.11.3 | 0.11.4 | 0.11.5 | \
  0.12 | 0.12.1 | \
  0.13 | 0.13.1 | \
  0.14 | 0.14.1 | 0.14.2 | 0.14.3 | 0.14.4 | 0.14.5 | 0.14.6 | \
  0.15 | \
  0.16 | 0.16.1 | \
  0.17 | \
  0.18 | 0.18.1 | 0.18.2 | 0.18.3 )
    ;;
  *)

For me this looks really stupid. By design it wouldn't be possible (or 
at least no sense) to release 0.18.4 now since 0.19 is out already...

IMO our autopoint_fun feature should be an option for autpoint if not 
even the default behavior.

cu,
Rudi

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

* Re: [PATCH] next try to update gettext version
       [not found] ` <53974319.7040608@gmail.com>
@ 2014-06-11 22:18   ` Ruediger Meier
  0 siblings, 0 replies; 11+ messages in thread
From: Ruediger Meier @ 2014-06-11 22:18 UTC (permalink / raw)
  To: Bruce Dubbs; +Cc: util-linux

On Tuesday 10 June 2014, Bruce Dubbs wrote:
> Ruediger Meier wrote:
> > From: Ruediger Meier <ruediger.meier@ga-group.nl>
> >
> > This patch is just a proposal. Is it not too ugly to do it that
> > way? For a final patch I would improve shell portability and error
> > handling.
> >
> > Ruediger Meier (1):
> >    build-sys: use gettext 0.18.3 if possible
>
> gettext-0.19.1 was released a few hours ago.  It would be useful to
> check against that release.
>
>    -- Bruce

Thanks or reminding!

Our discussed changes shouldn't break with 0.19.x as we still force
<= 0.18.3. But I will check that in practice before next release.

cu,
Rudi

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

end of thread, other threads:[~2014-06-11 22:18 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-10 10:08 [PATCH] next try to update gettext version Ruediger Meier
2014-06-10 10:08 ` [PATCH] build-sys: use gettext 0.18.3 if possible Ruediger Meier
2014-06-10 11:52   ` Karel Zak
2014-06-10 12:04     ` Ruediger Meier
2014-06-10 12:16       ` Karel Zak
2014-06-10 12:23       ` Karel Zak
2014-06-10 13:41         ` Ruediger Meier
2014-06-10 13:57   ` Pádraig Brady
2014-06-10 15:25     ` Ruediger Meier
2014-06-10 17:51       ` Ruediger Meier
     [not found] ` <53974319.7040608@gmail.com>
2014-06-11 22:18   ` [PATCH] next try to update gettext version Ruediger Meier

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.