[PATCH 1/2] Add kickstart lang --addsupport option

Vratislav Podzimek vpodzime at redhat.com
Mon Mar 25 11:55:37 UTC 2013


On Mon, 2013-03-25 at 10:22 +0100, Radek Vykydal wrote:
> ---
>  pyanaconda/install.py              |  2 +-
>  pyanaconda/kickstart.py            |  4 ++--
>  pyanaconda/packaging/yumpayload.py | 20 +++++++++++++++-----
>  3 files changed, 18 insertions(+), 8 deletions(-)
> 
> diff --git a/pyanaconda/install.py b/pyanaconda/install.py
> index 08b3966..cbaefce 100644
> --- a/pyanaconda/install.py
> +++ b/pyanaconda/install.py
> @@ -128,7 +128,7 @@ def doInstall(storage, payload, ksdata, instClass):
>      # system is bootable and configurable, and some other packages in order
>      # to finish setting up the system.
>      packages = storage.packages + ["authconfig", "firewalld"]
> -    payload.preInstall(packages=packages, groups=payload.languageGroups(ksdata.lang.lang))
> +    payload.preInstall(packages=packages, groups=payload.languageGroups())
>      payload.install()
>  
>      if flags.flags.livecdInstall:
> diff --git a/pyanaconda/kickstart.py b/pyanaconda/kickstart.py
> index 9060c58..bcfcea6 100644
> --- a/pyanaconda/kickstart.py
> +++ b/pyanaconda/kickstart.py
> @@ -576,9 +576,9 @@ class IscsiName(commands.iscsiname.FC6_IscsiName):
>          blivet.iscsi.iscsi().initiator = self.iscsiname
>          return retval
>  
> -class Lang(commands.lang.FC3_Lang):
> +class Lang(commands.lang.F19_Lang):
>      def __init__(self, *args, **kwargs):
> -        commands.lang.FC3_Lang.__init__(self, *args, **kwargs)
> +        commands.lang.F19_Lang.__init__(self, *args, **kwargs)
>          if not self.lang and not flags.automatedInstall:
>              self.lang = DEFAULT_LANG
>  
> diff --git a/pyanaconda/packaging/yumpayload.py b/pyanaconda/packaging/yumpayload.py
> index 4fc6177..02217ee 100644
> --- a/pyanaconda/packaging/yumpayload.py
> +++ b/pyanaconda/packaging/yumpayload.py
> @@ -235,6 +235,13 @@ class YumPayload(PackagePayload):
>  
>          self.txID = None
>  
> +    def _writeLangpacksConfig(self):
> +        langs = [self.data.lang.lang] + self.data.lang.addsupport
> +        log.debug("configuring langpacks for %s" % langs)
> +        with open("/etc/yum/pluginconf.d/langpacks.conf", "a") as f:
> +            f.write("# Added by Anaconda\n")
> +            f.write("langpack_locales = %s\n" % ", ".join(langs))
> +
>      def _writeYumConfig(self):
>          """ Write out anaconda's main yum configuration file. """
>          buf = """
> @@ -345,6 +352,7 @@ reposdir=%s
>  
>          releasever = self._yum.conf.yumvar['releasever']
>          self._writeYumConfig()
> +        self._writeLangpacksConfig()
>          self._resetYum(root=ROOT_PATH, keep_cache=True)
>          log.debug("setting releasever to previous value of %s" % releasever)
>          self._yum.preconf.releasever = releasever
> @@ -1094,16 +1102,18 @@ reposdir=%s
>  
>          return groups
>  
> -    def languageGroups(self, lang):
> +    def languageGroups(self):
> +        langlist = [self.data.lang.lang] + self.data.lang.addsupport
>          groups = []
>          yum_groups = self._yumGroups
>  
>          if yum_groups:
>              with _yum_lock:
> -                langs = expand_langs(lang)
> -                groups = map(lambda x: [g.groupid for g in
> -                             yum_groups.get_groups() if g.langonly == x],
> -                             langs)
> +                for lang in langlist:
> +                    langs = expand_langs(lang)
> +                    groups.extend(map(lambda x: [g.groupid for g in
> +                                  yum_groups.get_groups() if g.langonly == x],
> +                                  langs))
Could we please make this a bit better readable? It was quite cryptic
before and now it's even worse.

-- 
Vratislav Podzimek

Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic



More information about the anaconda-patches mailing list