diff options
Diffstat (limited to 'SoftwareProperties/SoftwareProperties.py')
| -rw-r--r-- | SoftwareProperties/SoftwareProperties.py | 62 |
1 files changed, 61 insertions, 1 deletions
diff --git a/SoftwareProperties/SoftwareProperties.py b/SoftwareProperties/SoftwareProperties.py index 0e9a0f0d..fb9c8b05 100644 --- a/SoftwareProperties/SoftwareProperties.py +++ b/SoftwareProperties/SoftwareProperties.py @@ -260,16 +260,76 @@ class SoftwareProperties(SimpleGladeApp): self.treeview2.append_column(keys_col) def reload_sourceslist(self): + # To store the sources that provide updates + self.sources_updates = [] + # To store the sources that provide securtiy fixes + self.sources_security = [] + # To store the activated components of each dist + self.system_comps = {} + self.source_store.clear() for source in self.sourceslist.list: if source.invalid: continue - (nice_type, nice_dist, nice_comps) = self.matcher.match(source) + (nice_type, nice_dist, nice_comps, special) = self.matcher.match(source) + print "match: %s %s" % (source.dist, special) contents = "<b>%s</b>%s" % (nice_dist, nice_comps) if source.type == "deb-src": contents = "<b>%s</b> - %s %s" % (nice_dist, nice_type, nice_comps) self.source_store.append([not source.disabled, contents, source]) + + # Collect the components of an activated system dist + if special == aptsources.SOURCE_SYSTEM and source.disabled != True: + if self.system_comps.has_key(source.dist): + current = self.system_comps[source.dist] + self.system_comps[source.dist] = (current | set(source.comps)) + else: + self.system_comps[source.dist] = set(source.comps) + + # Collect sources that provide updates + elif special == aptsources.SOURCE_UPDATES: + self.sources_updates.append(source) + elif special == aptsources.SOURCE_SECURITY: + self.sources_security.append(source) + + + print "\n\nSecurity Updates: %s" % self.sources_security + print "\nSystem Sources: %s " % self.sources_system + print "\nUpdates: %s" % self.sources_updates + print "\nSystem Compos: %s " % self.system_comps + + modified = False + # Check if each security source contains all components of + # the same dist + for source in self.sources_security: + print "SecSource: %s" % source.dist + # Skip the "-security" from the dist + # FIXME: Does not work for debian + i = source.dist.find("-") + dist = source.dist[:i] + # Are there any active components for the dist? + if self.system_comps.has_key(dist): + comps_sys = self.system_comps[dist] + comps_sec = set(source.comps) + # Are there components without sec updates? + comps_endangered = comps_sys - comps_sec + print "In Danger: %s " % comps_endangered + if len(comps_endangered) > 0: + # convert the set into a list + comps_new=[] + for comp in comps_endangered: + comps_new.append(comp) + # add a security source with the additional components + print "Adding security updates for %s - %s" % (source.dist, comps_new) + self.sourceslist.add(source.type, source.uri, + source.dist, comps_new, + source.comment) + modified = True + # Reload the sourceslist if we added a new source + if modified == True: + print "modified" + self.reload_sourceslist() def reload_keyslist(self): self.keys_store.clear() |
