Esempio n. 1
0
 def test_version_glob(self):
     subj = hawkey.Subject("pilchard-1.*-1.x86_64")
     nevras = list(subj.nevra_possibilities_real(self.sack, allow_globs=True))
     self.assertEqual(
         [NEVRA(name='pilchard', epoch=None, version='1.*',
                       release='1', arch='x86_64'),
          NEVRA(name='pilchard', epoch=None, version='1.*',
                       release='1.x86_64', arch=None)],
         nevras)
Esempio n. 2
0
 def test_custom_list(self):
     subj = hawkey.Subject(INP_FOF)
     result = list(subj.get_nevra_possibilities(forms=[hawkey.FORM_NEVRA,
         hawkey.FORM_NEVR]))
     self.assertLength(result, 2)
     self.assertEqual(result[0], NEVRA(name='four-of-fish', epoch=8,
                                              version='3.6.9',
                                              release='11.fc100',
                                              arch='x86_64'))
     self.assertEqual(result[1], NEVRA(name='four-of-fish', epoch=8, version='3.6.9',
                           release='11.fc100.x86_64', arch=None))
Esempio n. 3
0
    def test_nevra(self):
        subj = hawkey.Subject("pilchard-1.2.4-1.x86_64")
        nevra_possibilities = subj.nevra_possibilities_real(self.sack)
        nevra = next(nevra_possibilities)

        self.assertEqual(nevra, NEVRA(name='pilchard', epoch=None,
                                             version='1.2.4', release='1',
                                             arch='x86_64'))
        nevra = next(nevra_possibilities)
        self.assertEqual(nevra, NEVRA(name='pilchard', epoch=None,
                                             version='1.2.4', release='1.x86_64',
                                             arch=None))
        self.assertRaises(StopIteration, next, nevra_possibilities)
Esempio n. 4
0
 def test_na(self):
     subj = hawkey.Subject(INP_FOF_NA)
     nevra_possibilities = list(subj.get_nevra_possibilities(forms=hawkey.FORM_NA))
     self.assertLength(nevra_possibilities, 1)
     self.assertEqual(nevra_possibilities[0],
                      NEVRA(name='four-of-fish-3.6.9', epoch=None,
                                   version=None, release=None, arch='i686'))
Esempio n. 5
0
 def test_two_dashes(self):
     """ Even two dashes can happen, make sure they can still form a name. """
     subj = hawkey.Subject("penny-lib-devel")
     nevra = next(subj.nevra_possibilities_real(self.sack))
     self.assertEqual(nevra, NEVRA(name='penny-lib-devel', epoch=None,
                                          version=None, release=None,
                                          arch=None))
Esempio n. 6
0
    def test_dash_version(self):
        subj = hawkey.Subject("penny-lib-4")

        nevra = next(subj.nevra_possibilities_real(self.sack))
        self.assertEqual(nevra, NEVRA(name="penny-lib", epoch=None,
                                             version='4', release=None,
                                             arch=None))
Esempio n. 7
0
    def test_combined(self):
        """ Test we get all the possible NEVRA parses. """
        subj = hawkey.Subject(INP_FOF)
        nevras = subj.get_nevra_possibilities()
        # the epoch in INP_FOF nicely limits the nevra_possibilities:
        self.assertEqual(next(nevras), NEVRA(name='four-of-fish', epoch=8,
                                                     version='3.6.9',
                                                     release='11.fc100',
                                                     arch='x86_64'))
        self.assertEqual(next(nevras), NEVRA(name='four-of-fish', epoch=8,
                                                     version='3.6.9',
                                                     release='11.fc100.x86_64',
                                                     arch=None))
        self.assertRaises(StopIteration, next, nevras)

        subj = hawkey.Subject(INP_FOF_NOEPOCH)
        nevras = subj.get_nevra_possibilities()
        self.assertEqual(next(nevras), NEVRA(name='four-of-fish',
                                                     epoch=None, version='3.6.9',
                                                     release='11.fc100',
                                                     arch='x86_64'))
        self.assertEqual(next(nevras), NEVRA(name='four-of-fish-3.6.9-11.fc100', epoch=None,
                                             version=None, release=None, arch='x86_64'))
        self.assertEqual(next(nevras), NEVRA(name='four-of-fish-3.6.9-11.fc100.x86_64', epoch=None,
                                             version=None, release=None, arch=None))
        self.assertEqual(next(nevras), NEVRA(name='four-of-fish',
                                                     epoch=None, version='3.6.9',
                                                     release='11.fc100.x86_64',
                                                     arch=None))
        self.assertEqual(next(nevras), NEVRA(name='four-of-fish-3.6.9',
                                                     epoch=None,
                                                     version='11.fc100.x86_64',
                                                     release=None, arch=None))
        self.assertRaises(StopIteration, next, nevras)
