From 0d18962ad55ef1fd31974e46a65fd2fffb4a9baa Mon Sep 17 00:00:00 2001 From: "glatzor@ubuntu.com" <> Date: Wed, 28 Jun 2006 20:58:26 +0200 Subject: * start merging my old repo rewrite stuff --- UpdateManager/Common/DistInfo.py | 69 ++++++++++++++++++++++++++++------------ 1 file changed, 48 insertions(+), 21 deletions(-) (limited to 'UpdateManager/Common') diff --git a/UpdateManager/Common/DistInfo.py b/UpdateManager/Common/DistInfo.py index 102b981c..873d7132 100644 --- a/UpdateManager/Common/DistInfo.py +++ b/UpdateManager/Common/DistInfo.py @@ -28,21 +28,29 @@ import ConfigParser _ = gettext.gettext class Suite: - name = None - description = None - base_uri = None - repository_type = None - components = None + def __init__(self): + self.name = None + self.child = False + self.match_name = None + self.description = None + self.base_uri = None + self.type = None + self.components = {} + self.children = [] + self.match_uri = None + self.distribution = None + self.available = True class Component: - name = None - description = None - enabled = None + def __init__(self): + self.name = None + self.description = None + self.enabled = None class DistInfo: def __init__(self, dist = None, - base_dir = "/usr/share/update-manager/dists"): + base_dir = "/usr/share/update-manager/channels"): self.metarelease_uri = '' self.suites = [] @@ -73,21 +81,36 @@ class DistInfo: elif field == 'Suite': if suite: if component: - suite.components.append (component) + suite.components["%s" % component.name] = \ + (component.description, component.enabled) component = None self.suites.append (suite) suite = Suite () suite.name = value - suite.components = [] + suite.distribution = dist + suite.match_name = "^%s$" % value + elif field == 'MatchName': + suite.match_name = value + elif field == 'ParentSuite': + suite.child = True + for nanny in self.suites: + if nanny.name == value: + nanny.children.append(suite) + elif field == 'Available': + suite.available = value elif field == 'RepositoryType': - suite.repository_type = value + suite.type = value elif field == 'BaseURI': suite.base_uri = value + suite.match_uri = value + elif field == 'MatchURI': + suite.match_uri = value elif field == 'Description': suite.description = _(value) elif field == 'Component': if component: - suite.components.append (component) + suite.components["%s" % component.name] = \ + (component.description, component.enabled) component = Component () component.name = value elif field == 'Enabled': @@ -96,20 +119,24 @@ class DistInfo: component.description = _(value) if suite: if component: - suite.components.append (component) + suite.components["%s" % component.name] = \ + (component.description, component.enabled) component = None self.suites.append (suite) suite = None if __name__ == "__main__": - d = DistInfo ("Debian", "../../channels") + d = DistInfo ("Ubuntu", "../../channels") print d.changelogs_uri for suite in d.suites: - print suite.name - print suite.description - print suite.base_uri + print "\nSuite: %s" % suite.name + print "Desc: %s" % suite.description + print "BaseURI: %s" % suite.base_uri + print "MatchURI: %s" % suite.match_uri for component in suite.components: - print component.name - print component.description - print component.enabled + print " %s - %s - %s " % (component.name, + component.description, + component.enabled) + for child in suite.children: + print " %s" % child.description -- cgit v1.2.3 From 34bb7b2d05692dbaab36dbad43d4b4305e0ff905 Mon Sep 17 00:00:00 2001 From: "glatzor@ubuntu.com" <> Date: Thu, 29 Jun 2006 00:52:16 +0200 Subject: * fixed test output of DistInfo and channels desc for Ubuntu --- SoftwareProperties/SoftwareProperties.py | 5 +++++ UpdateManager/Common/DistInfo.py | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'UpdateManager/Common') diff --git a/SoftwareProperties/SoftwareProperties.py b/SoftwareProperties/SoftwareProperties.py index 037f01fb..e0d5f524 100644 --- a/SoftwareProperties/SoftwareProperties.py +++ b/SoftwareProperties/SoftwareProperties.py @@ -56,6 +56,11 @@ CONF_MAP = { "max_age" : "APT::Archives::MaxAge" } +( +COLUMN_ACTIVE, +COLUMN_DESC +) = range(2) + # columns of the source_store (SORE_ACTIVE, STORE_DESCRIPTION, STORE_SOURCE, STORE_SEPARATOR) = range(4) diff --git a/UpdateManager/Common/DistInfo.py b/UpdateManager/Common/DistInfo.py index 873d7132..ebf83516 100644 --- a/UpdateManager/Common/DistInfo.py +++ b/UpdateManager/Common/DistInfo.py @@ -135,8 +135,8 @@ if __name__ == "__main__": print "BaseURI: %s" % suite.base_uri print "MatchURI: %s" % suite.match_uri for component in suite.components: - print " %s - %s - %s " % (component.name, - component.description, - component.enabled) + print " %s - %s - %s " % (component, + suite.components[component][0], + suite.components[component][1]) for child in suite.children: print " %s" % child.description -- cgit v1.2.3 From 972a8ca2f1ff4466096505262305260bbd507caf Mon Sep 17 00:00:00 2001 From: "glatzor@ubuntu.com" <> Date: Thu, 29 Jun 2006 13:48:14 +0200 Subject: * add long descriptions for components * fix some boolean stuff (hide distru sources) * also rename the menu entry of the app --- SoftwareProperties/SoftwareProperties.py | 20 +++++++++++--------- UpdateManager/Common/DistInfo.py | 21 ++++++++++++++------- channels/Ubuntu.info.in | 14 +++++++++----- data/software-properties.desktop.in | 6 +++--- 4 files changed, 37 insertions(+), 24 deletions(-) (limited to 'UpdateManager/Common') diff --git a/SoftwareProperties/SoftwareProperties.py b/SoftwareProperties/SoftwareProperties.py index 0f4f5f66..da52b272 100644 --- a/SoftwareProperties/SoftwareProperties.py +++ b/SoftwareProperties/SoftwareProperties.py @@ -31,6 +31,7 @@ import tempfile from gettext import gettext as _ import os import string +import re #sys.path.append("@prefix/share/update-manager/python") @@ -120,6 +121,7 @@ class Distribution: break if self.source_template == None: print "Error: could not find a distribution template" + # FIXME: will go away - only for debugging issues sys.exit(1) # find main and child sources @@ -141,9 +143,6 @@ class Distribution: print "yeah! child found: %s" % source.template.name if source.type == "deb": self.child_sources.append(source) - media.append(source.uri) - elif source.type == "deb-src": - self.source_code_sources.append(source) self.enabled_comps = set(comps) self.used_media = set(media) @@ -174,8 +173,8 @@ class Distribution: else: # seems to be a network source self.use_internet = True - if medium != self.main_server or \ - medium != self.nearest_server: + if not re.match(medium, self.main_server) and \ + not re.match(medium, self.nearest_server): self.other_servers.append(medium) @@ -338,7 +337,7 @@ class SoftwareProperties(SimpleGladeApp): for checkbutton in self.vbox_dist_comps.get_children(): self.vbox_dist_comps.remove(checkbutton) for comp in self.distribution.source_template.components.keys(): - checkbox = gtk.CheckButton(label=self.distribution.source_template.components[comp][0]) + checkbox = gtk.CheckButton(label=self.distribution.source_template.components[comp][2]) # check if the comp is enabled # FIXME: use inconsistence if there are main sources with not all comps if comp in self.distribution.enabled_comps: @@ -395,6 +394,8 @@ class SoftwareProperties(SimpleGladeApp): cell = gtk.CellRendererText() self.combobox_server.pack_start(cell, True) self.combobox_server.add_attribute(cell, 'text', 0) + # load the mirror list in to the combo and select the one of the first + # main source server_store.append([_("%s (default)") % self.distribution.main_server, self.distribution.main_server]) server_store.append([_("%s (nearest)") % self.distribution.nearest_server, @@ -557,7 +558,8 @@ class SoftwareProperties(SimpleGladeApp): if source.template.child == False: for comp in source.comps: if source.template.components.has_key(comp): - (desc, enabled) = source.template.components[comp] + print source.template.components[comp] + (desc, enabled, desc_long) = source.template.components[comp] contents += "\n%s" % desc else: contents += "\n%s" % comp @@ -591,8 +593,8 @@ class SoftwareProperties(SimpleGladeApp): self.sourceslist_visible=[] self.distribution.get_sources(self.sourceslist) for source in self.sourceslist.list: - if not source.invalid or\ - source not in self.distribution.main_sources or\ + if not source.invalid and\ + source not in self.distribution.main_sources and\ source not in self.distribution.child_sources: self.sourceslist_visible.append(source) diff --git a/UpdateManager/Common/DistInfo.py b/UpdateManager/Common/DistInfo.py index ebf83516..7d2d37ad 100644 --- a/UpdateManager/Common/DistInfo.py +++ b/UpdateManager/Common/DistInfo.py @@ -43,8 +43,9 @@ class Suite: class Component: def __init__(self): - self.name = None - self.description = None + self.name = "" + self.description = "" + self.description_long = "" self.enabled = None class DistInfo: @@ -82,7 +83,8 @@ class DistInfo: if suite: if component: suite.components["%s" % component.name] = \ - (component.description, component.enabled) + (component.description, component.enabled, + component.description_long) component = None self.suites.append (suite) suite = Suite () @@ -110,17 +112,21 @@ class DistInfo: elif field == 'Component': if component: suite.components["%s" % component.name] = \ - (component.description, component.enabled) + (component.description, component.enabled, + component.description_long) component = Component () component.name = value elif field == 'Enabled': component.enabled = bool(int(value)) elif field == 'CompDescription': component.description = _(value) + elif field == 'CompDescriptionLong': + component.description_long = _(value) if suite: if component: suite.components["%s" % component.name] = \ - (component.description, component.enabled) + (component.description, component.enabled, + component.description_long) component = None self.suites.append (suite) suite = None @@ -135,8 +141,9 @@ if __name__ == "__main__": print "BaseURI: %s" % suite.base_uri print "MatchURI: %s" % suite.match_uri for component in suite.components: - print " %s - %s - %s " % (component, + print " %s - %s - %s - %s" % (component, suite.components[component][0], - suite.components[component][1]) + suite.components[component][1], + suite.components[component][2]) for child in suite.children: print " %s" % child.description diff --git a/channels/Ubuntu.info.in b/channels/Ubuntu.info.in index eb88ceb9..f92d8b8b 100644 --- a/channels/Ubuntu.info.in +++ b/channels/Ubuntu.info.in @@ -8,15 +8,19 @@ _Description: Ubuntu 6.04 'Dapper Drake' Component: main Enabled: 1 _CompDescription: Officially supported -Component: restricted -Enabled: 1 -_CompDescription: Restricted copyright +_CompDescriptionLong: Free software that is officially supported by Canonical Ltd. (main) Component: universe Enabled: 0 -_CompDescription: Community maintained (Universe) +_CompDescription: Community maintained (universe) +_CompDescriptionLong: Free software that is maintained by the community (universe) +Component: restricted +Enabled: 1 +_CompDescription: Non-free drivers +_CompDescriptionLong: Non-free drivers for devices (restricted) Component: multiverse Enabled: 0 -_CompDescription: Non-free (Multiverse) +_CompDescription: Restricted software (Multiverse) +_CompDescriptionLong: Software that is restricted by copyright or legal issues (multiverse) Suite: dapper MatchName: .* diff --git a/data/software-properties.desktop.in b/data/software-properties.desktop.in index c125b4f7..330fc8bc 100644 --- a/data/software-properties.desktop.in +++ b/data/software-properties.desktop.in @@ -1,7 +1,7 @@ [Desktop Entry] -_Name=Software Properties -_GenericName=Software Properties -_Comment=Configure software channels and internet updates +_Name=Software Sources +_GenericName=Software Sources +_Comment=Configure the sources for installable software and updates Exec=gksu /usr/bin/software-properties Icon=software-properties Terminal=false -- cgit v1.2.3