[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: giant initrd.img testing

On Tue, 24 Aug 2010, Chris Lumens wrote:

-r--r--r--   1 root     root     99158752 Aug 23 14:05 usr/lib/locale/locale-archive

My understanding is that we need this when changing to another locale, for
basic character set stuff and glibc messages.


We should reduce it to only those locales listed in lang-table using
localedef.  That way we start with the one on the system and reduce it down to
what is supported at install time.

Yes, reducing it is what I want to do.  A long time ago, we ran
build-locale-archive during upd-instroot to generate the locale-archive
file for just those locales we support in anaconda.  We quit doing that
at some point.  Now I just need to figure out if it's still possible and
if so, how we go about doing it.

I just threw this together, but it's incomplete:


import os
import subprocess

if __name__ == "__main__":
    cwd = os.getcwd()
    langtable = os.path.realpath(cwd + "/data/lang-table")
    cur = os.path.realpath(cwd + "/locale-archive")
    new = cur + ".new"

    langs = map(lambda y: y[3].replace('.UTF-8', '.utf8'),
                map(lambda x: x.split(), open(langtable, 'r').readlines()))

    proc = subprocess.Popen(["localedef", "-i", cur, "--list-archive"],
    (out, err) = proc.communicate()

    remove = list(set(out.split()) - set(langs))

    args = ["-i", cur, "--delete-from-archive"] + remove
    proc = subprocess.Popen(["localedef"] + args,
    (out, err) = proc.communicate()

You can see what I was going for.  But I cannot figure out how to make
localedef write to a new temporary file (cur).  It wants to write to
/usr/lib/locale/locale-archive regardless of what options I pass.  But I can
override it with -i for input.  Weird.

David Cantrell <dcantrell redhat com>
Red Hat / Honolulu, HI

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]