[PATCH rhel7-branch] Re-enable addons as additional repositories.

Chris Lumens clumens at redhat.com
Wed Aug 20 18:08:04 UTC 2014


This appears to have been broken due to a change in the format of the .treeinfo
file.  Addons are now listed under a variant heading, just like the main
installation source.  They are differentiated by type=addon, though.

While I was at it, make sure the repo editing box becomes sensitive when you
enable a repo.  It was not being made sensitive at all.

Resolves: rhbz#1061174
---
 pyanaconda/packaging/yumpayload.py    | 20 ++++++++++++--------
 pyanaconda/ui/gui/spokes/source.glade |  1 +
 pyanaconda/ui/gui/spokes/source.py    |  3 ++-
 3 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/pyanaconda/packaging/yumpayload.py b/pyanaconda/packaging/yumpayload.py
index e97790f..3546695 100644
--- a/pyanaconda/packaging/yumpayload.py
+++ b/pyanaconda/packaging/yumpayload.py
@@ -530,6 +530,7 @@ reposdir=%s
 
                 self._addYumRepo(BASE_REPO_NAME, url, mirrorlist=mirrorlist,
                                  proxyurl=proxyurl, sslverify=sslverify)
+                self._addAddons(self._yum.repos.getRepo(BASE_REPO_NAME), url, proxyurl, sslverify)
             except (MetadataError, PayloadError) as e:
                 log.error("base repo (%s/%s) not valid -- removing it",
                           method.method, url)
@@ -551,6 +552,7 @@ reposdir=%s
                 if self._yum.conf.yumvar['releasever'] == "rawhide" and \
                    "rawhide" in self.repos:
                     self.enableRepo("rawhide")
+                    self._addAddons(self._yum.repos.getRepo("rawhide"), url, proxyurl, sslverify)
 
         # set up addon repos
         # FIXME: driverdisk support
@@ -848,7 +850,9 @@ reposdir=%s
         self._addYumRepo(repo.name, url, repo.mirrorlist, cost=repo.cost,
                          exclude=repo.excludepkgs, includepkgs=repo.includepkgs,
                          proxyurl=proxy, sslverify=sslverify)
+        self._addAddons(repo, url, proxy, sslverify)
 
+    def _addAddons(self, repo, url, proxy, sslverify):
         addons = self._getAddons(url or repo.mirrorlist,
                                  proxy,
                                  sslverify)
@@ -857,12 +861,12 @@ reposdir=%s
         for addon in addons:
             # Does this repo already exist? If so, it was already added and may have
             # been edited by the user so skip adding it again.
-            if self.getAddOnRepo(addon[1]):
-                log.debug("Skipping %s, already exists.", addon[1])
+            if self.getAddOnRepo(addon[0]):
+                log.debug("Skipping %s, already exists.", addon[0])
                 continue
 
-            log.info("Adding addon repo %s", addon[1])
-            ks_repo = self.data.RepoData(name=addon[1],
+            log.info("Adding addon repo %s", addon[0])
+            ks_repo = self.data.RepoData(name=addon[0],
                                          baseurl=addon[2],
                                          proxy=repo.proxy,
                                          enabled=False)
@@ -898,15 +902,15 @@ reposdir=%s
             return retval
 
         section = "variant-%s" % variant
-        if c.has_section(section) and c.has_option(section, "addons"):
-            validAddons = c.get(section, "addons").split(",")
+        if c.has_section(section) and c.has_option(section, "variants"):
+            validAddons = c.get(section, "variants").split(",")
         else:
             return retval
         log.debug("Addons found: %s", validAddons)
 
         for addon in validAddons:
-            addonSection = "addon-%s" % addon
-            if not c.has_section(addonSection) or not c.has_option(addonSection, "repository"):
+            addonSection = "variant-%s" % addon
+            if not c.has_section(addonSection) or c.get(addonSection, "type") != "addon" or not c.has_option(addonSection, "repository"):
                 continue
 
             url = "%s/%s" % (baseurl, c.get(addonSection, "repository"))
diff --git a/pyanaconda/ui/gui/spokes/source.glade b/pyanaconda/ui/gui/spokes/source.glade
index 6d876fb..b1f4a7e 100644
--- a/pyanaconda/ui/gui/spokes/source.glade
+++ b/pyanaconda/ui/gui/spokes/source.glade
@@ -1214,6 +1214,7 @@
                               <item translatable="yes">http://</item>
                               <item translatable="yes">https://</item>
                               <item translatable="yes">ftp://</item>
+                              <item translatable="yes">file://</item>
                             </items>
                             <signal name="changed" handler="on_repoUrl_changed" swapped="no"/>
                           </object>
diff --git a/pyanaconda/ui/gui/spokes/source.py b/pyanaconda/ui/gui/spokes/source.py
index d1ce6a1..a65d2c7 100644
--- a/pyanaconda/ui/gui/spokes/source.py
+++ b/pyanaconda/ui/gui/spokes/source.py
@@ -63,7 +63,7 @@ REPO_ENABLED_COL = 0
 REPO_NAME_COL = 1
 REPO_OBJ = 2
 
-REPO_PROTO = [(0, "http://"), (1, "https://"), (2, "ftp://")]
+REPO_PROTO = [(0, "http://"), (1, "https://"), (2, "ftp://"), (3, "file://")]
 
 class ProxyDialog(GUIObject):
     builderObjects = ["proxyDialog"]
@@ -978,6 +978,7 @@ class SourceSpoke(NormalSpoke):
         enabled = not self._repoStore[path][REPO_ENABLED_COL]
         self._repoStore[path][REPO_ENABLED_COL] = enabled
         self._repoStore[path][REPO_OBJ].enabled = enabled
+        self._repoEntryBox.set_sensitive(enabled)
 
     def _clear_repo_info(self):
         """ Clear the text from the repo entry fields
-- 
1.9.3



More information about the anaconda-patches mailing list