예제 #1
0
 def descriptors(self):
     rows = self._db.select_namedtuples(
         '''select name, version, revision, epoch from packages order by name asc'''
     )
     result = package_descriptor_list()
     for row in rows:
         result.append(
             package_descriptor(
                 row.name,
                 build_version(row.version, row.revision, row.epoch)))
     return result
예제 #2
0
 def test_package_descriptor_water(self):
     tmp_tarball = fake_package_unit_test.create_one_package(self._WATER)
     p = package(tmp_tarball)
     self.assertEqual('water', p.package_descriptor.name)
     self.assertEqual(build_version('1.0.0', '0', 0),
                      p.package_descriptor.version)
     self.assertEqual([], p.package_descriptor.requirements)
     self.assertEqual({}, p.package_descriptor.properties)
     self.assertEqual([
         'bin/water_script.sh', 'docs/water_bar.txt', 'docs/water_foo.txt',
         'lib/pkgconfig/water.pc'
     ], p.files)
     self.assertEqual(['lib/pkgconfig/water.pc'], p.pkg_config_files)
     self.assertEqual('macos', p.system)
예제 #3
0
 def test_package_descriptor_with_requirements(self):
     tmp_tarball = fake_package_unit_test.create_one_package(self._ORANGE)
     p = package(tmp_tarball)
     self.assertEqual('orange', p.package_descriptor.name)
     self.assertEqual(build_version('6.5.4', '3', 0),
                      p.package_descriptor.version)
     self.assertEqual(
         requirement_list.parse('fruit >= 1.0.0-0 citrus >= 1.0.0-0'),
         p.package_descriptor.requirements)
     self.assertEqual({}, p.package_descriptor.properties)
     self.assertEqual([
         'bin/orange_script.sh', 'docs/orange_bar.txt',
         'docs/orange_foo.txt', 'lib/pkgconfig/orange.pc'
     ], p.files)
     self.assertEqual(['lib/pkgconfig/orange.pc'], p.pkg_config_files)
예제 #4
0
 def _load_row_to_package_descriptor(self, row):
     assert row
     return package_descriptor(
         row.name, build_version(row.version, row.revision, row.epoch),
         json.loads(row.properties),
         util.sql_decode_requirements(row.requirements))
예제 #5
0
 def build_version(self):
   return build_version(self.version, self.revision, self.epoch)
예제 #6
0
 def test___str__(self):
     self.assertEqual('1.2.3', str(build_version('1.2.3', 0, 0)))
     self.assertEqual('1.2.3-1', str(build_version('1.2.3', 1, 0)))
     self.assertEqual('1:1.2.3-1', str(build_version('1.2.3', 1, 1)))