diff --git a/pungi/phases/ostree_installer.py b/pungi/phases/ostree_installer.py index 12f62b25..587ff2c5 100644 --- a/pungi/phases/ostree_installer.py +++ b/pungi/phases/ostree_installer.py @@ -63,13 +63,20 @@ class OstreeInstallerThread(WorkerThread): self.logdir = compose.paths.log.topdir('%s/%s/ostree_installer-%s' % (arch, variant, self.num)) repo_baseurl = compose.paths.work.arch_repo('$basearch', create_dir=False) - comps_baseurl = compose.paths.work.comps_repo('$basearch', variant=variant, create_dir=False) repos = get_repo_urls(None, # compose==None. Special value says that method should ignore deprecated variant-type repo shortcuts.force_list(config['repo']) - + shortcuts.force_list(translate_path(compose, repo_baseurl)) - + shortcuts.force_list(translate_path(compose, comps_baseurl)), + + shortcuts.force_list(translate_path(compose, repo_baseurl)), arch=arch, logger=self.pool) + if compose.has_comps: + repos.append( + translate_path( + compose, + compose.paths.work.comps_repo( + '$basearch', variant=variant, create_dir=False + ), + ) + ) repos = [url.replace('$arch', arch) for url in repos] output_dir = os.path.join(compose.paths.work.topdir(arch), variant.uid, 'ostree_installer') util.makedirs(os.path.dirname(output_dir)) diff --git a/tests/test_ostree_installer_phase.py b/tests/test_ostree_installer_phase.py index dc2b11c6..7569e348 100644 --- a/tests/test_ostree_installer_phase.py +++ b/tests/test_ostree_installer_phase.py @@ -326,6 +326,40 @@ class OstreeThreadTest(helpers.PungiTestCase): self.assertRunrootCall(koji, sources, cfg['release'], isfinal=True, extra=['--logfile=%s/%s/lorax.log' % (self.topdir, LOG_PATH)]) + @mock.patch('pungi.util.copy_all') + @mock.patch('productmd.images.Image') + @mock.patch('pungi.util.get_mtime') + @mock.patch('pungi.util.get_file_size') + @mock.patch('pungi.phases.ostree_installer.iso') + @mock.patch('os.link') + @mock.patch('pungi.wrappers.kojiwrapper.KojiWrapper') + def test_run_without_comps( + self, KojiWrapper, link, iso, get_file_size, get_mtime, ImageCls, copy_all + ): + self.compose.has_comps = False + pool = mock.Mock() + cfg = { + 'release': '20160321.n.0', + 'repo': [], + } + koji = KojiWrapper.return_value + koji.run_runroot_cmd.return_value = { + 'task_id': 1234, + 'retcode': 0, + 'output': 'Foo bar\n', + } + + t = ostree.OstreeInstallerThread(pool) + + t.process((self.compose, self.compose.variants['Everything'], 'x86_64', cfg), 1) + + sources = [ + 'http://example.com/work/$basearch/repo', + ] + + self.assertRunrootCall(koji, sources, cfg['release'], isfinal=True, + extra=['--logfile=%s/%s/lorax.log' % (self.topdir, LOG_PATH)]) + @mock.patch('pungi.util.copy_all') @mock.patch('productmd.images.Image') @mock.patch('pungi.util.get_mtime')