summaryrefslogtreecommitdiff
path: root/aptsources
diff options
context:
space:
mode:
Diffstat (limited to 'aptsources')
-rw-r--r--aptsources/sourceslist.py23
1 files changed, 18 insertions, 5 deletions
diff --git a/aptsources/sourceslist.py b/aptsources/sourceslist.py
index 43729246..69e7e107 100644
--- a/aptsources/sourceslist.py
+++ b/aptsources/sourceslist.py
@@ -91,6 +91,7 @@ class SourceEntry(object):
self.disabled = False # is it disabled ('#' in front)
self.type = "" # what type (deb, deb-src)
self.architectures = [] # architectures
+ self.trusted = None # Trusted
self.uri = "" # base-uri
self.dist = "" # distribution (dapper, edgy, etc)
self.comps = [] # list of available componetns
@@ -123,9 +124,15 @@ class SourceEntry(object):
p_found = False
space_found = False
for i in range(len(line)):
- if line[i] == "[" and not space_found:
- p_found=True
- tmp += line[i]
+ if line[i] == "[":
+ if space_found:
+ space_found = False
+ p_found = True
+ pieces.append(tmp)
+ tmp = line[i]
+ else:
+ p_found=True
+ tmp += line[i]
elif line[i] == "]":
p_found=False
tmp += line[i]
@@ -181,7 +188,7 @@ class SourceEntry(object):
return
if pieces[1].strip()[0] == "[":
- options = pieces.pop(1).strip("[]").split(";")
+ options = pieces.pop(1).strip("[]").split()
for option in options:
try:
key, value = option.split("=", 1)
@@ -190,6 +197,8 @@ class SourceEntry(object):
else:
if key == "arch":
self.architectures = value.split(",")
+ elif key == "trusted":
+ self.trusted = apt_pkg.string_to_bool(value)
else:
self.invalid = True
@@ -231,7 +240,11 @@ class SourceEntry(object):
line += self.type
- if self.architectures:
+ if self.architectures and self.trusted is not None:
+ line += " [arch=%s trusted=%s]" % (",".join(self.architectures), "yes" if self.trusted else "no")
+ elif self.trusted is not None:
+ line += " [trusted=%s]" % ("yes" if self.trusted else "no")
+ elif self.architectures:
line += " [arch=%s]" % ",".join(self.architectures)
line += " %s %s" % (self.uri, self.dist)
if len(self.comps) > 0: