def test_mockbuild(self): """ Test the SRPMFile class """ self.init_test('test_misc', argv=['-n','python-test', '--cache', '--no-build']) srpm = SRPMFile(self.srpm_file) # install the srpm srpm.unpack() self.assertTrue(srpm._unpacked_src != None) src_dir = srpm._unpacked_src src_files = glob.glob(os.path.expanduser(src_dir) + '/*') src_files = [os.path.basename(f) for f in src_files] self.assertTrue('python-test-1.0.tar.gz' in src_files) self.log.info("Starting mock build (patience...)") Mock.build(srpm.filename) rpms = glob.glob(os.path.join(Mock.resultdir, 'python-test-1.0-1*noarch.rpm')) self.assertEqual(1, len(rpms))
def test_srpm_mockbuild(self): """ Test the SRPMFile class """ ReviewDirs.reset() ReviewDirs.workdir_setup('.', True) sys.argv = ['fedora-review','-b','817268', '-m', 'fedora-16-i386'] Settings.init(True) self.helpers._get_file(TEST_SRPM, os.path.abspath('.')) srpm = SRPMFile(self.srpm_file) # install the srpm srpm.unpack() self.assertTrue(hasattr(srpm, 'unpacked_src')) src_dir = srpm.unpacked_src src_files = glob.glob(os.path.expanduser(src_dir) + '/*') src_files = [os.path.basename(f) for f in src_files] self.assertTrue('python-test-1.0.tar.gz' in src_files) self.log.info("Starting mock build (patience...)") srpm.mockbuild() self.assertTrue(srpm.is_build) rpms = glob.glob(os.path.join(Mock.resultdir, 'python-test-1.0-1*noarch.rpm')) self.assertEqual(1, len(rpms)) os.chdir(self.startdir)
def test_srpm_file(self): """ Test the SRPMFile class """ srpm = SRPMFile(self.srpm_file) # install the srpm srpm.install() self.assertTrue(srpm.is_installed) src_files = glob.glob(os.path.expanduser('~/rpmbuild/SOURCES/*')) expected = os.path.expanduser('~/rpmbuild/SOURCES/python-test-1.0.tar.gz') self.assertTrue(expected in src_files) # Generate the config file for the current OS run release = self.helper._run_cmd('rpm --eval %{fedora}')[:-1] arch = self.helper._run_cmd('arch')[:-1] srpm.mock_config = 'fedora-%s-%s' % (release, arch) # Do the mock build srpm.build(silence=True) self.assertTrue(srpm.is_build) # Retrieve the list of files in the mock folder and below rpm_files = [] for root, dirs, files in os.walk(srpm.get_mock_dir()): rpm_files.extend(files) dist = self.helper._run_cmd('rpm --eval %dist')[:-1] expected = os.path.expanduser('python-test-1.0-1%(dist)s.noarch.rpm') % {'dist': dist} self.assertTrue(expected in rpm_files)
def test_srpm_mockbuild(self): """ Test the SRPMFile class """ ReviewDirs.reset() ReviewDirs.workdir_setup('.', True) sys.argv = ['fedora-review', '-b', '817268', '-m', 'fedora-16-i386'] Settings.init(True) self.helpers._get_file(TEST_SRPM, os.path.abspath('.')) srpm = SRPMFile(self.srpm_file) # install the srpm srpm.unpack() self.assertTrue(hasattr(srpm, 'unpacked_src')) src_dir = srpm.unpacked_src src_files = glob.glob(os.path.expanduser(src_dir) + '/*') src_files = [os.path.basename(f) for f in src_files] self.assertTrue('python-test-1.0.tar.gz' in src_files) self.log.info("Starting mock build (patience...)") srpm.mockbuild() self.assertTrue(srpm.is_build) rpms = glob.glob( os.path.join(Mock.resultdir, 'python-test-1.0-1*noarch.rpm')) self.assertEqual(1, len(rpms)) os.chdir(self.startdir)