Re: [PATCH rhel6-branch 3/3] Add repos for all addons in all enabled repositories (#580697).

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Assuming Radek's questions are answered, ack.

On Thu, 29 Apr 2010, Chris Lumens wrote:

---
yuminstall.py |   68 +++++++++++++++++++++++++++++++++++++++++++++-----------
1 files changed, 54 insertions(+), 14 deletions(-)

diff --git a/yuminstall.py b/yuminstall.py
index 35ef876..5a38cea 100644
--- a/yuminstall.py
+++ b/yuminstall.py
@@ -20,6 +20,7 @@
from flags import flags
from errors import *

+from ConfigParser import ConfigParser
import sys
import os
import os.path
@@ -589,26 +590,52 @@ class AnacondaYum(YumSorter):

        return repo

-    def _getTreeinfo(self):
-        if os.access("%s/.treeinfo" % self.anaconda.methodstr, os.R_OK):
-            return "%s/.treeinfo" % self.anaconda.methodstr
+    # Given the baseurl for a repository, see if it has any valid addon repos and
+    # if so, return a list of (repo name, repo URL).
+    def _getAddons(self, baseurl):
+        retval = []
+        c = ConfigParser()
+
+        # If there's no .treeinfo for this repo, don't bother looking for addons.
+        treeinfo = self._getTreeinfo(baseurl)
+        if not treeinfo:
+            return retval
+
+        # We need to know which variant is being installed so we know what addons
+        # are valid options.
+        ConfigParser.read(c, treeinfo)
+        variant = c.get("general", "variant")
+
+        section = "variant-%s" % variant
+        if c.has_section(section):
+            validAddons = c.get(section, "addons").split(",")
        else:
-            try:
-                ug = URLGrabber()
-                ug.urlgrab("%s/.treeinfo" % self.anaconda.methodstr,
-                           "/tmp/.treeinfo", copy_local=1)
-                return "/tmp/.treeinfo"
-            except:
-                return None
+            return retval
+
+        for addon in validAddons:
+            if not c.has_section("addon-%s" % addon):
+                continue
+
+            url = "%s/%s" % (baseurl, c.get("addon-%s" % addon, "repository"))
+            retval.append((addon, url))
+
+        return retval
+
+    def _getTreeinfo(self, baseurl):
+        try:
+            ug = URLGrabber()
+            ug.urlgrab("%s/.treeinfo" % baseurl, "/tmp/.treeinfo", copy_local=1)
+            return "/tmp/.treeinfo"
+        except:
+            return None

    # We need to make sure $releasever gets set up before .repo files are
    # read.  Since there's no redhat-release package in /mnt/sysimage (and
    # won't be for quite a while), we need to do our own substutition.
    def _getReleasever(self):
-        from ConfigParser import ConfigParser
        c = ConfigParser()

-        treeinfo = self._getTreeinfo()
+        treeinfo = self._getTreeinfo(self.anaconda.methodstr)
        if not treeinfo:
            return productVersion

@@ -750,12 +777,25 @@ class AnacondaYum(YumSorter):
                repo.enable()
                extraRepos.append(repo)

+        initialRepos = self.repos.repos.values() + extraRepos
+        for repo in initialRepos:
+            addons = self._getAddons(repo.mirrorlist or repo.baseurl[0])
+            for addon in addons:
+                addonRepo = AnacondaYumRepo(addon[0])
+                addonRepo.name = addon[0]
+                addonRepo.baseurl = [ addon[1] ]
+
+                if repo.isEnabled():
+                    addonRepo.enable()
+
+                extraRepos.append(addonRepo)
+
        for repo in extraRepos:
            try:
                self.repos.add(repo)
-                log.info("added repository %s with URL %s" % (repo.name, repo.mirrorlist or repo.baseurl))
+                log.info("added repository %s with URL %s" % (repo.name, repo.mirrorlist or repo.baseurl[0]))
            except:
-                log.warning("ignoring duplicate repository %s with URL %s" % (repo.name, repo.mirrorlist or repo.baseurl))
+                log.warning("ignoring duplicate repository %s with URL %s" % (repo.name, repo.mirrorlist or repo.baseurl[0]))

        self.repos.setCacheDir(self.conf.cachedir)



- -- David Cantrell <dcantrell@xxxxxxxxxx>
Red Hat / Honolulu, HI

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iEYEARECAAYFAkvbOmEACgkQ5hsjjIy1VklNdgCg2/XBZaLYs5z23aYDEcV+0DdF
zGoAnidR6wM7rGVgil550PcBLh1qJicE
=usfa
-----END PGP SIGNATURE-----

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux