Fix locale installation
PATCH 1/1 Fix locale installation
(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 <[email protected]>
* 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'
grub-install.in +4 -3
@@ -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'
i386/efi/grub-install.in +4 -3
@@ -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,
Signature · 1 line
Colin Watson [[email protected]]
Hello,
Quoted 1 line · Colin Watson
(cpina, if you're reading, I'd particularly appreciate your review.)
Here I am
Quoted 1 line
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)
grub-install.in fi · line 271
Quoted 10 lines
# Copy gettext files
mkdir -p ${grubdir}/locale/grub-install.in +3
-3-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".
Signature · 2 lines
Carles Pina i Estany http://pinux.info
Quoted 14 lines · Carles Pina i Estany
grub-install.in fi · line 271
Quoted 10 lines · Colin Watson
# Copy gettext files
mkdir -p ${grubdir}/locale/grub-install.in +3
-3-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")
Quoted 3 lines
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.
Quoted 3 lines
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,
Signature · 1 line
Colin Watson [[email protected]]
Hello,
Quoted 19 lines · Colin Watson
Quoted 14 lines · Carles Pina i Estany
grub-install.in fi · line 271
Quoted 10 lines · Colin Watson
# Copy gettext files
mkdir -p ${grubdir}/locale/grub-install.in +3
-3-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")
Quoted 3 lines
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)
Quoted 5 lines
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
Quoted 5 lines
Quoted 3 lines
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...
Quoted 4 lines
$localedir/*/LC_MESSAGES/grub.mo. My code will copy (e.g.)
/usr/share/locale/es/LC_MESSAGES/grub.moto/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 :-)
Signature · 2 lines
Carles Pina i Estany http://pinux.info
Quoted 7 lines · Carles Pina i Estany
Quoted 4 lines · Colin Watson
$localedir/*/LC_MESSAGES/grub.mo. My code will copy (e.g.)
/usr/share/locale/es/LC_MESSAGES/grub.moto/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.)
Signature · 1 line
Colin Watson [[email protected]]