146
149
self.add_vendor_key_from_keyserver(**self.trans.kwargs)
147
150
elif self.trans.role == ROLE_REMOVE_VENDOR_KEY:
148
151
self.remove_vendor_key(**self.trans.kwargs)
152
elif self.trans.role == ROLE_ADD_REPOSITORY:
153
self.add_repository(**self.trans.kwargs)
154
elif self.trans.role == ROLE_ENABLE_DISTRO_COMP:
155
self.enable_distro_comp(**self.trans.kwargs)
150
157
self._open_cache()
151
158
# Process transaction which can handle a broken dep cache
295
302
resolver.clear(pkg)
296
303
resolver.protect(pkg)
305
def enable_distro_comp(self, component):
306
"""Enable given component in the sources list.
309
component -- a component, e.g. main or universe
311
old_umask = os.umask(0022)
313
sourceslist = SourcesList()
314
distro = aptsources.distro.get_distro()
315
distro.get_sources(sourceslist)
316
distro.enable_component(component)
321
def add_repository(self, rtype, uri, dist, comps, comment, sourcesfile):
322
"""Add given repository to the sources list.
325
rtype -- the type of the entry (deb, deb-src)
326
uri -- the main repository uri (e.g. http://archive.ubuntu.com/ubuntu)
327
dist -- the distribution to use (e.g. karmic, "/")
328
comps -- a (possible empty) list of components (main, restricted)
329
comment -- an (optional) comment
330
sourcesfile -- an (optinal) filename in sources.list.d
333
if not sourcesfile.endswith(".list"):
334
sourcesfile += ".list"
335
d = apt_pkg.config.find_dir("Dir::Etc::sourceparts")
336
sourcesfile = os.path.join(d, os.path.basename(sourcesfile))
339
old_umask = os.umask(0022)
341
sources = SourcesList()
342
entry = sources.add(rtype, uri, dist, comps, comment,
345
#FIXME: Introduce new error codes
346
raise RepositoryInvalidError()
298
354
def add_vendor_key_from_keyserver(self, keyid, keyserver):
299
355
"""Add the signing key from the given (keyid, keyserver) to the