All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix locale installation
@ 2010-03-19 11:50 Colin Watson
  2010-03-19 20:35 ` Carles Pina i Estany
  0 siblings, 1 reply; 5+ messages in thread
From: Colin Watson @ 2010-03-19 11:50 UTC (permalink / raw)
  To: grub-devel

(cpina, if you're reading, I'd particularly appreciate your review.)

As far as I can see, locale installation is just wrong right now.
${pkglibdir}/locale/*.mo never exists, and copying files from
${grubdir}/locale/ to ${grubdir}/locale/ is pretty odd too ...

I think this patch matches reality rather better.

2010-03-19  Colin Watson  <cjwatson@ubuntu.com>

	* util/grub-install.in: Copy .mo files from @datadir@/locale, to
	match where 'make install' puts them.
	* util/i386/efi/grub-install.in: Likewise.

=== modified file 'util/grub-install.in'
--- util/grub-install.in	2010-02-03 00:24:07 +0000
+++ util/grub-install.in	2010-03-19 01:04:39 +0000
@@ -32,6 +32,7 @@ platform=@platform@
 host_os=@host_os@
 font=@datadir@/@PACKAGE_TARNAME@/ascii.pf2
 pkglibdir=${libdir}/`echo ${PACKAGE_TARNAME}/${target_cpu}-${platform} | sed ${transform}`
+localedir=@datadir@/locale
 
 grub_setup=${sbindir}/`echo grub-setup | sed ${transform}`
 if [ "${target_cpu}-${platform}" = "i386-pc" ] || [ "${target_cpu}-${platform}" = "sparc64-ieee1275" ] || [ "${target_cpu}-${platform}" = "mips-yeeloong" ] ; then
@@ -263,9 +264,9 @@ fi
 
 # Copy gettext files
 mkdir -p ${grubdir}/locale/
-for file in ${grubdir}/locale/*.mo ${pkglibdir}/locale/*.mo; do
-    if test -f "$file"; then
-        cp -f "$file" ${grubdir}/locale/
+for dir in ${localedir}/*; do
+    if test -f "$dir/LC_MESSAGES/grub.mo"; then
+        cp -f "$dir/LC_MESSAGES/grub.mo" "${grubdir}/locale/${dir##*/}.mo"
     fi
 done
 

=== modified file 'util/i386/efi/grub-install.in'
--- util/i386/efi/grub-install.in	2010-03-04 14:12:34 +0000
+++ util/i386/efi/grub-install.in	2010-03-19 01:04:36 +0000
@@ -31,6 +31,7 @@ target_cpu=@target_cpu@
 platform=@platform@
 host_os=@host_os@
 pkglibdir=${libdir}/`echo ${PACKAGE_TARNAME}/${target_cpu}-${platform} | sed ${transform}`
+localedir=@datadir@/locale
 
 grub_mkimage=${bindir}/`echo grub-mkimage | sed ${transform}`
 grub_mkdevicemap=${sbindir}/`echo grub-mkdevicemap | sed ${transform}`
@@ -182,9 +183,9 @@ done
 
 # Copy gettext files
 mkdir -p ${grubdir}/locale/
-for file in ${grubdir}/locale/*.mo ${pkglibdir}/locale/*.mo; do
-    if test -f "$file"; then
-        cp -f "$file" ${grubdir}/locale/
+for dir in ${localedir}/*; do
+    if test -f "$dir/LC_MESSAGES/grub.mo"; then
+        cp -f "$dir/LC_MESSAGES/grub.mo" "${grubdir}/locale/${dir##*/}.mo"
     fi
 done
 

Thanks,

-- 
Colin Watson                                       [cjwatson@ubuntu.com]



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

* Re: [PATCH] Fix locale installation
  2010-03-19 11:50 [PATCH] Fix locale installation Colin Watson
@ 2010-03-19 20:35 ` Carles Pina i Estany
  2010-03-19 22:21   ` Colin Watson
  0 siblings, 1 reply; 5+ messages in thread
From: Carles Pina i Estany @ 2010-03-19 20:35 UTC (permalink / raw)
  To: The development of GNU GRUB


Hello,

On Mar/19/2010, Colin Watson wrote:
> (cpina, if you're reading, I'd particularly appreciate your review.)

Here I am

> As far as I can see, locale installation is just wrong right now.

I cannot test it easily now.

I'll comment the new thing forgetting about the old one (doesn't look
right)

>  # Copy gettext files
>  mkdir -p ${grubdir}/locale/
> -for file in ${grubdir}/locale/*.mo ${pkglibdir}/locale/*.mo; do
> -    if test -f "$file"; then
> -        cp -f "$file" ${grubdir}/locale/
> +for dir in ${localedir}/*; do
> +    if test -f "$dir/LC_MESSAGES/grub.mo"; then
> +        cp -f "$dir/LC_MESSAGES/grub.mo" "${grubdir}/locale/${dir##*/}.mo"
>      fi
>  done

(I'll use shell variables in a bit "on my own way")

AFAIK the files are in po/$lang.{po,mo}, right? (at least in
my system without using another directory for the building, I need to
look in the other issue soon)

I thought that make install was copying from po/$lang.mo to
/usr/share/locale/$lang/LC_MESSAGES/grub.mo, but you are copying already
from some structure in $localedir/LC_MESSAGES/grub.mo. What am I missing?

It has been a while that I have not done these things, so sorry to be
more an "askwer" than "answerer".

-- 
Carles Pina i Estany
	http://pinux.info



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

* Re: [PATCH] Fix locale installation
  2010-03-19 20:35 ` Carles Pina i Estany
