Blame SOURCES/yum-langpacks-0.4.2-fix-zh_CN-locale-packages.patch

674536
--- yum-langpacks-0.4.2.old/langpacks.py	2014-11-20 23:09:11.495254242 +0530
674536
+++ yum-langpacks-0.4.2/langpacks.py	2014-11-20 18:03:55.000000000 +0530
674536
@@ -311,18 +311,22 @@
674536
             if lname:
674536
                 if pkgs.find(lname, len(pkgs)-len(lname), len(pkgs)) > 0 :
674536
                     avl_langpack_pkgs.append(pkgs)
674536
-        if len(lang) > 4 and lang.find("_") != -1:
674536
-            mainlang = lang[0:lang.find("_")]
674536
-            if pkgs.find(lang, len(pkgs)-len(lang), len(pkgs)) > 0 :
674536
-                avl_langpack_pkgs.append(pkgs)
674536
-           # if input pt_BR then show for pt and pt_BR
674536
-            # if input zh_CN then show for zh and zh_CN
674536
-            elif pkgs.find(mainlang, len(pkgs)-len(mainlang), len(pkgs)) > 0 :
674536
-                avl_langpack_pkgs.append(pkgs)
674536
 
674536
-            if lname:
674536
-                if pkgs.find(lname, len(pkgs)-len(lname), len(pkgs)) > 0 :
674536
-                    avl_langpack_pkgs.append(pkgs)
674536
+        if len(lang) > 4:
674536
+            if lang.find("_") != -1:
674536
+               mainlang = lang[0:lang.find("_")]
674536
+               if lang.find("_CN") != -1 and pkgs.find("-CN") != -1:
674536
+                   avl_langpack_pkgs.append(pkgs)
674536
+               if pkgs.find(lang, len(pkgs)-len(lang), len(pkgs)) > 0:
674536
+                   avl_langpack_pkgs.append(pkgs)
674536
+               # if input pt_BR then show for pt and pt_BR
674536
+               # if input zh_CN then show for zh and zh_CN
674536
+               elif pkgs.find(mainlang, len(pkgs)-len(mainlang), len(pkgs)) > 0:
674536
+                     avl_langpack_pkgs.append(pkgs)
674536
+
674536
+               if lname:
674536
+                   if pkgs.find(lname, len(pkgs)-len(lname), len(pkgs)) > 0:
674536
+                       avl_langpack_pkgs.append(pkgs)
674536
 
674536
     return sorted(avl_langpack_pkgs)
674536
 
674536
@@ -414,6 +418,11 @@
674536
                 if p not in pkgmatches:
674536
                     pkgmatches.append(p)
674536
 
674536
+    # This is special case to cover package name man-pages-zh-CN
674536
+    # which should have been named as man-pages-zh_CN
674536
+    if lang.find("zh_CN") != -1:
674536
+       pkgmatches.append("man-pages-zh-CN")
674536
+
674536
     pkgs = get_matches(sack, pkgmatches)
674536
     for pkg in pkgs:
674536
         if yb.rpmdb.searchNevra(name=pkg.name):
674536
@@ -446,6 +455,11 @@
674536
             if p not in pkgmatches:
674536
                 pkgmatches.append(p)
674536
 
674536
+    # This is special case to cover package name man-pages-zh-CN
674536
+    # which should have been named as man-pages-zh_CN
674536
+    if lang.find("zh_CN") != -1:
674536
+       pkgmatches.append("man-pages-zh-CN")
674536
+
674536
     pkgs = get_matches(yb.rpmdb, pkgmatches)
674536
     for pkg in pkgs:
674536
         if conduit and hasattr(conduit, 'registerPackageName'):