Exemplo n.º 1
0
    def test_versioned(self):
        astr = "app-arch/tarsync"
        le_cpv = CPV.versioned("%s-0" % astr)
        eq_cpv = CPV.versioned("%s-1.1-r2" % astr)
        ge_cpv = CPV.versioned("%s-2" % astr)
        # <, =, >
        ops = (-1, 0, 1)

        for ops, ver in ((-1, "1.0"), (-1, "1.1"),
            (0, "1.1-r2"), (1, "1.1-r3"), (1, "1.2")):
            if not isinstance(ops, (list, tuple)):
                ops = (ops,)
            a = self.make_atom(astr, ops, ver)
            if -1 in ops:
                self.assertMatch(a, ge_cpv)
                self.assertMatch(a, eq_cpv)
                self.assertNotMatch(a, le_cpv)
            if 0 in ops:
                self.assertTrue(a.match(eq_cpv))
                if ops == (0,):
                    self.assertNotMatch(a, le_cpv)
                    self.assertNotMatch(a, ge_cpv)
            if 1 in ops:
                self.assertNotMatch(a, ge_cpv)
                self.assertMatch(a, eq_cpv)
                self.assertMatch(a, le_cpv)
Exemplo n.º 2
0
    def test_versioned(self):
        astr = "app-arch/tarsync"
        le_cpv = CPV.versioned(f"{astr}-0")
        eq_cpv = CPV.versioned(f"{astr}-1.1-r2")
        ge_cpv = CPV.versioned(f"{astr}-2")
        # <, =, >
        ops = (-1, 0, 1)

        for ops, ver in ((-1, "1.0"), (-1, "1.1"),
            (0, "1.1-r2"), (1, "1.1-r3"), (1, "1.2")):
            if not isinstance(ops, (list, tuple)):
                ops = (ops,)
            a = self.make_atom(astr, ops, ver)
            if -1 in ops:
                self.assertMatch(a, ge_cpv)
                self.assertMatch(a, eq_cpv)
                self.assertNotMatch(a, le_cpv)
            if 0 in ops:
                self.assertTrue(a.match(eq_cpv))
                if ops == (0,):
                    self.assertNotMatch(a, le_cpv)
                    self.assertNotMatch(a, ge_cpv)
            if 1 in ops:
                self.assertNotMatch(a, ge_cpv)
                self.assertMatch(a, eq_cpv)
                self.assertMatch(a, le_cpv)
Exemplo n.º 3
0
 def test_pkg_provided(self):
     self.assertEqual(self.klass(pjoin(self.dir, self.profile)).pkg_provided, ((), ()))
     self.parsing_checks("package.provided", "pkg_provided")
     self.write_file("package.provided", "-dev-util/diffball-1.0")
     self.assertEqual(
         self.klass(pjoin(self.dir, self.profile)).pkg_provided, ((CPV.versioned("dev-util/diffball-1.0"),), ())
     )
     self.write_file("package.provided", "dev-util/diffball-1.0")
     self.assertEqual(
         self.klass(pjoin(self.dir, self.profile)).pkg_provided, ((), (CPV.versioned("dev-util/diffball-1.0"),))
     )
Exemplo n.º 4
0
 def test_norev(self):
     astr = "app-arch/tarsync"
     a = self.kls(f"~{astr}-1")
     self.assertMatch(a, CPV.versioned(f"{astr}-1"))
     self.assertMatch(a, CPV.versioned(f"{astr}-1-r1"))
     self.assertMatch(a, CPV.versioned(f"{astr}-1-r0"))
     self.assertNotMatch(a, CPV.versioned(f"{astr}-2"))
     self.assertRaises(errors.MalformedAtom, self.kls, "~{astr}-r1")
     self.assertRaises(errors.MalformedAtom, self.kls, "~{astr}-r2")
     # special case- yes -r0 effectively is None, but -r shouldn't be used
     # with ~
     self.assertRaises(errors.MalformedAtom, self.kls, "~{astr}-r0")
Exemplo n.º 5
0
 def test_norev(self):
     astr = "app-arch/tarsync"
     a = self.kls("~%s-1" % astr)
     self.assertMatch(a, CPV.versioned("%s-1" % astr))
     self.assertMatch(a, CPV.versioned("%s-1-r1" % astr))
     self.assertMatch(a, CPV.versioned("%s-1-r0" % astr))
     self.assertNotMatch(a, CPV.versioned("%s-2" % astr))
     self.assertRaises(errors.MalformedAtom, self.kls, "~%s-r1" % astr)
     self.assertRaises(errors.MalformedAtom, self.kls, "~%s-r2" % astr)
     # special case- yes -r0 effectively is None, but -r shouldn't be used
     # with ~
     self.assertRaises(errors.MalformedAtom, self.kls, "~%s-r0" % astr)
Exemplo n.º 6
0
 def test_norev(self):
     astr = "app-arch/tarsync"
     a = self.kls("~%s-1" % astr)
     self.assertTrue(a.match(CPV.versioned("%s-1" % astr)))
     self.assertTrue(a.match(CPV.versioned("%s-1-r1" % astr)))
     self.assertTrue(a.match(CPV.versioned("%s-1-r0" % astr)))
     self.assertFalse(a.match(CPV.versioned("%s-2" % astr)))
     self.assertRaises(errors.MalformedAtom, self.kls, "~%s-r1" % astr)
     self.assertRaises(errors.MalformedAtom, self.kls, "~%s-r2" % astr)
     # special case- yes -r0 effectively is None, but -r shouldn't be used
     # with ~
     self.assertRaises(errors.MalformedAtom, self.kls, "~%s-r0" % astr)
Exemplo n.º 7
0
 def test_nonversioned(self):
     a = self.kls("kde-base/kde")
     self.assertMatch(a, CPV.unversioned("kde-base/kde"))
     self.assertNotMatch(a, CPV.unversioned("kde-base/kde2"))
     self.assertMatch(a, CPV.versioned("kde-base/kde-3"))
Exemplo n.º 8
0
 def test_nonversioned(self):
     a = self.kls("kde-base/kde")
     self.assertMatch(a, CPV.unversioned("kde-base/kde"))
     self.assertNotMatch(a, CPV.unversioned("kde-base/kde2"))
     self.assertMatch(a, CPV.versioned("kde-base/kde-3"))
Exemplo n.º 9
0
 def test_nonversioned(self):
     a = self.kls("kde-base/kde")
     self.assertTrue(a.match(CPV.unversioned("kde-base/kde")))
     self.assertFalse(a.match(CPV.unversioned("kde-base/kde2")))
     self.assertTrue(a.match(CPV.versioned("kde-base/kde-3")))