def test_cmp(self): pkg1 = self.make_fakepkg() pkg2 = self.make_fakepkg(ver=2) mpkg1 = MutatedPkg(pkg1, {}) mpkg2 = MutatedPkg(pkg2, {}) for lpkg in (pkg1, mpkg1): self.assertTrue(cmp(lpkg, mpkg2) < 0) self.assertTrue(cmp(mpkg2, lpkg) > 0) self.assertEqual(mpkg1, mpkg1) self.assertEqual(pkg1, mpkg1)
def itermatch(self, *a, **kwds): return (MutatedPkg( x, overrides={"depends": self.default_depends, "rdepends": self.default_rdepends, "post_rdepends": self.default_post_rdepends} ) for x in self.raw_repo.itermatch(*a, **kwds))
def itermatch(self, *a, **kwds): return (MutatedPkg(x, overrides={ "bdepend": self.default_bdepend, "depend": self.default_depend, "rdepend": self.default_rdepend, "pdepend": self.default_pdepend }) for x in self.raw_repo.itermatch(*a, **kwds))
def trigger(self, engine, cset): pkg = getattr(engine, self._copy_source) # don't build binpkgs of target repo binpkgs if self.skip_if_source and str(getattr( pkg, 'repo')) == self.target_repo.repo_id: return old_pkg = self.target_repo.match(pkg.versioned_atom) wrapped_pkg = MutatedPkg(pkg, {'contents': cset}) if old_pkg: txt = 'replacing' op = self.target_repo.operations.replace(*(old_pkg + [wrapped_pkg])) else: txt = 'installing' op = self.target_repo.operations.install(wrapped_pkg) engine.observer.info(f"{txt} {pkg} to {self.target_repo.location}") op.finish()
def test_getattr(self): pkg = self.make_fakepkg() self.assertEqual(MutatedPkg(pkg, {}).a, 1) self.assertEqual(MutatedPkg(pkg, {"a": 2}).a, 2) self.assertRaises(AttributeError, MutatedPkg(pkg, {}).__getattr__, "b")
def test_raw_pkg(self): pkg = self.make_fakepkg() self.assertIdentical(MutatedPkg(pkg, {})._raw_pkg, pkg)
def finalize(self): return MutatedPkg(self.pkg, {"environment": self.get_env_source()})
def _update_pkg_contents(self, contents): self.new_pkg = MutatedPkg(self.new_pkg, {"contents": contents})
def _update_new_pkg(self, cset): self.new_pkg = MutatedPkg(self.new_pkg, {"contents": cset})