Esempio n. 8
0
 def test_nevr(self):
     subj = hawkey.Subject(INP_FOF)
     expect = NEVRA(name='four-of-fish',
                    epoch=8,
                    version='3.6.9',
                    release='11.fc100.x86_64',
                    arch=None)
     self.assertEqual(
         subj.get_nevra_possibilities(forms=hawkey.FORM_NEVR)[0], expect)
Esempio n. 9
0
 def test_dash(self):
     """ Test that if a dash is present in otherwise simple subject, we take
         it as a name as the first guess.
     """
     subj = hawkey.Subject("penny-lib")
     nevra = next(subj.nevra_possibilities_real(self.sack))
     self.assertEqual(nevra, NEVRA(name='penny-lib', epoch=None,
                                          version=None, release=None,
                                          arch=None))
Esempio n. 10
0
 def test_nev(self):
     subj = hawkey.Subject(INP_FOF_NEV)
     nevra_possibilities = subj.get_nevra_possibilities(
         forms=hawkey.FORM_NEV)
     self.assertLength(nevra_possibilities, 1)
     self.assertEqual(
         nevra_possibilities[0],
         NEVRA(name='four-of-fish',
               epoch=8,
               version='3.6.9',
               release=None,
               arch=None))
Esempio n. 11
0
    def test_nevra(self):
        subj = hawkey.Subject(INP_FOF)
        result = subj.get_nevra_possibilities(forms=hawkey.FORM_NEVRA)
        self.assertLength(result, 1)
        self.assertEqual(
            result[0],
            NEVRA(name='four-of-fish',
                  epoch=8,
                  version='3.6.9',
                  release='11.fc100',
                  arch='x86_64'))

        subj = hawkey.Subject(INP_FOF_NOEPOCH)
        result = subj.get_nevra_possibilities(forms=hawkey.FORM_NEVRA)
        self.assertEqual(
            result[0],
            NEVRA(name='four-of-fish',
                  epoch=None,
                  version='3.6.9',
                  release='11.fc100',
                  arch='x86_64'))
Esempio n. 12
0
    def test_combined(self):
        """ Test we get all the possible NEVRA parses. """
        subj = hawkey.Subject(INP_FOF)
        # the epoch in INP_FOF nicely limits the nevra_possibilities:
        expect = (NEVRA(name='four-of-fish',
                        epoch=8,
                        version='3.6.9',
                        release='11.fc100',
                        arch='x86_64'),
                  NEVRA(name='four-of-fish',
                        epoch=8,
                        version='3.6.9',
                        release='11.fc100.x86_64',
                        arch=None))
        result = subj.get_nevra_possibilities()
        self.assertEqual(len(result), len(expect))
        for idx in range(0, len(expect)):
            self.assertEqual(expect[idx], result[idx])

        subj = hawkey.Subject(INP_FOF_NOEPOCH)
        expect = (NEVRA(name='four-of-fish',
                        epoch=None,
                        version='3.6.9',
                        release='11.fc100',
                        arch='x86_64'),
                  NEVRA(name='four-of-fish-3.6.9-11.fc100',
                        epoch=None,
                        version=None,
                        release=None,
                        arch='x86_64'),
                  NEVRA(name='four-of-fish-3.6.9-11.fc100.x86_64',
                        epoch=None,
                        version=None,
                        release=None,
                        arch=None),
                  NEVRA(name='four-of-fish',
                        epoch=None,
                        version='3.6.9',
                        release='11.fc100.x86_64',
                        arch=None),
                  NEVRA(name='four-of-fish-3.6.9',
                        epoch=None,
                        version='11.fc100.x86_64',
                        release=None,
                        arch=None))
        result = subj.get_nevra_possibilities()
        self.assertEqual(len(result), len(expect))
        for idx in range(0, len(expect)):
            self.assertEqual(expect[idx], result[idx])