def delete(self, overlay): ''' Add an overlay to the local list of overlays. >>> import tempfile >>> tmpdir = tempfile.mkdtemp(prefix="laymantmp_") >>> write = os.path.join(tmpdir, 'installed.xml') >>> write2 = os.path.join(tmpdir, 'make.conf') >>> here = os.path.dirname(os.path.realpath(__file__)) >>> from layman.config import OptionConfig >>> myoptions = {'installed' : ... here + '/tests/testfiles/global-overlays.xml', ... 'local_list': here + '/tests/testfiles/overlays.xml', ... 'make_conf' : write2, ... 'nocheck' : 'yes', ... 'storage' : tmpdir} >>> config = OptionConfig(myoptions) >>> config.set_option('quietness', 3) >>> a = DB(config) >>> config.set_option('installed', write) >>> b = DB(config) >>> config['output'].set_colorize(False) >>> m = MakeConf(config, b.overlays) >>> m.path = here + '/tests/testfiles/make.conf' >>> m.read() True >>> m.path = write2 >>> m.write() True # >>> b.add(a.select('wrobel-stable')) #doctest: +ELLIPSIS # * Running command "/usr/bin/rsync -rlptDvz --progress --delete --delete-after --timeout=180 --exclude="distfiles/*" --exclude="local/*" --exclude="packages/*" "rsync://gunnarwrobel.de/wrobel-stable/*" "/tmp/file.../wrobel-stable""... # >>> b.add(a.select('wrobel')) #doctest: +ELLIPSIS # * Running command "/usr/bin/svn co "https://overlays.gentoo.org/svn/dev/wrobel/" "/tmp/file.../wrobel""... # >>> c = DbBase([write, ], dict()) # >>> c.overlays.keys() # [u'wrobel', u'wrobel-stable'] # >>> b.delete(b.select('wrobel')) # >>> c = DbBase([write, ], dict()) # >>> c.overlays.keys() # [u'wrobel-stable'] # >>> m = MakeConf(config, b.overlays) # >>> [i.name for i in m.overlays] #doctest: +ELLIPSIS # [u'wrobel-stable'] # >>> os.unlink(write) >>> os.unlink(write2) >>> import shutil >>> shutil.rmtree(tmpdir) ''' if overlay.name in self.overlays.keys(): make_conf = MakeConf(self.config, self.overlays) overlay.delete(self.config['storage']) del self.overlays[overlay.name] self.write(self.path) make_conf.delete(overlay) else: self.output.error('No local overlay named "' + overlay.name + '"!') return False return True