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

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