예제 #1
0
 def test_builddependency2(self):
     """test BuildDependency (deb filename)"""
     fname = self.fixture_file('buildinfo_deb.xml')
     binfo = BuildInfo(xml_data=open(fname, 'r').read())
     self.assertEqual(binfo.get('binarytype'), 'deb')
     self.assertEqual(binfo.bdep[0].get('name'), 'bash')
     self.assertEqual(binfo.bdep[0].get('version'), '3.2')
     self.assertEqual(binfo.bdep[0].get('release'), '4')
     self.assertEqual(binfo.bdep[0].get('arch'), 'amd64')
     self.assertEqual(binfo.bdep[0].get('filename'), 'bash_3.2-4_amd64.deb')
     # test all arch
     self.assertEqual(binfo.bdep[2].get('name'), 'autoconf')
     self.assertEqual(binfo.bdep[2].get('version'), '2.61')
     self.assertEqual(binfo.bdep[2].get('release'), '8')
     self.assertEqual(binfo.bdep[2].get('arch'), 'all')
     self.assertEqual(binfo.bdep[2].get('filename'),
                      'autoconf_2.61-8_all.deb')
     # test without release
     self.assertEqual(binfo.bdep[3].get('name'), 'debhelper')
     self.assertEqual(binfo.bdep[3].get('version'), '7.0.15')
     self.assertIsNone(binfo.bdep[3].get('release'))
     self.assertEqual(binfo.bdep[3].get('arch'), 'all')
     self.assertEqual(binfo.bdep[3].get('filename'),
                      'debhelper_7.0.15_all.deb')
     # raise ValueError if debfilename is invoked
     self.assertRaises(ValueError, binfo.bdep[0].rpmfilename)
예제 #2
0
 def test_builddependency2(self):
     """test BuildDependency (deb filename)"""
     fname = self.fixture_file('buildinfo_deb.xml')
     binfo = BuildInfo(xml_data=open(fname, 'r').read())
     self.assertEqual(binfo.get('binarytype'), 'deb')
     self.assertEqual(binfo.bdep[0].get('name'), 'bash')
     self.assertEqual(binfo.bdep[0].get('version'), '3.2')
     self.assertEqual(binfo.bdep[0].get('release'), '4')
     self.assertEqual(binfo.bdep[0].get('arch'), 'amd64')
     self.assertEqual(binfo.bdep[0].get('filename'),
                      'bash_3.2-4_amd64.deb')
     # test all arch
     self.assertEqual(binfo.bdep[2].get('name'), 'autoconf')
     self.assertEqual(binfo.bdep[2].get('version'), '2.61')
     self.assertEqual(binfo.bdep[2].get('release'), '8')
     self.assertEqual(binfo.bdep[2].get('arch'), 'all')
     self.assertEqual(binfo.bdep[2].get('filename'),
                      'autoconf_2.61-8_all.deb')
     # test without release
     self.assertEqual(binfo.bdep[3].get('name'), 'debhelper')
     self.assertEqual(binfo.bdep[3].get('version'), '7.0.15')
     self.assertIsNone(binfo.bdep[3].get('release'))
     self.assertEqual(binfo.bdep[3].get('arch'), 'all')
     self.assertEqual(binfo.bdep[3].get('filename'),
                      'debhelper_7.0.15_all.deb')
     # raise ValueError if debfilename is invoked
     self.assertRaises(ValueError, binfo.bdep[0].rpmfilename)
예제 #3
0
 def test_builddependency1(self):
     """teste BuildDependency (rpm filename)"""
     fname = self.fixture_file('buildinfo2.xml')
     binfo = BuildInfo(xml_data=open(fname, 'r').read())
     self.assertEqual(binfo.get('binarytype'), 'rpm')
     self.assertEqual(binfo.bdep[0].get('name'), 'aaa_base')
     self.assertEqual(binfo.bdep[0].get('version'), '12.2')
     self.assertEqual(binfo.bdep[0].get('release'), '7.1')
     self.assertEqual(binfo.bdep[0].get('arch'), 'x86_64')
     self.assertEqual(binfo.bdep[0].get('filename'),
                      'aaa_base-12.2-7.1.x86_64.rpm')
     self.assertEqual(binfo.bdep[7].get('name'), 'installation-images')
     self.assertEqual(binfo.bdep[7].get('version'), '13.49')
     self.assertEqual(binfo.bdep[7].get('release'), '3.6')
     self.assertEqual(binfo.bdep[7].get('arch'), 'src')
     self.assertEqual(binfo.bdep[7].get('binary'),
                      'installation-images-13.49-3.6.src.rpm')
     # binary element is present (in this case filename is not constructed
     # and the binary value is returned)
     self.assertEqual(binfo.bdep[7].get('filename'),
                      'installation-images-13.49-3.6.src.rpm')
     # test noarch
     self.assertEqual(binfo.bdep[11].get('name'), 'def')
     self.assertEqual(binfo.bdep[11].get('version'), '1.9')
     self.assertEqual(binfo.bdep[11].get('release'), '0')
     self.assertEqual(binfo.bdep[11].get('arch'), 'noarch')
     self.assertEqual(binfo.bdep[11].get('filename'),
                      'def-1.9-0.noarch.rpm')
     # raise ValueError if debfilename is invoked
     self.assertRaises(ValueError, binfo.bdep[0].debfilename)
