glibc: try to fix locale naming (BZ #1140)
authorPhil Blundell <philb@gnu.org>
Sun, 13 Aug 2006 13:59:59 +0000 (13:59 +0000)
committerPhil Blundell <philb@gnu.org>
Sun, 13 Aug 2006 13:59:59 +0000 (13:59 +0000)
packages/glibc/glibc-package.bbclass

index 9d44190..0e02aff 100644 (file)
@@ -199,12 +199,7 @@ python package_do_split_gconvs () {
                if deps != []:
                        bb.data.setVar('RDEPENDS_%s' % pkg, " ".join(deps), d)
 
-       use_bin = bb.data.getVar("GLIBC_INTERNAL_USE_BINARY_LOCALE", d, 1)
-       if use_bin:
-               do_split_packages(d, locales_dir, file_regex='(.*)', output_pattern='glibc-localedata-%s', description='locale definition for %s', hook=calc_locale_deps, extra_depends='', aux_files_pattern_verbatim=binary_locales_dir + '/%s')
-       else:
-               do_split_packages(d, locales_dir, file_regex='(.*)', output_pattern='glibc-localedata-%s', description='locale definition for %s', hook=calc_locale_deps, extra_depends='')
-               bb.note("generation of binary locales disabled. this may break i18n!")
+       do_split_packages(d, locales_dir, file_regex='(.*)', output_pattern='glibc-localedata-%s', description='locale definition for %s', hook=calc_locale_deps, extra_depends='')
        bb.data.setVar('PACKAGES', bb.data.getVar('PACKAGES', d) + ' glibc-gconv', d)
 
        f = open(os.path.join(bb.data.getVar('WORKDIR', d, 1), "SUPPORTED"), "r")
@@ -243,8 +238,12 @@ python package_do_split_gconvs () {
                target_arch = bb.data.getVar("TARGET_ARCH", d, 1)
                qemu = "qemu-%s" % target_arch
                pkgname = 'locale-base-' + legitimize_package_name(name)
-
-               bb.data.setVar('RDEPENDS_%s' % pkgname, 'glibc-localedata-%s glibc-charmap-%s' % (legitimize_package_name(locale), legitimize_package_name(encoding)), d)
+               m = re.match("(.*)\.(.*)", name)
+               if m:
+                       glibc_name = "%s.%s" % (m.group(1), m.group(2).lower().replace("-",""))
+               else:
+                       glibc_name = name
+               bb.data.setVar('RDEPENDS_%s' % pkgname, 'glibc-binary-localedata-%s' % glibc_name, d)
                rprovides = 'virtual-locale-%s' % legitimize_package_name(name)
                m = re.match("(.*)_(.*)", name)
                if m:
@@ -257,7 +256,7 @@ python package_do_split_gconvs () {
                path = bb.data.getVar("PATH", d, 1)
                i18npath = os.path.join(treedir, datadir, "i18n")
 
-               localedef_opts = "--force --old-style --no-archive --prefix=%s --inputfile=%s/i18n/locales/%s --charmap=%s %s" % (treedir, datadir, locale, encoding, locale)
+               localedef_opts = "--force --old-style --no-archive --prefix=%s --inputfile=%s/i18n/locales/%s --charmap=%s %s" % (treedir, datadir, locale, encoding, name)
                cmd = "PATH=\"%s\" I18NPATH=\"%s\" %s -L %s %s/bin/localedef %s" % (path, i18npath, qemu, treedir, treedir, localedef_opts)
                bb.note("generating locale %s (%s)" % (locale, encoding))
                if os.system(cmd):
@@ -276,20 +275,33 @@ python package_do_split_gconvs () {
                bb.build.exec_func("do_prep_locale_tree", d)
 
        # Reshuffle names so that UTF-8 is preferred over other encodings
+       non_utf8 = []
        for l in encodings.keys():
                if len(encodings[l]) == 1:
                        output_locale(l, l, encodings[l][0])
+                       if encodings[l][0] != "UTF-8":
+                               non_utf8.append(l)
                else:
                        if "UTF-8" in encodings[l]:
                                output_locale(l, l, "UTF-8")
                                encodings[l].remove("UTF-8")
+                       else:
+                               non_utf8.append(l)
                        for e in encodings[l]:
-                               output_locale('%s-%s' % (l, e), l, e)                   
+                               output_locale('%s.%s' % (l, e), l, e)
+
+       if non_utf8 != []:
+               bb.note("the following locales are supported only in legacy encodings:")
+               bb.note("  " + " ".join(non_utf8))
 
        use_bin = bb.data.getVar("GLIBC_INTERNAL_USE_BINARY_LOCALE", d, 1)
        if use_bin:
                bb.note("collecting binary locales from locale tree")
                bb.build.exec_func("do_collect_bins_from_locale_tree", d)
+               do_split_packages(d, binary_locales_dir, file_regex='(.*)', output_pattern='glibc-binary-localedata-%s', description='binary locale definition for %s', extra_depends='', allow_dirs=True)
+       else:
+               bb.note("generation of binary locales disabled. this may break i18n!")
+
 }
 
 # We want to do this indirection so that we can safely 'return'