Blame SOURCES/yum-langpacks-0.4.2-Add-parser-for-Release_Notes-packages.patch

674536
From f86e94c305e2a82fc66eab0bdae18ae8e063304d Mon Sep 17 00:00:00 2001
674536
From: Parag Nemade <pnemade@redhat.com>
674536
Date: Fri, 22 Apr 2016 19:42:39 +0530
674536
Subject: [PATCH] Resolves:rh#1263241 - Add parser for Release_Notes packages
674536
674536
---
674536
 langpacks.py | 38 ++++++++++++++++++++++++++++++++++++--
674536
 1 file changed, 36 insertions(+), 2 deletions(-)
674536
674536
diff --git a/langpacks.py b/langpacks.py
674536
index 2e162a0..9b235b7 100644
674536
--- a/langpacks.py
674536
+++ b/langpacks.py
674536
@@ -94,7 +94,10 @@ def read_available_langpacks (base = None):
674536
     yb = base
674536
 
674536
     srchpkglist = []
674536
-    skip_pkg_list = ['devel', 'browser', 'debuginfo', 'music', 'overrides', 'Brazil', 'British', 'Farsi', 'LowSaxon', 'cs_CZ']
674536
+    skip_pkg_list = ['devel', 'browser', 'debuginfo', 'music', 'overrides',
674536
+                         'Brazil', 'British', 'Farsi', 'LowSaxon', 'cs_CZ',
674536
+                         'mysql', 'common', 'examples', 'ibase', 'odbc',
674536
+                         'postgresql', 'static']
674536
     langlist = []
674536
     seen = set()
674536
 
674536
@@ -316,7 +319,11 @@ def get_matches_from_repo(langpack_pkgs, lang):
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
+                   # this check to ensure Release_notes package 
674536
+                   # not listed twice for langinfo of zh_CN
674536
+                   # only show man-pages-zh-CN
674536
+                   if pkgs.find("man-pages") != -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
@@ -627,13 +634,40 @@ class LanginfoCommand:
674536
             # Case to handle input like zh_CN, pt_BR
674536
             elif lang in whitelisted_locales and len(lang) > 3 and lang.find("_") != -1:
674536
                 list_pkgs = get_matches_from_repo(langpack_pkgs, lang)
674536
+                # check RHEL7 release notes package
674536
+                if lang.find("pt_BR") != -1:
674536
+                   relnotpkg = "Red_Hat_Enterprise_Linux-Release_Notes-7-" + "pt-BR"
674536
+                if lang.find("zh_CN") != -1:
674536
+                   relnotpkg = "Red_Hat_Enterprise_Linux-Release_Notes-7-" + "zh-CN"
674536
+                if lang.find("zh_TW") != -1:
674536
+                   relnotpkg = "Red_Hat_Enterprise_Linux-Release_Notes-7-" + "zh-TW"
674536
+                for pkg in langpack_pkgs:
674536
+                    if pkg.find(relnotpkg) != -1:
674536
+                       list_pkgs.append(pkg)
674536
+                       break
674536
             # Case for full language name input like Japanese
674536
             elif len(lang) > 3 and lang.find("_") == -1:
674536
+                if len(langname_to_lc(lang)) == 0:
674536
+                   print "Not a valid language name"
674536
+                   return 0, [""]
674536
+
674536
                 list_pkgs = get_matches_from_repo(langpack_pkgs, langname_to_lc(lang))
674536
+                # check RHEL7 release notes package
674536
+                relnotpkg = "Red_Hat_Enterprise_Linux-Release_Notes-7-" + langname_to_lc(lang)
674536
+                for pkg in langpack_pkgs:
674536
+                    if pkg.find(relnotpkg) != -1:
674536
+                       list_pkgs.append(pkg)
674536
+                       break
674536
             # General case to handle input like ja, ru, fr, it
674536
             else:
674536
                 if lang.find("_") == -1:
674536
                      list_pkgs = get_matches_from_repo(langpack_pkgs, lang)
674536
+                     # check RHEL7 release notes package
674536
+                     relnotpkg = "Red_Hat_Enterprise_Linux-Release_Notes-7-" + lang
674536
+                     for pkg in langpack_pkgs:
674536
+                         if pkg.find(relnotpkg) != -1:
674536
+                            list_pkgs.append(pkg)
674536
+                            break
674536
                 # Case to not process mr_IN or mai_IN locales
674536
                 else:
674536
                      list_pkgs = []
674536
-- 
674536
1.8.3.1
674536