예제 #4
0
 def test_builddependency1(self):
     """teste BuildDependency (rpm filename)"""
     fname = self.fixture_file('buildinfo2.xml')
     binfo = BuildInfo(xml_data=open(fname, 'r').read())
     self.assertEqual(binfo.get('binarytype'), 'rpm')
     self.assertEqual(binfo.bdep[0].get('name'), 'aaa_base')
     self.assertEqual(binfo.bdep[0].get('version'), '12.2')
     self.assertEqual(binfo.bdep[0].get('release'), '7.1')
     self.assertEqual(binfo.bdep[0].get('arch'), 'x86_64')
     self.assertEqual(binfo.bdep[0].get('filename'),
                      'aaa_base-12.2-7.1.x86_64.rpm')
     self.assertEqual(binfo.bdep[7].get('name'), 'installation-images')
     self.assertEqual(binfo.bdep[7].get('version'), '13.49')
     self.assertEqual(binfo.bdep[7].get('release'), '3.6')
     self.assertEqual(binfo.bdep[7].get('arch'), 'src')
     self.assertEqual(binfo.bdep[7].get('binary'),
                      'installation-images-13.49-3.6.src.rpm')
     # binary element is present (in this case filename is not constructed
     # and the binary value is returned)
     self.assertEqual(binfo.bdep[7].get('filename'),
                      'installation-images-13.49-3.6.src.rpm')
     # test noarch
     self.assertEqual(binfo.bdep[11].get('name'), 'def')
     self.assertEqual(binfo.bdep[11].get('version'), '1.9')
     self.assertEqual(binfo.bdep[11].get('release'), '0')
     self.assertEqual(binfo.bdep[11].get('arch'), 'noarch')
     self.assertEqual(binfo.bdep[11].get('filename'),
                      'def-1.9-0.noarch.rpm')
     # raise ValueError if debfilename is invoked
     self.assertRaises(ValueError, binfo.bdep[0].debfilename)
예제 #5
0
 def test_buildinfo1(self):
     """test BuildInfo (simple get)"""
     binfo = BuildInfo('project', 'package', 'openSUSE_Factory', 'x86_64')
     self.assertEqual(binfo.get('project'), 'project')
     self.assertEqual(binfo.get('package'), 'package')
     self.assertEqual(binfo.get('repository'), 'openSUSE_Factory')
     self.assertEqual(binfo.arch, 'x86_64')
     self.assertEqual(binfo.file, 'package.spec')
     # in this case we can calculate it from binfo.file
     self.assertEqual(binfo.get('binarytype'), 'rpm')
     self.assertEqual(len(binfo.bdep[:]), 4)
     # test preinstall
     preinstall = list(binfo.preinstall())
     self.assertEqual(len(preinstall), 2)
     self.assertEqual(preinstall[0].get('name'), 'aaa_base')
     self.assertEqual(preinstall[0].get('version'), '12.2')
     self.assertEqual(preinstall[0].get('release'), '7.1')
     self.assertEqual(preinstall[0].get('arch'), 'x86_64')
     self.assertEqual(preinstall[0].get('project'), 'openSUSE:Factory')
     self.assertEqual(preinstall[0].get('repository'), 'snapshot')
     # second preinstall package
     self.assertEqual(preinstall[1].get('name'), 'attr')
     self.assertEqual(preinstall[1].get('version'), '2.4.46')
     self.assertEqual(preinstall[1].get('release'), '10.2')
     self.assertEqual(preinstall[1].get('arch'), 'x86_64')
     self.assertEqual(preinstall[1].get('project'), 'openSUSE:Factory')
     self.assertEqual(preinstall[1].get('repository'), 'snapshot')
     # test third bdep
     self.assertEqual(binfo.bdep[2].get('name'), 'python-devel')
     self.assertEqual(binfo.bdep[2].get('version'), '2.7.3')
     self.assertEqual(binfo.bdep[2].get('release'), '4.8')
     self.assertEqual(binfo.bdep[2].get('arch'), 'x86_64')
     self.assertEqual(binfo.bdep[2].get('project'), 'openSUSE:Factory')
     self.assertEqual(binfo.bdep[2].get('repository'), 'snapshot')
     # test 4th bdep
     self.assertEqual(binfo.bdep[3].get('name'), 'perl')
     self.assertEqual(binfo.bdep[3].get('version'), '5.16.0')
     self.assertEqual(binfo.bdep[3].get('release'), '4.8')
     self.assertEqual(binfo.bdep[3].get('arch'), 'x86_64')
     self.assertEqual(binfo.bdep[3].get('project'), 'openSUSE:Factory')
     self.assertEqual(binfo.bdep[3].get('repository'), 'snapshot')
     # test path elements
     self.assertEqual(binfo.path[0].get('project'), 'openSUSE:Tools')
     self.assertEqual(binfo.path[0].get('repository'), 'openSUSE_Factory')
     self.assertEqual(binfo.path[1].get('project'), 'openSUSE:Factory')
     self.assertEqual(binfo.path[1].get('repository'), 'snapshot')
