-# Remove locales unused during the install
+# Generate default locale in case runtime doesn't work
+# /usr/share/i18n/ contains sources
install -m 644 $DEST/usr/share/anaconda/lang-table $DEST/etc/lang-table
+rm -f $DEST/usr/lib/locale/locale-archive
localedef -c -i en_US -f UTF-8 --prefix $DEST en_US
+# Remove unsupported translations
cat $DEST/usr/share/anaconda/lang-table* | awk '
{ gsub("-", "", $4);
print $4;
@@ -1135,14 +1140,7 @@ for p in lib share; do (
}
); done
-# Now shrink the locale-archive to contain just the minimum.
-localedef --prefix $DEST --list-archive > $DEST/locales.glibc
-LC_ALL=C unsupported="$(comm -13 $DEST/locales $DEST/locales.glibc)"
-localedef --prefix $DEST --delete-from-archive $unsupported
-mv $DEST/usr/lib/locale/locale-archive $DEST/usr/lib/locale/locale-archive.tmpl
-/usr/sbin/chroot $DEST /usr/sbin/build-locale-archive
-
-rm -f $DEST/locales $DEST/locales.list $DEST/locales.glibc
+rm -f $DEST/locales $DEST/locales.list
# fix up some links for man page related stuff
for file in nroff groff iconv geqn gtbl gpic grefer ; do
--
1.7.4
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
02-14-2011, 10:33 AM
Ales Kozumplik
Generate locale files on request
Hi,
some notes below.
On 02/14/2011 10:10 AM, Martin Sivak wrote:
+ /* get locale parts out of locale name */
+ locale_p = locale_i = languages[choice].lc_all;
Could you please add a sample locale string or two as a comment, it
makes the loop a lot easier to read and figure out what we really parse.
+ while (1) {
+ // we found separator
+ if (*locale_i == '.' || *locale_i == '@' || *locale_i == ' ') {
+ // last separator was annotating charset
+ if (*locale_p == '.') locale_charset = strndup(locale_p + 1, locale_i - locale_p - 1);
+ // last separator was annotating modifier
+ else if (*locale_p == '@') locale_mod = strndup(locale_p + 1, locale_i - locale_p - 1);
+ // there was no known separator last time
+ else locale_def = strndup(locale_p, locale_i - locale_p);
Doesn't this else imply locale_i == ' ' ?
+ /* generate locale record */
+ logMessage(INFO, "going to prepare locales for %s (locale: %s, charset: %s)", languages[choice].lc_all, locale_p, locale_charset);
+ if ((localedef_pid = fork()) == 0) {
+ execl("/usr/bin/localedef", "localedef",
+ "-i", locale_p,
+ "-f", (locale_charset) ? locale_charset : "UTF-8",
+ languages[choice].lc_all, NULL);
+ }
+ if (localedef_pid< 0) logMessage(ERROR, "failed starting localedef for %s", languages[choice].lc_all);
I think you want this log message say that a fork failed (unlikely,
maybe just abort). Also there should be an assert/abort/return after the
call to execl---that can fail but we don't want two instances of the
process to continue.
There was a pjones's patch around that would remove all this stuff so
maybe this is not even necessary.
Other than that I applaud those image-shrinking efforts.
Al_
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
02-14-2011, 11:33 AM
Martin Gracik
Generate locale files on request
--
Martin Gracik
----- Original Message -----
> Hi,
>
> some notes below.
>
> On 02/14/2011 10:10 AM, Martin Sivak wrote:
> > + /* get locale parts out of locale name */
> > + locale_p = locale_i = languages[choice].lc_all;
>
> Could you please add a sample locale string or two as a comment, it
> makes the loop a lot easier to read and figure out what we really
> parse.
>
> > + while (1) {
> > + // we found separator
> > + if (*locale_i == '.' || *locale_i == '@' || *locale_i == ' ') {
> > + // last separator was annotating charset
> > + if (*locale_p == '.') locale_charset = strndup(locale_p + 1,
> > locale_i - locale_p - 1);
> > + // last separator was annotating modifier
> > + else if (*locale_p == '@') locale_mod = strndup(locale_p + 1,
> > locale_i - locale_p - 1);
> > + // there was no known separator last time
> > + else locale_def = strndup(locale_p, locale_i - locale_p);
>
> Doesn't this else imply locale_i == ' ' ?
>
> > + /* generate locale record */
> > + logMessage(INFO, "going to prepare locales for %s (locale: %s,
> > charset: %s)", languages[choice].lc_all, locale_p, locale_charset);
> > + if ((localedef_pid = fork()) == 0) {
> > + execl("/usr/bin/localedef", "localedef",
> > + "-i", locale_p,
> > + "-f", (locale_charset) ? locale_charset : "UTF-8",
> > + languages[choice].lc_all, NULL);
> > + }
> > + if (localedef_pid< 0) logMessage(ERROR, "failed starting localedef
> > for %s", languages[choice].lc_all);
>
> I think you want this log message say that a fork failed (unlikely,
> maybe just abort). Also there should be an assert/abort/return after
> the
> call to execl---that can fail but we don't want two instances of the
> process to continue.
>
>
> > diff --git a/scripts/upd-instroot b/scripts/upd-instroot
> > index 5c8d5b5..2b2fc4a 100755
> > --- a/scripts/upd-instroot
> > +++ b/scripts/upd-instroot
>
> There was a pjones's patch around that would remove all this stuff so
> maybe this is not even necessary.
The scripts/* cannot be removed yet, the secondary architectures still use buildinstall,
we talked about this in Tempe.
>
> Other than that I applaud those image-shrinking efforts.
>
> Al_
>
> _______________________________________________
> Anaconda-devel-list mailing list
> Anaconda-devel-list@redhat.com
> https://www.redhat.com/mailman/listinfo/anaconda-devel-list
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
02-14-2011, 01:40 PM
Martin Sivak
Generate locale files on request
> > + /* get locale parts out of locale name */
> > + locale_p = locale_i = languages[choice].lc_all;
>
> Could you please add a sample locale string or two as a comment, it
> makes the loop a lot easier to read and figure out what we really
> parse.
I can, but for the review the formats are as follows:
en
en_US
cs_CZ.UTF-8
cz_CZ.UTF-8@latin
> > + while (1) {
> > + // we found separator
> > + if (*locale_i == '.' || *locale_i == '@' || *locale_i == ' ') {
> > + // last separator was annotating charset
> > + if (*locale_p == '.') locale_charset = strndup(locale_p + 1,
> > locale_i - locale_p - 1);
> > + // last separator was annotating modifier
> > + else if (*locale_p == '@') locale_mod = strndup(locale_p + 1,
> > locale_i - locale_p - 1);
> > + // there was no known separator last time
> > + else locale_def = strndup(locale_p, locale_i - locale_p);
>
> Doesn't this else imply locale_i == ' ' ?
Nope, the first if tests current character, but following ifs test locale_p (the last separator), so the else is actually processed first, because locale_p points to first character of locale.
> > + /* generate locale record */
> > + logMessage(INFO, "going to prepare locales for %s (locale: %s,
> > charset: %s)", languages[choice].lc_all, locale_p, locale_charset);
> > + if ((localedef_pid = fork()) == 0) {
> > + execl("/usr/bin/localedef", "localedef",
> > + "-i", locale_p,
> > + "-f", (locale_charset) ? locale_charset : "UTF-8",
> > + languages[choice].lc_all, NULL);
> > + }
> > + if (localedef_pid< 0) logMessage(ERROR, "failed starting localedef
> > for %s", languages[choice].lc_all);
>
> I think you want this log message say that a fork failed (unlikely,
> maybe just abort). Also there should be an assert/abort/return after
> the
> call to execl---that can fail but we don't want two instances of the
> process to continue.
>
True, exit should be there. I will add one
--
Martin Sivák
msivak@redhat.com
Red Hat Czech
Anaconda team / Brno, CZ
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
-# Remove locales unused during the install
+# Generate default locale in case runtime doesn't work
+# /usr/share/i18n/ contains sources
install -m 644 $DEST/usr/share/anaconda/lang-table $DEST/etc/lang-table
+rm -f $DEST/usr/lib/locale/locale-archive
localedef -c -i en_US -f UTF-8 --prefix $DEST en_US
+# Remove unsupported translations
cat $DEST/usr/share/anaconda/lang-table* | awk '
{ gsub("-", "", $4);
print $4;
@@ -1135,14 +1140,7 @@ for p in lib share; do (
}
); done
-# Now shrink the locale-archive to contain just the minimum.
-localedef --prefix $DEST --list-archive > $DEST/locales.glibc
-LC_ALL=C unsupported="$(comm -13 $DEST/locales $DEST/locales.glibc)"
-localedef --prefix $DEST --delete-from-archive $unsupported
-mv $DEST/usr/lib/locale/locale-archive $DEST/usr/lib/locale/locale-archive.tmpl
-/usr/sbin/chroot $DEST /usr/sbin/build-locale-archive
-
-rm -f $DEST/locales $DEST/locales.list $DEST/locales.glibc
+rm -f $DEST/locales $DEST/locales.list
# fix up some links for man page related stuff
for file in nroff groff iconv geqn gtbl gpic grefer ; do
--
1.7.4
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
02-14-2011, 02:26 PM
Ales Kozumplik
Generate locale files on request
Ack, thanks.
Al_
On 02/14/2011 03:40 PM, Martin Sivak wrote:
+ /* get locale parts out of locale name */
+ locale_p = locale_i = languages[choice].lc_all;
Could you please add a sample locale string or two as a comment, it
makes the loop a lot easier to read and figure out what we really
parse.
I can, but for the review the formats are as follows:
en
en_US
cs_CZ.UTF-8
cz_CZ.UTF-8@latin
+ while (1) {
+ // we found separator
+ if (*locale_i == '.' || *locale_i == '@' || *locale_i == ' ') {
+ // last separator was annotating charset
+ if (*locale_p == '.') locale_charset = strndup(locale_p + 1,
locale_i - locale_p - 1);
+ // last separator was annotating modifier
+ else if (*locale_p == '@') locale_mod = strndup(locale_p + 1,
locale_i - locale_p - 1);
+ // there was no known separator last time
+ else locale_def = strndup(locale_p, locale_i - locale_p);
Doesn't this else imply locale_i == ' ' ?
Nope, the first if tests current character, but following ifs test locale_p (the last separator), so the else is actually processed first, because locale_p points to first character of locale.
+ /* generate locale record */
+ logMessage(INFO, "going to prepare locales for %s (locale: %s,
charset: %s)", languages[choice].lc_all, locale_p, locale_charset);
+ if ((localedef_pid = fork()) == 0) {
+ execl("/usr/bin/localedef", "localedef",
+ "-i", locale_p,
+ "-f", (locale_charset) ? locale_charset : "UTF-8",
+ languages[choice].lc_all, NULL);
+ }
+ if (localedef_pid< 0) logMessage(ERROR, "failed starting localedef
for %s", languages[choice].lc_all);
I think you want this log message say that a fork failed (unlikely,
maybe just abort). Also there should be an assert/abort/return after
the
call to execl---that can fail but we don't want two instances of the
process to continue.
True, exit should be there. I will add one
--
Martin Sivák
msivak@redhat.com
Red Hat Czech
Anaconda team / Brno, CZ
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list