@ 2010-03-19 22:21   ` Colin Watson
  2010-03-19 22:28     ` Carles Pina i Estany
  0 siblings, 1 reply; 5+ messages in thread
From: Colin Watson @ 2010-03-19 22:21 UTC (permalink / raw)
  To: grub-devel

On Fri, Mar 19, 2010 at 08:35:23PM +0000, Carles Pina i Estany wrote:
> On Mar/19/2010, Colin Watson wrote:
> >  # Copy gettext files
> >  mkdir -p ${grubdir}/locale/
> > -for file in ${grubdir}/locale/*.mo ${pkglibdir}/locale/*.mo; do
> > -    if test -f "$file"; then
> > -        cp -f "$file" ${grubdir}/locale/
> > +for dir in ${localedir}/*; do
> > +    if test -f "$dir/LC_MESSAGES/grub.mo"; then
> > +        cp -f "$dir/LC_MESSAGES/grub.mo" "${grubdir}/locale/${dir##*/}.mo"
> >      fi
> >  done
> 
> (I'll use shell variables in a bit "on my own way")
> 
> AFAIK the files are in po/$lang.{po,mo}, right? (at least in
> my system without using another directory for the building, I need to
> look in the other issue soon)

In the source, they live in po/$lang.po and po/$lang.mo.  However, when
you run 'make install', they end up in
$datadir/locale/$lang/LC_MESSAGES/grub.mo.  grub-install should be
looking at the paths used by 'make install', rather than the paths in
the source tree which generally won't be accessible.

> I thought that make install was copying from po/$lang.mo to
> /usr/share/locale/$lang/LC_MESSAGES/grub.mo, but you are copying already
> from some structure in $localedir/LC_MESSAGES/grub.mo. What am I missing?

You just misread my code slightly, I think.  I'm actually copying from
$localedir/*/LC_MESSAGES/grub.mo.  My code will copy (e.g.)
/usr/share/locale/es/LC_MESSAGES/grub.mo to /boot/grub/locale/es.mo.
This seems better than creating lots of subdirectories of
/boot/grub/locale/.

Thanks,

-- 
Colin Watson                                       [cjwatson@ubuntu.com]



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

* Re: [PATCH] Fix locale installation
  2010-03-19 22:21   ` Colin Watson
@ 2010-03-19 22:28     ` Carles Pina i Estany
  2010-03-21 23:07       ` Colin Watson
  0 siblings, 1 reply; 5+ messages in thread
From: Carles Pina i Estany @ 2010-03-19 22:28 UTC (permalink / raw)
  To: The development of GNU GRUB


Hello,

On Mar/19/2010, Colin Watson wrote:
> On Fri, Mar 19, 2010 at 08:35:23PM +0000, Carles Pina i Estany wrote:
> > On Mar/19/2010, Colin Watson wrote:
> > >  # Copy gettext files
> > >  mkdir -p ${grubdir}/locale/
> > > -for file in ${grubdir}/locale/*.mo ${pkglibdir}/locale/*.mo; do
> > > -    if test -f "$file"; then
> > > -        cp -f "$file" ${grubdir}/locale/
> > > +for dir in ${localedir}/*; do
> > > +    if test -f "$dir/LC_MESSAGES/grub.mo"; then
> > > +        cp -f "$dir/LC_MESSAGES/grub.mo" "${grubdir}/locale/${dir##*/}.mo"
> > >      fi
> > >  done
> > 
> > (I'll use shell variables in a bit "on my own way")
> > 
> > AFAIK the files are in po/$lang.{po,mo}, right? (at least in
> > my system without using another directory for the building, I need to
> > look in the other issue soon)
> 
> In the source, they live in po/$lang.po and po/$lang.mo.  However, when
> you run 'make install', they end up in
> $datadir/locale/$lang/LC_MESSAGES/grub.mo.  grub-install should be
> looking at the paths used by 'make install', rather than the paths in
> the source tree which generally won't be accessible.

ahh, yeap, I confused grub-install and make install

> > I thought that make install was copying from po/$lang.mo to
> > /usr/share/locale/$lang/LC_MESSAGES/grub.mo, but you are copying already
> > from some structure in $localedir/LC_MESSAGES/grub.mo. What am I missing?
> 
> You just misread my code slightly, I think.  I'm actually copying from

I mixed grub-install/make install and what you was doing there...

> $localedir/*/LC_MESSAGES/grub.mo.  My code will copy (e.g.)
> /usr/share/locale/es/LC_MESSAGES/grub.mo to /boot/grub/locale/es.mo.
> This seems better than creating lots of subdirectories of
> /boot/grub/locale/.

Yeap, in that case you are right and the code looks fine :-)

-- 
Carles Pina i Estany
	http://pinux.info



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

* Re: [PATCH] Fix locale installation
  2010-03-19 22:28     ` Carles Pina i Estany
@ 2010-03-21 23:07       ` Colin Watson
  0 siblings, 0 replies; 5+ messages in thread
From: Colin Watson @ 2010-03-21 23:07 UTC (permalink / raw)
  To: The development of GNU GRUB

On Fri, Mar 19, 2010 at 10:28:16PM +0000, Carles Pina i Estany wrote:
> On Mar/19/2010, Colin Watson wrote:
> > $localedir/*/LC_MESSAGES/grub.mo.  My code will copy (e.g.)
> > /usr/share/locale/es/LC_MESSAGES/grub.mo to /boot/grub/locale/es.mo.
> > This seems better than creating lots of subdirectories of
> > /boot/grub/locale/.
> 
> Yeap, in that case you are right and the code looks fine :-)

Thanks.  I've gone ahead and committed this, then.

I'm still not quite sure about what to do about packages like memtest86+
that want to install translations of their menu entries; but perhaps
that is a problem for another day.  (grub-install could
msgunfmt/msgmerge/msgfmt multiple .mo files together if it knew which
ones to use, for example.)

-- 
Colin Watson                                       [cjwatson@ubuntu.com]



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

end of thread, other threads:[~2010-03-21 23:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-19 11:50 [PATCH] Fix locale installation Colin Watson
2010-03-19 20:35 ` Carles Pina i Estany
2010-03-19 22:21   ` Colin Watson
2010-03-19 22:28     ` Carles Pina i Estany
2010-03-21 23:07       ` Colin Watson

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.