예제 #6
0
 def test_buildinfo1(self):
     """test BuildInfo (simple get)"""
     binfo = BuildInfo('project', 'package', 'openSUSE_Factory', 'x86_64')
     self.assertEqual(binfo.get('project'), 'project')
     self.assertEqual(binfo.get('package'), 'package')
     self.assertEqual(binfo.get('repository'), 'openSUSE_Factory')
     self.assertEqual(binfo.arch, 'x86_64')
     self.assertEqual(binfo.file, 'package.spec')
     # in this case we can calculate it from binfo.file
     self.assertEqual(binfo.get('binarytype'), 'rpm')
     self.assertEqual(len(binfo.bdep[:]), 4)
     # test preinstall
     preinstall = list(binfo.preinstall())
     self.assertEqual(len(preinstall), 2)
     self.assertEqual(preinstall[0].get('name'), 'aaa_base')
     self.assertEqual(preinstall[0].get('version'), '12.2')
     self.assertEqual(preinstall[0].get('release'), '7.1')
     self.assertEqual(preinstall[0].get('arch'), 'x86_64')
     self.assertEqual(preinstall[0].get('project'), 'openSUSE:Factory')
     self.assertEqual(preinstall[0].get('repository'), 'snapshot')
     # second preinstall package
     self.assertEqual(preinstall[1].get('name'), 'attr')
     self.assertEqual(preinstall[1].get('version'), '2.4.46')
     self.assertEqual(preinstall[1].get('release'), '10.2')
     self.assertEqual(preinstall[1].get('arch'), 'x86_64')
     self.assertEqual(preinstall[1].get('project'), 'openSUSE:Factory')
     self.assertEqual(preinstall[1].get('repository'), 'snapshot')
     # test third bdep
     self.assertEqual(binfo.bdep[2].get('name'), 'python-devel')
     self.assertEqual(binfo.bdep[2].get('version'), '2.7.3')
     self.assertEqual(binfo.bdep[2].get('release'), '4.8')
     self.assertEqual(binfo.bdep[2].get('arch'), 'x86_64')
     self.assertEqual(binfo.bdep[2].get('project'), 'openSUSE:Factory')
     self.assertEqual(binfo.bdep[2].get('repository'), 'snapshot')
     # test 4th bdep
     self.assertEqual(binfo.bdep[3].get('name'), 'perl')
     self.assertEqual(binfo.bdep[3].get('version'), '5.16.0')
     self.assertEqual(binfo.bdep[3].get('release'), '4.8')
     self.assertEqual(binfo.bdep[3].get('arch'), 'x86_64')
     self.assertEqual(binfo.bdep[3].get('project'), 'openSUSE:Factory')
     self.assertEqual(binfo.bdep[3].get('repository'), 'snapshot')
     # test path elements
     self.assertEqual(binfo.path[0].get('project'), 'openSUSE:Tools')
     self.assertEqual(binfo.path[0].get('repository'), 'openSUSE_Factory')
     self.assertEqual(binfo.path[1].get('project'), 'openSUSE:Factory')
     self.assertEqual(binfo.path[1].get('repository'), 'snapshot')
예제 #7
0
 def test_buildinfo8(self):
     """test BuildInfo (from xml data - no binarytype specified)"""
     fname = self.fixture_file('buildinfo_uploaded_descr.xml')
     # cannot calculate binarytype from buildinfo
     self.assertRaises(ValueError, BuildInfo,
                       xml_data=open(fname, 'r').read())
     # the stored xml contains the binarytype attribute
     fname = self.fixture_file('buildinfo_uploaded_descr_stored.xml')
     binfo = BuildInfo(xml_data=open(fname, 'r').read())
     self.assertEqual(binfo.get('binarytype'), 'rpm')
