2018-05-22 12:59:47 +00:00
|
|
|
From 376f52f1c18e5c8500fa8afd9c91ba9a6e4c4ae0 Mon Sep 17 00:00:00 2001
|
2018-04-11 07:25:28 +00:00
|
|
|
From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= <lsedlar@redhat.com>
|
|
|
|
Date: Wed, 11 Apr 2018 09:19:53 +0200
|
2018-05-30 13:05:52 +00:00
|
|
|
Subject: [PATCH 2/4] Revert "Other repo for OstreeInstaller"
|
2018-04-11 07:25:28 +00:00
|
|
|
|
|
|
|
This reverts commit 5c081cb545715c2a912ff50fa57554e89d905868.
|
|
|
|
---
|
|
|
|
pungi/checks.py | 3 ++-
|
2018-05-02 12:39:25 +00:00
|
|
|
pungi/phases/ostree_installer.py | 11 ++------
|
|
|
|
pungi/util.py | 21 +++++----------
|
|
|
|
tests/test_ostree_installer_phase.py | 50 +++++++++++++-----------------------
|
|
|
|
4 files changed, 28 insertions(+), 57 deletions(-)
|
2018-04-11 07:25:28 +00:00
|
|
|
|
|
|
|
diff --git a/pungi/checks.py b/pungi/checks.py
|
2018-05-22 12:59:47 +00:00
|
|
|
index 2ddd7164..03cab460 100644
|
2018-04-11 07:25:28 +00:00
|
|
|
--- a/pungi/checks.py
|
|
|
|
+++ b/pungi/checks.py
|
2018-05-22 12:59:47 +00:00
|
|
|
@@ -998,7 +998,7 @@ def make_schema():
|
2018-04-11 07:25:28 +00:00
|
|
|
"tag_ref": {"type": "boolean"},
|
|
|
|
"ostree_ref": {"type": "string"},
|
|
|
|
},
|
|
|
|
- "required": ["treefile", "config_url", "ostree_repo"],
|
|
|
|
+ "required": ["treefile", "config_url", "repo", "ostree_repo"],
|
|
|
|
"additionalProperties": False,
|
|
|
|
}),
|
|
|
|
]
|
2018-05-22 12:59:47 +00:00
|
|
|
@@ -1019,6 +1019,7 @@ def make_schema():
|
2018-04-11 07:25:28 +00:00
|
|
|
"template_repo": {"type": "string"},
|
|
|
|
"template_branch": {"type": "string"},
|
|
|
|
},
|
|
|
|
+ "required": ["repo"],
|
|
|
|
"additionalProperties": False,
|
|
|
|
}),
|
|
|
|
|
|
|
|
diff --git a/pungi/phases/ostree_installer.py b/pungi/phases/ostree_installer.py
|
2018-05-22 12:59:47 +00:00
|
|
|
index 2eac49f7..abcb1572 100644
|
2018-04-11 07:25:28 +00:00
|
|
|
--- a/pungi/phases/ostree_installer.py
|
|
|
|
+++ b/pungi/phases/ostree_installer.py
|
|
|
|
@@ -9,7 +9,7 @@ from kobo import shortcuts
|
|
|
|
|
|
|
|
from .base import ConfigGuardedPhase, PhaseLoggerMixin
|
|
|
|
from .. import util
|
|
|
|
-from ..util import get_volid, get_repo_urls, version_generator, translate_path
|
|
|
|
+from ..util import get_volid, get_repo_urls, version_generator
|
|
|
|
from ..wrappers import kojiwrapper, iso, lorax, scm
|
|
|
|
|
|
|
|
|
2018-05-22 12:59:47 +00:00
|
|
|
@@ -62,14 +62,7 @@ class OstreeInstallerThread(WorkerThread):
|
2018-04-11 07:25:28 +00:00
|
|
|
self.pool.log_info('[BEGIN] %s' % msg)
|
|
|
|
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)
|
2018-05-02 12:39:25 +00:00
|
|
|
- comps_baseurl = compose.paths.work.comps_repo('$basearch', variant=variant, create_dir=False)
|
2018-04-11 07:25:28 +00:00
|
|
|
- repos = get_repo_urls(None, # compose==None. Special value says that method should ignore deprecated variant-type repo
|
2018-05-02 12:39:25 +00:00
|
|
|
- shortcuts.force_list(config['repo'])
|
|
|
|
- + shortcuts.force_list(translate_path(compose, repo_baseurl))
|
|
|
|
- + shortcuts.force_list(translate_path(compose, comps_baseurl)),
|
2018-04-11 07:25:28 +00:00
|
|
|
- arch=arch,
|
|
|
|
- logger=self.pool)
|
|
|
|
+ repos = get_repo_urls(compose, shortcuts.force_list(config['repo']), arch=arch)
|
|
|
|
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/pungi/util.py b/pungi/util.py
|
2018-05-22 12:59:47 +00:00
|
|
|
index ea0f6e48..3150e26c 100644
|
2018-04-11 07:25:28 +00:00
|
|
|
--- a/pungi/util.py
|
|
|
|
+++ b/pungi/util.py
|
2018-05-22 12:59:47 +00:00
|
|
|
@@ -686,8 +686,6 @@ def get_repo_url(compose, repo, arch='$basearch'):
|
2018-04-11 07:25:28 +00:00
|
|
|
Convert repo to repo URL.
|
|
|
|
|
|
|
|
@param compose - required for access to variants
|
|
|
|
- special value compose==None determines that method is called during
|
|
|
|
- OSTreeInstaller phase where variant-type source repository is deprecated
|
|
|
|
@param repo - string or a dict which at least contains 'baseurl' key
|
|
|
|
@param arch - string to be used as arch in repo url
|
|
|
|
"""
|
2018-05-22 12:59:47 +00:00
|
|
|
@@ -698,17 +696,14 @@ def get_repo_url(compose, repo, arch='$basearch'):
|
2018-04-11 07:25:28 +00:00
|
|
|
raise RuntimeError('Baseurl is required in repo dict %s' % str(repo))
|
|
|
|
if '://' not in repo:
|
|
|
|
# this is a variant name
|
|
|
|
- if compose is not None:
|
|
|
|
- v = compose.all_variants.get(repo)
|
|
|
|
- if not v:
|
|
|
|
- raise RuntimeError('There is no variant %s to get repo from.' % repo)
|
|
|
|
- else:
|
|
|
|
- return None
|
|
|
|
+ v = compose.all_variants.get(repo)
|
|
|
|
+ if not v:
|
|
|
|
+ raise RuntimeError('There is no variant %s to get repo from.' % repo)
|
|
|
|
repo = translate_path(compose, compose.paths.compose.repository(arch, v, create_dir=False))
|
|
|
|
return repo
|
|
|
|
|
|
|
|
|
|
|
|
-def get_repo_urls(compose, repos, arch='$basearch', logger=None):
|
|
|
|
+def get_repo_urls(compose, repos, arch='$basearch'):
|
|
|
|
"""
|
|
|
|
Convert repos to a list of repo URLs.
|
|
|
|
|
2018-05-22 12:59:47 +00:00
|
|
|
@@ -719,11 +714,7 @@ def get_repo_urls(compose, repos, arch='$basearch', logger=None):
|
2018-04-11 07:25:28 +00:00
|
|
|
urls = []
|
|
|
|
for repo in repos:
|
|
|
|
repo = get_repo_url(compose, repo, arch=arch)
|
|
|
|
- if repo is None:
|
|
|
|
- if logger:
|
|
|
|
- logger.log_warning("Variant-type source repository is deprecated and will be ignored during 'OSTreeInstaller' phase: %s" % (repo))
|
|
|
|
- else:
|
|
|
|
- urls.append(repo)
|
|
|
|
+ urls.append(repo)
|
|
|
|
return urls
|
|
|
|
|
|
|
|
|
2018-05-22 12:59:47 +00:00
|
|
|
@@ -781,7 +772,7 @@ def get_repo_dicts(repos, logger=None):
|
2018-04-11 07:25:28 +00:00
|
|
|
repo_dict = get_repo_dict(repo)
|
|
|
|
if repo_dict == {}:
|
|
|
|
if logger:
|
|
|
|
- logger.log_warning("Variant-type source repository is deprecated and will be ignored during 'OSTree' phase: %s" % (repo))
|
|
|
|
+ logger.log_warning("Variant-type source repository is deprecated and will be ignored during 'ostree' phase: %s" % (repo))
|
|
|
|
else:
|
|
|
|
repo_dicts.append(repo_dict)
|
|
|
|
return repo_dicts
|
|
|
|
diff --git a/tests/test_ostree_installer_phase.py b/tests/test_ostree_installer_phase.py
|
2018-05-22 12:59:47 +00:00
|
|
|
index ee3294e5..f44ca4ef 100644
|
2018-04-11 07:25:28 +00:00
|
|
|
--- a/tests/test_ostree_installer_phase.py
|
|
|
|
+++ b/tests/test_ostree_installer_phase.py
|
|
|
|
@@ -14,7 +14,6 @@ sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
|
|
|
|
|
|
|
|
from tests import helpers
|
|
|
|
from pungi.phases import ostree_installer as ostree
|
|
|
|
-from six.moves import shlex_quote
|
|
|
|
|
|
|
|
|
|
|
|
LOG_PATH = 'logs/x86_64/Everything/ostree_installer-1'
|
2018-05-22 12:59:47 +00:00
|
|
|
@@ -96,9 +95,6 @@ class OstreeThreadTest(helpers.PungiTestCase):
|
2018-04-11 07:25:28 +00:00
|
|
|
'koji_profile': 'koji',
|
|
|
|
'runroot_tag': 'rrt',
|
|
|
|
'image_volid_formats': ['{release_short}-{variant}-{arch}'],
|
|
|
|
- 'translate_paths': [
|
|
|
|
- (self.topdir + '/work', 'http://example.com/work')
|
|
|
|
- ],
|
|
|
|
})
|
|
|
|
|
|
|
|
def assertImageAdded(self, compose, ImageCls, iso):
|
2018-05-22 12:59:47 +00:00
|
|
|
@@ -125,7 +121,7 @@ class OstreeThreadTest(helpers.PungiTestCase):
|
2018-04-11 07:25:28 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
for s in force_list(sources):
|
|
|
|
- lorax_cmd.append(shlex_quote('--source=%s' % s))
|
|
|
|
+ lorax_cmd.append('--source=%s' % s)
|
|
|
|
|
|
|
|
lorax_cmd.append('--variant=Everything')
|
|
|
|
lorax_cmd.append('--nomacboot')
|
2018-05-22 12:59:47 +00:00
|
|
|
@@ -179,7 +175,7 @@ class OstreeThreadTest(helpers.PungiTestCase):
|
2018-04-11 07:25:28 +00:00
|
|
|
self.compose.supported = False
|
|
|
|
pool = mock.Mock()
|
|
|
|
cfg = {
|
|
|
|
- 'repo': 'Everything', # this variant-type repo is deprecated, in result will be replaced with default repo
|
|
|
|
+ 'repo': 'Everything',
|
|
|
|
'release': '20160321.n.0',
|
|
|
|
}
|
|
|
|
koji = KojiWrapper.return_value
|
2018-05-22 12:59:47 +00:00
|
|
|
@@ -197,8 +193,7 @@ class OstreeThreadTest(helpers.PungiTestCase):
|
2018-04-11 07:25:28 +00:00
|
|
|
t.process((self.compose, self.compose.variants['Everything'], 'x86_64', cfg), 1)
|
|
|
|
|
|
|
|
self.assertRunrootCall(koji,
|
2018-05-02 12:39:25 +00:00
|
|
|
- ['http://example.com/work/$basearch/repo',
|
|
|
|
- 'http://example.com/work/$basearch/comps_repo_Everything'],
|
2018-04-11 07:25:28 +00:00
|
|
|
+ 'file://%s/compose/Everything/x86_64/os' % self.topdir,
|
|
|
|
cfg['release'],
|
|
|
|
extra=['--logfile=%s/%s/lorax.log' % (self.topdir, LOG_PATH)])
|
|
|
|
self.assertIsoLinked(link, get_file_size, get_mtime, final_iso_path)
|
2018-05-22 12:59:47 +00:00
|
|
|
@@ -233,12 +228,7 @@ class OstreeThreadTest(helpers.PungiTestCase):
|
2018-04-11 07:25:28 +00:00
|
|
|
|
|
|
|
t.process((self.compose, self.compose.variants['Everything'], 'x86_64', cfg), 1)
|
|
|
|
|
|
|
|
- self.assertRunrootCall(koji,
|
|
|
|
- ('http://example.com/repo/x86_64/',
|
2018-05-02 12:39:25 +00:00
|
|
|
- 'http://example.com/work/$basearch/repo',
|
|
|
|
- 'http://example.com/work/$basearch/comps_repo_Everything'),
|
2018-04-11 07:25:28 +00:00
|
|
|
- cfg['release'],
|
|
|
|
- isfinal=True,
|
|
|
|
+ self.assertRunrootCall(koji, 'http://example.com/repo/x86_64/', cfg['release'], isfinal=True,
|
|
|
|
extra=['--logfile=%s/%s/lorax.log' % (self.topdir, LOG_PATH)])
|
|
|
|
self.assertIsoLinked(link, get_file_size, get_mtime, final_iso_path)
|
|
|
|
self.assertImageAdded(self.compose, ImageCls, iso)
|
2018-05-22 12:59:47 +00:00
|
|
|
@@ -257,7 +247,7 @@ class OstreeThreadTest(helpers.PungiTestCase):
|
2018-04-11 07:25:28 +00:00
|
|
|
cfg = {
|
|
|
|
'release': '20160321.n.0',
|
|
|
|
'repo': [
|
|
|
|
- 'Everything', # this variant-type repo is deprecated, in result will be replaced with default repo
|
|
|
|
+ 'Everything',
|
|
|
|
'https://example.com/extra-repo1.repo',
|
|
|
|
'https://example.com/extra-repo2.repo',
|
|
|
|
],
|
2018-05-22 12:59:47 +00:00
|
|
|
@@ -274,10 +264,9 @@ class OstreeThreadTest(helpers.PungiTestCase):
|
2018-04-11 07:25:28 +00:00
|
|
|
t.process((self.compose, self.compose.variants['Everything'], 'x86_64', cfg), 1)
|
|
|
|
|
|
|
|
sources = [
|
|
|
|
+ 'file://%s/compose/Everything/x86_64/os' % self.topdir,
|
|
|
|
'https://example.com/extra-repo1.repo',
|
|
|
|
- 'https://example.com/extra-repo2.repo',
|
|
|
|
- 'http://example.com/work/$basearch/repo',
|
2018-05-02 12:39:25 +00:00
|
|
|
- 'http://example.com/work/$basearch/comps_repo_Everything',
|
2018-04-11 07:25:28 +00:00
|
|
|
+ 'https://example.com/extra-repo2.repo'
|
|
|
|
]
|
|
|
|
|
|
|
|
self.assertRunrootCall(koji, sources, cfg['release'], isfinal=True,
|
2018-05-22 12:59:47 +00:00
|
|
|
@@ -296,8 +285,8 @@ class OstreeThreadTest(helpers.PungiTestCase):
|
2018-04-11 07:25:28 +00:00
|
|
|
cfg = {
|
|
|
|
'release': '20160321.n.0',
|
|
|
|
'repo': [
|
|
|
|
- 'Everything', # this variant-type repo is deprecated, in result will be replaced with default repo
|
|
|
|
- 'Server', # this variant-type repo is deprecated, in result will be replaced with default repo
|
|
|
|
+ 'Everything',
|
|
|
|
+ 'Server',
|
|
|
|
'https://example.com/extra-repo1.repo',
|
|
|
|
'https://example.com/extra-repo2.repo',
|
|
|
|
],
|
2018-05-22 12:59:47 +00:00
|
|
|
@@ -314,10 +303,10 @@ class OstreeThreadTest(helpers.PungiTestCase):
|
2018-04-11 07:25:28 +00:00
|
|
|
t.process((self.compose, self.compose.variants['Everything'], 'x86_64', cfg), 1)
|
|
|
|
|
|
|
|
sources = [
|
|
|
|
+ 'file://%s/compose/Everything/x86_64/os' % self.topdir,
|
|
|
|
+ 'file://%s/compose/Server/x86_64/os' % self.topdir,
|
|
|
|
'https://example.com/extra-repo1.repo',
|
|
|
|
- 'https://example.com/extra-repo2.repo',
|
|
|
|
- 'http://example.com/work/$basearch/repo',
|
2018-05-02 12:39:25 +00:00
|
|
|
- 'http://example.com/work/$basearch/comps_repo_Everything',
|
2018-04-11 07:25:28 +00:00
|
|
|
+ 'https://example.com/extra-repo2.repo'
|
|
|
|
]
|
|
|
|
|
|
|
|
self.assertRunrootCall(koji, sources, cfg['release'], isfinal=True,
|
2018-05-22 12:59:47 +00:00
|
|
|
@@ -368,7 +357,7 @@ class OstreeThreadTest(helpers.PungiTestCase):
|
2018-04-11 07:25:28 +00:00
|
|
|
get_dir_from_scm):
|
|
|
|
pool = mock.Mock()
|
|
|
|
cfg = {
|
|
|
|
- 'repo': 'Everything', # this variant-type repo is deprecated, in result will be replaced with default repo
|
|
|
|
+ 'repo': 'Everything',
|
|
|
|
'release': '20160321.n.0',
|
|
|
|
'add_template': ['some_file.txt'],
|
|
|
|
'add_arch_template': ['other_file.txt'],
|
2018-05-22 12:59:47 +00:00
|
|
|
@@ -395,8 +384,7 @@ class OstreeThreadTest(helpers.PungiTestCase):
|
2018-04-11 07:25:28 +00:00
|
|
|
'branch': 'f24', 'dir': '.'},
|
|
|
|
templ_dir, logger=pool._logger)])
|
|
|
|
self.assertRunrootCall(koji,
|
2018-05-02 12:39:25 +00:00
|
|
|
- ['http://example.com/work/$basearch/repo',
|
|
|
|
- 'http://example.com/work/$basearch/comps_repo_Everything'],
|
2018-04-11 07:25:28 +00:00
|
|
|
+ 'file://%s/compose/Everything/x86_64/os' % self.topdir,
|
|
|
|
cfg['release'],
|
|
|
|
isfinal=True,
|
|
|
|
extra=['--add-template=%s/some_file.txt' % templ_dir,
|
2018-05-22 12:59:47 +00:00
|
|
|
@@ -417,7 +405,7 @@ class OstreeThreadTest(helpers.PungiTestCase):
|
|
|
|
get_file_size, get_mtime, ImageCls, copy_all):
|
2018-04-11 07:25:28 +00:00
|
|
|
pool = mock.Mock()
|
|
|
|
cfg = {
|
|
|
|
- 'repo': 'Everything', # this variant-type repo is deprecated, in result will be replaced with default repo
|
|
|
|
+ 'repo': 'Everything',
|
|
|
|
'release': '!RELEASE_FROM_LABEL_DATE_TYPE_RESPIN',
|
|
|
|
"installpkgs": ["fedora-productimg-atomic"],
|
|
|
|
"add_template": ["/spin-kickstarts/atomic-installer/lorax-configure-repo.tmpl"],
|
2018-05-22 12:59:47 +00:00
|
|
|
@@ -449,8 +437,7 @@ class OstreeThreadTest(helpers.PungiTestCase):
|
2018-04-11 07:25:28 +00:00
|
|
|
|
|
|
|
self.assertRunrootCall(
|
|
|
|
koji,
|
2018-05-02 12:39:25 +00:00
|
|
|
- ['http://example.com/work/$basearch/repo',
|
|
|
|
- 'http://example.com/work/$basearch/comps_repo_Everything'],
|
2018-04-11 07:25:28 +00:00
|
|
|
+ 'file://%s/compose/Everything/x86_64/os' % self.topdir,
|
|
|
|
'20151203.t.0',
|
|
|
|
isfinal=True,
|
|
|
|
extra=['--installpkgs=fedora-productimg-atomic',
|
2018-05-22 12:59:47 +00:00
|
|
|
@@ -479,7 +466,7 @@ class OstreeThreadTest(helpers.PungiTestCase):
|
|
|
|
get_file_size, get_mtime, ImageCls, copy_all):
|
2018-04-11 07:25:28 +00:00
|
|
|
pool = mock.Mock()
|
|
|
|
cfg = {
|
|
|
|
- 'repo': 'Everything', # this variant-type repo is deprecated, in result will be replaced with default repo
|
|
|
|
+ 'repo': 'Everything',
|
|
|
|
'release': None,
|
|
|
|
"installpkgs": ["fedora-productimg-atomic"],
|
|
|
|
"add_template": ["/spin-kickstarts/atomic-installer/lorax-configure-repo.tmpl"],
|
2018-05-22 12:59:47 +00:00
|
|
|
@@ -511,8 +498,7 @@ class OstreeThreadTest(helpers.PungiTestCase):
|
2018-04-11 07:25:28 +00:00
|
|
|
|
|
|
|
self.assertRunrootCall(
|
|
|
|
koji,
|
2018-05-02 12:39:25 +00:00
|
|
|
- ['http://example.com/work/$basearch/repo',
|
|
|
|
- 'http://example.com/work/$basearch/comps_repo_Everything'],
|
2018-04-11 07:25:28 +00:00
|
|
|
+ 'file://%s/compose/Everything/x86_64/os' % self.topdir,
|
|
|
|
'20151203.t.0',
|
|
|
|
isfinal=True,
|
|
|
|
extra=['--installpkgs=fedora-productimg-atomic',
|
|
|
|
--
|
2018-05-02 12:39:25 +00:00
|
|
|
2.14.3
|
2018-04-11 07:25:28 +00:00
|
|
|
|