def test_install(self): root = self.testrepomainrelease_dir media, distroconf, distro = self.get_media_config(root=root) media.load() t = Transaction(distro, distroconf) pkgset = media.packages_by_source("null-a").next() t.install(media, pkgset, "installing a package set into the repo") t.execute() for pkg in pkgset.packages(): oldpath = pkg.path newpath = media.package_path(pkg) self.assertTrue(os.path.exists(newpath), "%s not found" % (newpath))
def put(self, pkgset, medianame=None): if not medianame: media = self.choose_media_for(pkgset) else: media = self.mediaconfs.byname(medianame) for filter in self._install_filters: filter.check_media(pkgset, self.mediaconfs, media) trans = Transaction(self, self.distroconf) for filter in self._install_filters: filter.filter(pkgset, trans, media, self.mediaconfs, self.archconfs) trans.install(media, pkgset, "msys-put") trans.execute()
def test_remove(self): root = self.testrepomainrelease_dir media, distroconf, distro = self.get_media_config(root=root) media.load() t = Transaction(distro, distroconf) pkgset = media.packages_by_source("null-a").next() t.remove(media, pkgset, "removing a set of packages") t.execute() for pkg in pkgset.packages(): oldpath = media.package_path(pkg) filename = os.path.basename(oldpath) newpath = os.path.join(self.testrecentlyremoved_dir, t.storedir, filename) self.assertTrue(os.path.exists(newpath), "%s not found" % (newpath))
def move(self, sourcename, frommedia, tomedia): f_mediainfo = self.mediaconfs.byname(frommedia) t_mediainfo = self.mediaconfs.byname(tomedia) if f_mediainfo is None: raise DistroError("unknown source media %r" % (frommedia)) if t_mediainfo is None: raise DistroError("unknown destination media %r" % (tomedia)) trans = Transaction(self, self.distroconf) found = list(f_mediainfo.packages_by_source(sourcename)) if not found: raise DistroError("package %r not found" % (sourcename)) for pkgset in found: for filter in self._move_filters: filter.move(pkgset, trans, f_mediainfo, t_mediainfo, self.mediaconfs, self.archconfs) msg = "moving %s-%s from %s to %s" % (sourcename, pkgset.source().fullversion, frommedia, tomedia) trans.install(t_mediainfo, pkgset, msg, touches=(f_mediainfo,)) trans.execute()