예제 #8
0
 def test_buildinfo8(self):
     """test BuildInfo (from xml data - no binarytype specified)"""
     fname = self.fixture_file('buildinfo_uploaded_descr.xml')
     # cannot calculate binarytype from buildinfo
     self.assertRaises(ValueError,
                       BuildInfo,
                       xml_data=open(fname, 'r').read())
     # the stored xml contains the binarytype attribute
     fname = self.fixture_file('buildinfo_uploaded_descr_stored.xml')
     binfo = BuildInfo(xml_data=open(fname, 'r').read())
     self.assertEqual(binfo.get('binarytype'), 'rpm')
예제 #9
0
 def test_buildinfo3(self):
     """test BuildInfo (specify binarytype)"""
     fname = self.fixture_file('test.spec')
     # if no package is specified _repository is used
     binfo = BuildInfo('foo', repository='openSUSE_Factory', arch='x86_64',
                       binarytype='rpm', data=open(fname, 'r').read())
     self.assertEqual(binfo.get('binarytype'), 'rpm')
     self.assertEqual(binfo.bdep[0].get('name'), 'aaa_base')
     self.assertEqual(len(list(binfo.preinstall())), 1)
     self.assertEqual(len(list(binfo.noinstall())), 0)
     self.assertEqual(len(list(binfo.cbpreinstall())), 0)
     self.assertEqual(len(list(binfo.cbinstall())), 0)
     self.assertEqual(len(list(binfo.vminstall())), 0)
     self.assertEqual(len(list(binfo.runscripts())), 1)
예제 #10
0
 def test_buildinfo3(self):
     """test BuildInfo (specify binarytype)"""
     fname = self.fixture_file('test.spec')
     # if no package is specified _repository is used
     binfo = BuildInfo('foo',
                       repository='openSUSE_Factory',
                       arch='x86_64',
                       binarytype='rpm',
                       data=open(fname, 'r').read())
     self.assertEqual(binfo.get('binarytype'), 'rpm')
     self.assertEqual(binfo.bdep[0].get('name'), 'aaa_base')
     self.assertEqual(len(list(binfo.preinstall())), 1)
     self.assertEqual(len(list(binfo.noinstall())), 0)
     self.assertEqual(len(list(binfo.cbpreinstall())), 0)
     self.assertEqual(len(list(binfo.cbinstall())), 0)
     self.assertEqual(len(list(binfo.vminstall())), 0)
     self.assertEqual(len(list(binfo.runscripts())), 1)
예제 #11
0
 def test_buildinfo9(self):
     """test BuildInfo (deb binarytype)"""
     binfo = BuildInfo('openSUSE:Tools', 'osc', 'Debian_5.0', 'x86_64')
     self.assertEqual(binfo.file, 'osc.dsc')
     self.assertEqual(binfo.get('binarytype'), 'deb')
예제 #12
0
 def test_buildinfo7(self):
     """test BuildInfo (from xml data - specify binarytype)"""
     fname = self.fixture_file('buildinfo_uploaded_descr.xml')
     binfo = BuildInfo(xml_data=open(fname, 'r').read(), binarytype='rpm')
     self.assertEqual(binfo.get('binarytype'), 'rpm')
     self.assertEqual(binfo.path[1].get('project'), 'openSUSE:Factory')
예제 #13
0
 def test_buildinfo6(self):
     """test BuildInfo (from xml data)"""
     fname = self.fixture_file('buildinfo2.xml')
     binfo = BuildInfo(xml_data=open(fname, 'r').read())
     self.assertEqual(binfo.get('binarytype'), 'rpm')
     self.assertEqual(binfo.bdep[1].get('name'), 'attr')
예제 #14
0
 def test_buildinfo9(self):
     """test BuildInfo (deb binarytype)"""
     binfo = BuildInfo('openSUSE:Tools', 'osc', 'Debian_5.0', 'x86_64')
     self.assertEqual(binfo.file, 'osc.dsc')
     self.assertEqual(binfo.get('binarytype'), 'deb')
예제 #15
0
 def test_buildinfo7(self):
     """test BuildInfo (from xml data - specify binarytype)"""
     fname = self.fixture_file('buildinfo_uploaded_descr.xml')
     binfo = BuildInfo(xml_data=open(fname, 'r').read(), binarytype='rpm')
     self.assertEqual(binfo.get('binarytype'), 'rpm')
     self.assertEqual(binfo.path[1].get('project'), 'openSUSE:Factory')
예제 #16
0
 def test_buildinfo6(self):
     """test BuildInfo (from xml data)"""
     fname = self.fixture_file('buildinfo2.xml')
     binfo = BuildInfo(xml_data=open(fname, 'r').read())
     self.assertEqual(binfo.get('binarytype'), 'rpm')
     self.assertEqual(binfo.bdep[1].get('name'), 'attr')