ostree-installer: Remove usage of arch_repo
Pass all pkgset repos as input to the task. Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
parent
26ddd46acb
commit
2d0ffb56ca
@ -292,7 +292,7 @@ def run_compose(compose, create_latest_link=True, latest_link_status=None):
|
|||||||
gather_phase = pungi.phases.GatherPhase(compose, pkgset_phase)
|
gather_phase = pungi.phases.GatherPhase(compose, pkgset_phase)
|
||||||
extrafiles_phase = pungi.phases.ExtraFilesPhase(compose, pkgset_phase)
|
extrafiles_phase = pungi.phases.ExtraFilesPhase(compose, pkgset_phase)
|
||||||
createrepo_phase = pungi.phases.CreaterepoPhase(compose, pkgset_phase)
|
createrepo_phase = pungi.phases.CreaterepoPhase(compose, pkgset_phase)
|
||||||
ostree_installer_phase = pungi.phases.OstreeInstallerPhase(compose, buildinstall_phase)
|
ostree_installer_phase = pungi.phases.OstreeInstallerPhase(compose, buildinstall_phase, pkgset_phase)
|
||||||
ostree_phase = pungi.phases.OSTreePhase(compose, pkgset_phase)
|
ostree_phase = pungi.phases.OSTreePhase(compose, pkgset_phase)
|
||||||
productimg_phase = pungi.phases.ProductimgPhase(compose, pkgset_phase)
|
productimg_phase = pungi.phases.ProductimgPhase(compose, pkgset_phase)
|
||||||
createiso_phase = pungi.phases.CreateisoPhase(compose, buildinstall_phase)
|
createiso_phase = pungi.phases.CreateisoPhase(compose, buildinstall_phase)
|
||||||
|
@ -18,10 +18,11 @@ from ..runroot import Runroot
|
|||||||
class OstreeInstallerPhase(PhaseLoggerMixin, ConfigGuardedPhase):
|
class OstreeInstallerPhase(PhaseLoggerMixin, ConfigGuardedPhase):
|
||||||
name = 'ostree_installer'
|
name = 'ostree_installer'
|
||||||
|
|
||||||
def __init__(self, compose, buildinstall_phase):
|
def __init__(self, compose, buildinstall_phase, pkgset_phase=None):
|
||||||
super(OstreeInstallerPhase, self).__init__(compose)
|
super(OstreeInstallerPhase, self).__init__(compose)
|
||||||
self.pool = ThreadPool(logger=self.logger)
|
self.pool = ThreadPool(logger=self.logger)
|
||||||
self.bi = buildinstall_phase
|
self.bi = buildinstall_phase
|
||||||
|
self.pkgset_phase = pkgset_phase
|
||||||
|
|
||||||
def validate(self):
|
def validate(self):
|
||||||
errors = []
|
errors = []
|
||||||
@ -39,17 +40,30 @@ class OstreeInstallerPhase(PhaseLoggerMixin, ConfigGuardedPhase):
|
|||||||
if errors:
|
if errors:
|
||||||
raise ValueError('\n'.join(errors))
|
raise ValueError('\n'.join(errors))
|
||||||
|
|
||||||
|
def get_repos(self):
|
||||||
|
return [
|
||||||
|
translate_path(
|
||||||
|
self.compose,
|
||||||
|
self.compose.paths.work.pkgset_repo(pkgset.name, "$basearch"),
|
||||||
|
)
|
||||||
|
for pkgset in self.pkgset_phase.package_sets
|
||||||
|
]
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
for variant in self.compose.get_variants():
|
for variant in self.compose.get_variants():
|
||||||
for arch in variant.arches:
|
for arch in variant.arches:
|
||||||
for conf in self.get_config_block(variant, arch):
|
for conf in self.get_config_block(variant, arch):
|
||||||
self.pool.add(OstreeInstallerThread(self.pool))
|
self.pool.add(OstreeInstallerThread(self.pool, self.get_repos()))
|
||||||
self.pool.queue_put((self.compose, variant, arch, conf))
|
self.pool.queue_put((self.compose, variant, arch, conf))
|
||||||
|
|
||||||
self.pool.start()
|
self.pool.start()
|
||||||
|
|
||||||
|
|
||||||
class OstreeInstallerThread(WorkerThread):
|
class OstreeInstallerThread(WorkerThread):
|
||||||
|
def __init__(self, pool, baseurls):
|
||||||
|
super(OstreeInstallerThread, self).__init__(pool)
|
||||||
|
self.baseurls = baseurls
|
||||||
|
|
||||||
def process(self, item, num):
|
def process(self, item, num):
|
||||||
compose, variant, arch, config = item
|
compose, variant, arch, config = item
|
||||||
self.num = num
|
self.num = num
|
||||||
@ -64,10 +78,9 @@ class OstreeInstallerThread(WorkerThread):
|
|||||||
self.pool.log_info('[BEGIN] %s' % msg)
|
self.pool.log_info('[BEGIN] %s' % msg)
|
||||||
self.logdir = compose.paths.log.topdir('%s/%s/ostree_installer-%s' % (arch, variant, self.num))
|
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)
|
|
||||||
repos = get_repo_urls(None, # compose==None. Special value says that method should ignore deprecated variant-type repo
|
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(config['repo'])
|
||||||
+ shortcuts.force_list(translate_path(compose, repo_baseurl)),
|
+ self.baseurls,
|
||||||
arch=arch,
|
arch=arch,
|
||||||
logger=self.pool)
|
logger=self.pool)
|
||||||
if compose.has_comps:
|
if compose.has_comps:
|
||||||
|
@ -30,14 +30,24 @@ class OstreeInstallerPhaseTest(helpers.PungiTestCase):
|
|||||||
('^Everything$', {'x86_64': cfg})
|
('^Everything$', {'x86_64': cfg})
|
||||||
],
|
],
|
||||||
'runroot': True,
|
'runroot': True,
|
||||||
|
"translate_paths": [(self.topdir + "/work", "http://example.com/work")],
|
||||||
})
|
})
|
||||||
|
|
||||||
pool = ThreadPool.return_value
|
pool = ThreadPool.return_value
|
||||||
|
|
||||||
phase = ostree.OstreeInstallerPhase(compose, mock.Mock())
|
phase = ostree.OstreeInstallerPhase(
|
||||||
|
compose, mock.Mock(), self._make_pkgset_phase(["p1", "p2"])
|
||||||
|
)
|
||||||
phase.run()
|
phase.run()
|
||||||
|
|
||||||
self.assertEqual(len(pool.add.call_args_list), 1)
|
self.assertEqual(len(pool.add.call_args_list), 1)
|
||||||
|
self.assertEqual(
|
||||||
|
pool.add.call_args_list[0][0][0].baseurls,
|
||||||
|
[
|
||||||
|
"http://example.com/work/$basearch/repo/p1",
|
||||||
|
"http://example.com/work/$basearch/repo/p2",
|
||||||
|
],
|
||||||
|
)
|
||||||
self.assertEqual(pool.queue_put.call_args_list,
|
self.assertEqual(pool.queue_put.call_args_list,
|
||||||
[mock.call((compose, compose.variants['Everything'], 'x86_64', cfg))])
|
[mock.call((compose, compose.variants['Everything'], 'x86_64', cfg))])
|
||||||
|
|
||||||
@ -197,12 +207,12 @@ class OstreeThreadTest(helpers.PungiTestCase):
|
|||||||
get_mtime.return_value = 13579
|
get_mtime.return_value = 13579
|
||||||
final_iso_path = self.topdir + '/compose/Everything/x86_64/iso/image-name'
|
final_iso_path = self.topdir + '/compose/Everything/x86_64/iso/image-name'
|
||||||
|
|
||||||
t = ostree.OstreeInstallerThread(pool)
|
t = ostree.OstreeInstallerThread(pool, ["http://example.com/repo/1"])
|
||||||
|
|
||||||
t.process((self.compose, self.compose.variants['Everything'], 'x86_64', cfg), 1)
|
t.process((self.compose, self.compose.variants['Everything'], 'x86_64', cfg), 1)
|
||||||
|
|
||||||
self.assertRunrootCall(koji,
|
self.assertRunrootCall(koji,
|
||||||
['http://example.com/work/$basearch/repo',
|
["http://example.com/repo/1",
|
||||||
'http://example.com/work/$basearch/comps_repo_Everything'],
|
'http://example.com/work/$basearch/comps_repo_Everything'],
|
||||||
cfg['release'],
|
cfg['release'],
|
||||||
extra=['--logfile=%s/%s/lorax.log' % (self.topdir, LOG_PATH)])
|
extra=['--logfile=%s/%s/lorax.log' % (self.topdir, LOG_PATH)])
|
||||||
@ -234,13 +244,13 @@ class OstreeThreadTest(helpers.PungiTestCase):
|
|||||||
get_mtime.return_value = 13579
|
get_mtime.return_value = 13579
|
||||||
final_iso_path = self.topdir + '/compose/Everything/x86_64/iso/image-name'
|
final_iso_path = self.topdir + '/compose/Everything/x86_64/iso/image-name'
|
||||||
|
|
||||||
t = ostree.OstreeInstallerThread(pool)
|
t = ostree.OstreeInstallerThread(pool, ["http://example.com/repo/1"])
|
||||||
|
|
||||||
t.process((self.compose, self.compose.variants['Everything'], 'x86_64', cfg), 1)
|
t.process((self.compose, self.compose.variants['Everything'], 'x86_64', cfg), 1)
|
||||||
|
|
||||||
self.assertRunrootCall(koji,
|
self.assertRunrootCall(koji,
|
||||||
('http://example.com/repo/x86_64/',
|
('http://example.com/repo/x86_64/',
|
||||||
'http://example.com/work/$basearch/repo',
|
"http://example.com/repo/1",
|
||||||
'http://example.com/work/$basearch/comps_repo_Everything'),
|
'http://example.com/work/$basearch/comps_repo_Everything'),
|
||||||
cfg['release'],
|
cfg['release'],
|
||||||
isfinal=True,
|
isfinal=True,
|
||||||
@ -274,14 +284,14 @@ class OstreeThreadTest(helpers.PungiTestCase):
|
|||||||
'output': 'Foo bar\n',
|
'output': 'Foo bar\n',
|
||||||
}
|
}
|
||||||
|
|
||||||
t = ostree.OstreeInstallerThread(pool)
|
t = ostree.OstreeInstallerThread(pool, ["http://example.com/repo/1"])
|
||||||
|
|
||||||
t.process((self.compose, self.compose.variants['Everything'], 'x86_64', cfg), 1)
|
t.process((self.compose, self.compose.variants['Everything'], 'x86_64', cfg), 1)
|
||||||
|
|
||||||
sources = [
|
sources = [
|
||||||
'https://example.com/extra-repo1.repo',
|
'https://example.com/extra-repo1.repo',
|
||||||
'https://example.com/extra-repo2.repo',
|
'https://example.com/extra-repo2.repo',
|
||||||
'http://example.com/work/$basearch/repo',
|
"http://example.com/repo/1",
|
||||||
'http://example.com/work/$basearch/comps_repo_Everything',
|
'http://example.com/work/$basearch/comps_repo_Everything',
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -314,14 +324,14 @@ class OstreeThreadTest(helpers.PungiTestCase):
|
|||||||
'output': 'Foo bar\n',
|
'output': 'Foo bar\n',
|
||||||
}
|
}
|
||||||
|
|
||||||
t = ostree.OstreeInstallerThread(pool)
|
t = ostree.OstreeInstallerThread(pool, ["http://example.com/repo/1"])
|
||||||
|
|
||||||
t.process((self.compose, self.compose.variants['Everything'], 'x86_64', cfg), 1)
|
t.process((self.compose, self.compose.variants['Everything'], 'x86_64', cfg), 1)
|
||||||
|
|
||||||
sources = [
|
sources = [
|
||||||
'https://example.com/extra-repo1.repo',
|
'https://example.com/extra-repo1.repo',
|
||||||
'https://example.com/extra-repo2.repo',
|
'https://example.com/extra-repo2.repo',
|
||||||
'http://example.com/work/$basearch/repo',
|
"http://example.com/repo/1",
|
||||||
'http://example.com/work/$basearch/comps_repo_Everything',
|
'http://example.com/work/$basearch/comps_repo_Everything',
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -351,13 +361,11 @@ class OstreeThreadTest(helpers.PungiTestCase):
|
|||||||
'output': 'Foo bar\n',
|
'output': 'Foo bar\n',
|
||||||
}
|
}
|
||||||
|
|
||||||
t = ostree.OstreeInstallerThread(pool)
|
t = ostree.OstreeInstallerThread(pool, ["http://example.com/repo/1"])
|
||||||
|
|
||||||
t.process((self.compose, self.compose.variants['Everything'], 'x86_64', cfg), 1)
|
t.process((self.compose, self.compose.variants['Everything'], 'x86_64', cfg), 1)
|
||||||
|
|
||||||
sources = [
|
sources = ["http://example.com/repo/1"]
|
||||||
'http://example.com/work/$basearch/repo',
|
|
||||||
]
|
|
||||||
|
|
||||||
self.assertRunrootCall(koji, sources, cfg['release'], isfinal=True,
|
self.assertRunrootCall(koji, sources, cfg['release'], isfinal=True,
|
||||||
extra=['--logfile=%s/%s/lorax.log' % (self.topdir, LOG_PATH)])
|
extra=['--logfile=%s/%s/lorax.log' % (self.topdir, LOG_PATH)])
|
||||||
@ -387,7 +395,7 @@ class OstreeThreadTest(helpers.PungiTestCase):
|
|||||||
get_file_size.return_value = 1024
|
get_file_size.return_value = 1024
|
||||||
get_mtime.return_value = 13579
|
get_mtime.return_value = 13579
|
||||||
|
|
||||||
t = ostree.OstreeInstallerThread(pool)
|
t = ostree.OstreeInstallerThread(pool, ["http://example.com/repo/1"])
|
||||||
|
|
||||||
with self.assertRaises(RuntimeError) as ctx:
|
with self.assertRaises(RuntimeError) as ctx:
|
||||||
t.process((self.compose, self.compose.variants['Everything'], 'x86_64', cfg), 1)
|
t.process((self.compose, self.compose.variants['Everything'], 'x86_64', cfg), 1)
|
||||||
@ -425,7 +433,7 @@ class OstreeThreadTest(helpers.PungiTestCase):
|
|||||||
final_iso_path = self.topdir + '/compose/Everything/x86_64/iso/image-name'
|
final_iso_path = self.topdir + '/compose/Everything/x86_64/iso/image-name'
|
||||||
templ_dir = self.topdir + '/work/x86_64/Everything/lorax_templates'
|
templ_dir = self.topdir + '/work/x86_64/Everything/lorax_templates'
|
||||||
|
|
||||||
t = ostree.OstreeInstallerThread(pool)
|
t = ostree.OstreeInstallerThread(pool, ["http://example.com/repo/1"])
|
||||||
|
|
||||||
t.process((self.compose, self.compose.variants['Everything'], 'x86_64', cfg), 1)
|
t.process((self.compose, self.compose.variants['Everything'], 'x86_64', cfg), 1)
|
||||||
|
|
||||||
@ -434,7 +442,7 @@ class OstreeThreadTest(helpers.PungiTestCase):
|
|||||||
'branch': 'f24', 'dir': '.'},
|
'branch': 'f24', 'dir': '.'},
|
||||||
templ_dir, logger=pool._logger)])
|
templ_dir, logger=pool._logger)])
|
||||||
self.assertRunrootCall(koji,
|
self.assertRunrootCall(koji,
|
||||||
['http://example.com/work/$basearch/repo',
|
["http://example.com/repo/1",
|
||||||
'http://example.com/work/$basearch/comps_repo_Everything'],
|
'http://example.com/work/$basearch/comps_repo_Everything'],
|
||||||
cfg['release'],
|
cfg['release'],
|
||||||
isfinal=True,
|
isfinal=True,
|
||||||
@ -482,13 +490,13 @@ class OstreeThreadTest(helpers.PungiTestCase):
|
|||||||
get_mtime.return_value = 13579
|
get_mtime.return_value = 13579
|
||||||
final_iso_path = self.topdir + '/compose/Everything/x86_64/iso/image-name'
|
final_iso_path = self.topdir + '/compose/Everything/x86_64/iso/image-name'
|
||||||
|
|
||||||
t = ostree.OstreeInstallerThread(pool)
|
t = ostree.OstreeInstallerThread(pool, ["http://example.com/repo/1"])
|
||||||
|
|
||||||
t.process((self.compose, self.compose.variants['Everything'], 'x86_64', cfg), 1)
|
t.process((self.compose, self.compose.variants['Everything'], 'x86_64', cfg), 1)
|
||||||
|
|
||||||
self.assertRunrootCall(
|
self.assertRunrootCall(
|
||||||
koji,
|
koji,
|
||||||
['http://example.com/work/$basearch/repo',
|
["http://example.com/repo/1",
|
||||||
'http://example.com/work/$basearch/comps_repo_Everything'],
|
'http://example.com/work/$basearch/comps_repo_Everything'],
|
||||||
'20151203.t.0',
|
'20151203.t.0',
|
||||||
isfinal=True,
|
isfinal=True,
|
||||||
@ -544,13 +552,13 @@ class OstreeThreadTest(helpers.PungiTestCase):
|
|||||||
get_mtime.return_value = 13579
|
get_mtime.return_value = 13579
|
||||||
final_iso_path = self.topdir + '/compose/Everything/x86_64/iso/image-name'
|
final_iso_path = self.topdir + '/compose/Everything/x86_64/iso/image-name'
|
||||||
|
|
||||||
t = ostree.OstreeInstallerThread(pool)
|
t = ostree.OstreeInstallerThread(pool, ["http://example.com/repo/1"])
|
||||||
|
|
||||||
t.process((self.compose, self.compose.variants['Everything'], 'x86_64', cfg), 1)
|
t.process((self.compose, self.compose.variants['Everything'], 'x86_64', cfg), 1)
|
||||||
|
|
||||||
self.assertRunrootCall(
|
self.assertRunrootCall(
|
||||||
koji,
|
koji,
|
||||||
['http://example.com/work/$basearch/repo',
|
["http://example.com/repo/1",
|
||||||
'http://example.com/work/$basearch/comps_repo_Everything'],
|
'http://example.com/work/$basearch/comps_repo_Everything'],
|
||||||
'20151203.t.0',
|
'20151203.t.0',
|
||||||
isfinal=True,
|
isfinal=True,
|
||||||
@ -587,7 +595,7 @@ class OstreeThreadTest(helpers.PungiTestCase):
|
|||||||
koji = KojiWrapper.return_value
|
koji = KojiWrapper.return_value
|
||||||
koji.run_runroot_cmd.side_effect = helpers.boom
|
koji.run_runroot_cmd.side_effect = helpers.boom
|
||||||
|
|
||||||
t = ostree.OstreeInstallerThread(pool)
|
t = ostree.OstreeInstallerThread(pool, ["http://example.com/repo/1"])
|
||||||
|
|
||||||
t.process((self.compose, self.compose.variants['Everything'], 'x86_64', cfg), 1)
|
t.process((self.compose, self.compose.variants['Everything'], 'x86_64', cfg), 1)
|
||||||
pool._logger.error.assert_has_calls([
|
pool._logger.error.assert_has_calls([
|
||||||
@ -617,7 +625,7 @@ class OstreeThreadTest(helpers.PungiTestCase):
|
|||||||
'retcode': 1,
|
'retcode': 1,
|
||||||
}
|
}
|
||||||
|
|
||||||
t = ostree.OstreeInstallerThread(pool)
|
t = ostree.OstreeInstallerThread(pool, ["http://example.com/repo/1"])
|
||||||
|
|
||||||
t.process((self.compose, self.compose.variants['Everything'], 'x86_64', cfg), 1)
|
t.process((self.compose, self.compose.variants['Everything'], 'x86_64', cfg), 1)
|
||||||
pool._logger.error.assert_has_calls([
|
pool._logger.error.assert_has_calls([
|
||||||
|
Loading…
Reference in New Issue
Block a user