Beispiel #1
0
 def test_move_files(self, glob_mock, shutil_mock):
     glob_mock.iglob.return_value = ["d1/f1", "d1/f2"]
     files = utils.move_files("d1", "d2", "*.*")
     shutil_mock.move.assert_has_calls(
         [mock.call("d1/f1", "d2/f1"),
          mock.call("d1/f2", "d2/f2")],
         any_order=False)
     self.assertEqual(["d2/f1", "d2/f2"], files)
 def test_move_files(self, glob_mock, shutil_mock):
     glob_mock.iglob.return_value = ["d1/f1", "d1/f2"]
     files = utils.move_files("d1", "d2", "*.*")
     shutil_mock.move.assert_has_calls(
         [mock.call("d1/f1", "d2/f1"),
          mock.call("d1/f2", "d2/f2")],
         any_order=False
     )
     self.assertEqual(["d2/f1", "d2/f2"], files)
Beispiel #3
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)
Beispiel #4
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)