Esempio n. 1
0
    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)
Esempio n. 2
0
 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))
Esempio n. 3
0
 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))
Esempio n. 4
0
    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()
Esempio n. 5
0
 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")
Esempio n. 6
0
 def test_raw_pkg(self):
     pkg = self.make_fakepkg()
     self.assertIdentical(MutatedPkg(pkg, {})._raw_pkg, pkg)
Esempio n. 7
0
 def finalize(self):
     return MutatedPkg(self.pkg, {"environment": self.get_env_source()})
Esempio n. 8
0
 def _update_pkg_contents(self, contents):
     self.new_pkg = MutatedPkg(self.new_pkg, {"contents": contents})
Esempio n. 9
0
 def _update_new_pkg(self, cset):
     self.new_pkg = MutatedPkg(self.new_pkg, {"contents": cset})