diff options
Diffstat (limited to 'aptsources/sourceslist.py')
| -rw-r--r-- | aptsources/sourceslist.py | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/aptsources/sourceslist.py b/aptsources/sourceslist.py index 76bea43a..3cfe1791 100644 --- a/aptsources/sourceslist.py +++ b/aptsources/sourceslist.py @@ -81,6 +81,7 @@ class SourceEntry(object): self.invalid = False # is the source entry valid self.disabled = False # is it disabled ('#' in front) self.type = "" # what type (deb, deb-src) + self.architectures = [] # architectures self.uri = "" # base-uri self.dist = "" # distribution (dapper, edgy, etc) self.comps = [] # list of available componetns @@ -113,7 +114,7 @@ class SourceEntry(object): p_found = False space_found = False for i in range(len(line)): - if line[i] == "[": + if line[i] == "[" and not space_found: p_found=True tmp += line[i] elif line[i] == "]": @@ -169,6 +170,20 @@ class SourceEntry(object): if self.type not in ("deb", "deb-src", "rpm", "rpm-src"): self.invalid = True return + + if pieces[1].strip()[0] == "[": + options = pieces.pop(1).strip("[]").split(";") + for option in options: + try: + key, value = option.split("=", 1) + except Exception: + self.invalid = True + else: + if key == "arch": + self.architectures = value.split(",") + else: + self.invalid = True + # URI self.uri = pieces[1].strip() if len(self.uri) < 1: @@ -204,7 +219,12 @@ class SourceEntry(object): line = "" if self.disabled: line = "# " - line += "%s %s %s" % (self.type, self.uri, self.dist) + + line += self.type + + if self.architectures: + line += " [arch=%s]" % ",".join(self.architectures) + line += " %s %s" % (self.uri, self.dist) if len(self.comps) > 0: line += " " + " ".join(self.comps) if self.comment != "": |
