Exemplo n.º 1
0
    def build_packages(self, data, cache, output_dir, consumer):
        src = cache[data['src']]
        spec = cache[data['rpm']['spec']]
        options = data['rpm'].get('options', {})

        with utils.create_tmp_dir() as tmpdir:
            self._buildsrpm(
                resultdir=tmpdir, spec=spec, sources=src, **options
            )
            srpms_dir = os.path.join(output_dir, 'SRPM')
            utils.ensure_dir_exist(srpms_dir)
            srpms = glob.iglob(os.path.join(srpms_dir, '*.src.rpm'))
            rpms_dir = os.path.join(output_dir, 'RPM')
            utils.ensure_dir_exist(rpms_dir)
            self._rebuild(srpms, resultdir=tmpdir, **options)

            # rebuild commands rebuilds source rpm too
            # notify only about last version
            for rpm in utils.move_files(tmpdir, srpms_dir, '*.src.rpm'):
                consumer(rpm)

            for rpm in utils.move_files(tmpdir, rpms_dir, '*.rpm'):
                consumer(rpm)
Exemplo n.º 2
0
    def build_packages(self, data, cache, output_dir, consumer):
        src = cache[data['src']]
        spec = cache[data['rpm']['spec']]
        options = data['rpm'].get('options', {})

        with utils.create_tmp_dir() as tmpdir:
            self._buildsrpm(resultdir=tmpdir,
                            spec=spec,
                            sources=src,
                            **options)
            srpms_dir = os.path.join(output_dir, 'SRPM')
            utils.ensure_dir_exist(srpms_dir)
            srpms = glob.iglob(os.path.join(srpms_dir, '*.src.rpm'))
            rpms_dir = os.path.join(output_dir, 'RPM')
            utils.ensure_dir_exist(rpms_dir)
            self._rebuild(srpms, resultdir=tmpdir, **options)

            # rebuild commands rebuilds source rpm too
            # notify only about last version
            for rpm in utils.move_files(tmpdir, srpms_dir, '*.src.rpm'):
                consumer(rpm)

            for rpm in utils.move_files(tmpdir, rpms_dir, '*.rpm'):
                consumer(rpm)
Exemplo n.º 3
0
    def test_create_tmp_dir(self, tempfile, shutil):
        with utils.create_tmp_dir() as tmpdir:
            self.assertIs(tempfile.mkdtemp.return_value, tmpdir)

        tempfile.mkdtemp.assert_called_once_with()
        shutil.rmtree.assert_called_once_with(tmpdir, ignore_errors=True)
Exemplo n.º 4
0
    def test_create_tmp_dir(self, tempfile, shutil):
        with utils.create_tmp_dir() as tmpdir:
            self.assertIs(tempfile.mkdtemp.return_value, tmpdir)

        tempfile.mkdtemp.assert_called_once_with()
        shutil.rmtree.assert_called_once_with(tmpdir, ignore_errors=True)