Sophie

Sophie

distrib > * > 2008.0 > x86_64 > by-pkgid > c4aaebff5a034775f37cbc49827cf3b9 > files > 6

smart-0.51-17mdv2008.0.src.rpm

diff -Naur smart-0.51/smart/channel.py smart-0.51.tpg/smart/channel.py
--- smart-0.51/smart/channel.py	2005-12-14 19:27:17.000000000 +0000
+++ smart-0.51.tpg/smart/channel.py	2007-08-28 09:14:24.000000000 +0000
@@ -173,7 +173,17 @@
             continue
         if key not in data:
             data[key] = default
-    return channel.create(alias, data)
+    c = channel.create(alias, data)
+    if "mirrors" in data:
+        for mirror in data.get("mirrors"):
+            if 'baseurl' in data:
+                from smart.const import DEBUG
+                if sysconf.get("log-level") == DEBUG:
+                    print "Adding mirror \"%s\" for \"%s\"" % (mirror, data["baseurl"])
+                sysconf.add(("mirrors", data["baseurl"]), mirror, unique=True)
+            else:
+                print "Warning: channel '%s' has no attribute 'baseurl'" % alias
+    return c
 
 def createChannelDescription(alias, data):
     ctype = data.get("type")
@@ -211,6 +221,8 @@
     if hasattr(info, "preParse"):
         data = info.preParse(data)
     newdata = {}
+    if data and data.has_key("mirrors"):
+        newdata["mirrors"] = data["mirrors"]
     for key, label, ftype, default, descr in info.fields:
         if key == "alias":
             continue
@@ -265,8 +277,13 @@
         elif current is not None and not line[0] == "#" and "=" in line:
             key, value = line.split("=")
             current[key.strip().lower()] = value.strip()
+    mirrorsHaven = None
+    if current and current.has_key("mirrors"):
+        mirrorsHaven = current["mirrors"]
     for alias in channels:
         channels[alias] = parseChannelData(channels[alias])
+    if alias and mirrorsHaven:
+        channels[alias]["mirrors"] = mirrorsHaven
     return channels
 
 def getChannelInfo(type):