[PATCH] Add support for architecture suffixes in help files (#1072033)

Martin Kolman mkolman at redhat.com
Fri Jul 17 08:31:29 UTC 2015


On Fri, 2015-07-17 at 10:01 +0200, Jiří Konečný wrote:
> On Thu, 2015-07-16 at 17:16 +0200, Martin Kolman wrote:
> > For some Anaconda screens there might be multiple help file 
> > variants,
> > differentiated by an architecture specific suffix. Other screens 
> > that
> > are not influenced by architectural differences have a single 
> > version,
> > which uses the "common" prefix.
> > These two don't mix - the given screen is either covered by a 
> > single 
> > common file
> > or by a set of files with architecture specific suffixes for all 
> > supported
> > architectures.
> > 
> > Related: rhbz#1072033
> > Related: rhbz#1196721
> > Signed-off-by: Martin Kolman <mkolman at redhat.com>
> > ---
> >  pyanaconda/ihelp.py | 43 
> > ++++++++++++++++++++++++++++++++++++++++++-
> >  1 file changed, 42 insertions(+), 1 deletion(-)
> > 
> > diff --git a/pyanaconda/ihelp.py b/pyanaconda/ihelp.py
> > index 470f300..177bb90 100644
> > --- a/pyanaconda/ihelp.py
> > +++ b/pyanaconda/ihelp.py
> > @@ -27,9 +27,13 @@ from pyanaconda.localization import 
> > find_best_locale_match
> >  from pyanaconda.constants import DEFAULT_LANG
> >  from pyanaconda.iutil import startProgram
> >  
> > +import blivet
> I think better will be import only arch part of the blivet when you
> don't use anything else from it.
Sure, I can change it. :)

> 
> > +
> >  import logging
> >  log = logging.getLogger("anaconda")
> >  
> > +COMMON_HELP_FILE_VARIANT_SUFFIX = "common"
> > +
> >  yelp_process = None
> >  
> >  def _get_best_help_file(help_folder, help_file):
> > @@ -93,8 +97,45 @@ def get_help_path(help_file, instclass):
> >      # help l10n handling
> >  
> >      if help_file:
> > +        # Some of the RHEL7 installation guide pages might be 
> > marked 
> > as "common",
> > +        # meaning that their content is common for all 
> > architectures, while
> > +        # other pages might be architecture specific. These two 
> > categories
> > +        # are mutually exclusive - if there is a common variant, 
> > there will be
> > +        # no arch specific variant and if there are arch specific 
> > variants,
> > +        # there will be no common variant.
> > +
> > +        # check for the common variant
> > +        file_head, file_tail = os.path.splitext(help_file)
> > +
> > +        help_file = "%s-%s%s" % (file_head, 
> > COMMON_HELP_FILE_VARIANT_SUFFIX, file_tail)
> > +        help_path = _get_best_help_file(instclass.help_folder, 
> > help_file)
> > +        if help_path:
> > +            log.debug("found a common help file variant at %s", 
> > help_path)
> > +            return help_path
> > +
> > +        # check for the arch specific variant
> > +
> > +        # the documentation files don't differentiate between 
> > 32bit 
> > and 64bit x86
> > +        # and just use a "x86" suffix for both
> > +        if blivet.arch.isX86:
> > +            arch = "x86"
> > +        # the arm docks are the same as the x86 docs
> > +        elif blivet.arch.isARM() or blivet.arch.isAARCH64():
> > +            arch = "x86" 
> > +        # same thing for s390 (31 bit) and s390x (64 bit), they 
> > are 
> > just "s390"
> > +        elif blivet.arch.isS390():
> > +            arch = "s390"
> > +        # 32 bit PPC is no longer supported in RHEL and both 64 
> > bit 
> > PPC variants (BE and LE)
> > +        # are covered with the "ppc64" suffix
> > +        elif blivet.arch.isPPC():
> > +            arch = "ppc64"
> > +        else:
> > +            arch = blivet.arch.getArch()
> > +
> > +        help_file = "%s-%s%s" % (file_head, arch, file_tail)
> >          help_path = _get_best_help_file(instclass.help_folder, 
> > help_file)
> > -        if help_path is not None:
> > +        if help_path:
> > +            log.debug("found arch specific help file variant at 
> > %s", 
> > help_path)
> >              return help_path
> >  
> >      # the screen did not have a helpFile defined or the defined 
> > help 
> > file
> 
> Other than the comment above. Ack
> _______________________________________________
> anaconda-patches mailing list
> anaconda-patches at lists.fedorahosted.org
> https://lists.fedorahosted.org/mailman/listinfo/anaconda-patches


More information about the anaconda-patches mailing list