add some more ostree fixes
- add a bandaid for ppc until we get a proper fix Signed-off-by: Dennis Gilmore <dennis@ausil.us>
This commit is contained in:
parent
8b2b243206
commit
32cfa08727
@ -1,7 +1,7 @@
|
|||||||
From e34bd2763c0d0776693f8842639b35b55dcb511b Mon Sep 17 00:00:00 2001
|
From e34bd2763c0d0776693f8842639b35b55dcb511b Mon Sep 17 00:00:00 2001
|
||||||
From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= <lsedlar@redhat.com>
|
From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= <lsedlar@redhat.com>
|
||||||
Date: Mon, 4 Apr 2016 09:38:48 +0200
|
Date: Mon, 4 Apr 2016 09:38:48 +0200
|
||||||
Subject: [PATCH 1/3] [checksum] Add arch to file name
|
Subject: [PATCH 1/6] [checksum] Add arch to file name
|
||||||
MIME-Version: 1.0
|
MIME-Version: 1.0
|
||||||
Content-Type: text/plain; charset=UTF-8
|
Content-Type: text/plain; charset=UTF-8
|
||||||
Content-Transfer-Encoding: 8bit
|
Content-Transfer-Encoding: 8bit
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
From f18e32c5affad9bf376103a536c7ded19366d92f Mon Sep 17 00:00:00 2001
|
From f18e32c5affad9bf376103a536c7ded19366d92f Mon Sep 17 00:00:00 2001
|
||||||
From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= <lsedlar@redhat.com>
|
From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= <lsedlar@redhat.com>
|
||||||
Date: Mon, 4 Apr 2016 14:24:18 +0200
|
Date: Mon, 4 Apr 2016 14:24:18 +0200
|
||||||
Subject: [PATCH 2/3] [atomic] Stop creating the os directory
|
Subject: [PATCH 2/6] [atomic] Stop creating the os directory
|
||||||
MIME-Version: 1.0
|
MIME-Version: 1.0
|
||||||
Content-Type: text/plain; charset=UTF-8
|
Content-Type: text/plain; charset=UTF-8
|
||||||
Content-Transfer-Encoding: 8bit
|
Content-Transfer-Encoding: 8bit
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
From 05384eae584476bfca3bd4bf31958d1e5dbb20a6 Mon Sep 17 00:00:00 2001
|
From 05384eae584476bfca3bd4bf31958d1e5dbb20a6 Mon Sep 17 00:00:00 2001
|
||||||
From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= <lsedlar@redhat.com>
|
From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= <lsedlar@redhat.com>
|
||||||
Date: Mon, 4 Apr 2016 15:13:35 +0200
|
Date: Mon, 4 Apr 2016 15:13:35 +0200
|
||||||
Subject: [PATCH 3/3] [ostree] Fix call to kobo.shortcuts.run
|
Subject: [PATCH 3/6] [ostree] Fix call to kobo.shortcuts.run
|
||||||
MIME-Version: 1.0
|
MIME-Version: 1.0
|
||||||
Content-Type: text/plain; charset=UTF-8
|
Content-Type: text/plain; charset=UTF-8
|
||||||
Content-Transfer-Encoding: 8bit
|
Content-Transfer-Encoding: 8bit
|
||||||
|
276
0004-ostree-Move-cloning-config-repo-to-chroot.patch
Normal file
276
0004-ostree-Move-cloning-config-repo-to-chroot.patch
Normal file
@ -0,0 +1,276 @@
|
|||||||
|
From 446d4b20cc508ae466a1c5bf9cc76f8b0fc12494 Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= <lsedlar@redhat.com>
|
||||||
|
Date: Tue, 5 Apr 2016 08:40:54 +0200
|
||||||
|
Subject: [PATCH 4/6] [ostree] Move cloning config repo to chroot
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
|
||||||
|
---
|
||||||
|
pungi/atomic.py | 46 ++++++++++++++++++++++++++++++++++++++++++++-
|
||||||
|
pungi/phases/ostree.py | 29 ++++------------------------
|
||||||
|
tests/helpers.py | 7 ++++++-
|
||||||
|
tests/test_atomic_script.py | 23 ++++++++++++++++++++---
|
||||||
|
tests/test_ostree_phase.py | 15 ++++-----------
|
||||||
|
5 files changed, 79 insertions(+), 41 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/pungi/atomic.py b/pungi/atomic.py
|
||||||
|
index 7c0075b..627ce34 100644
|
||||||
|
--- a/pungi/atomic.py
|
||||||
|
+++ b/pungi/atomic.py
|
||||||
|
@@ -8,6 +8,11 @@ It is expected to be runnable in Koji runroot.
|
||||||
|
import argparse
|
||||||
|
import os
|
||||||
|
from kobo import shortcuts
|
||||||
|
+import tempfile
|
||||||
|
+import shutil
|
||||||
|
+import re
|
||||||
|
+
|
||||||
|
+from .wrappers import scm
|
||||||
|
|
||||||
|
|
||||||
|
def make_log_file(log_dir, filename):
|
||||||
|
@@ -31,9 +36,42 @@ def make_ostree_repo(repo, config, log_dir=None):
|
||||||
|
logfile=log_file)
|
||||||
|
|
||||||
|
|
||||||
|
+def clone_repo(repodir, url, branch):
|
||||||
|
+ scm.get_dir_from_scm(
|
||||||
|
+ {'scm': 'git', 'repo': url, 'branch': branch, 'dir': '.'}, repodir)
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+def tweak_mirrorlist(repodir, source_repo):
|
||||||
|
+ for file in os.listdir(repodir):
|
||||||
|
+ if file.endswith('.repo'):
|
||||||
|
+ tweak_file(os.path.join(repodir, file), source_repo)
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+def tweak_file(path, source_repo):
|
||||||
|
+ """Replace mirrorlist line in repo file with baseurl pointing to source_repo."""
|
||||||
|
+ with open(path, 'r') as f:
|
||||||
|
+ contents = f.read()
|
||||||
|
+ replacement = 'baseurl={}'.format(source_repo)
|
||||||
|
+ contents = re.sub(r'^mirrorlist=.*$', replacement, contents)
|
||||||
|
+ with open(path, 'w') as f:
|
||||||
|
+ f.write(contents)
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+def prepare_config(workdir, config_url, config_branch, source_repo):
|
||||||
|
+ repodir = os.path.join(workdir, 'config_repo')
|
||||||
|
+ clone_repo(repodir, config_url, config_branch)
|
||||||
|
+ tweak_mirrorlist(repodir, source_repo)
|
||||||
|
+ return repodir
|
||||||
|
+
|
||||||
|
+
|
||||||
|
def run(opts):
|
||||||
|
+ workdir = tempfile.mkdtemp()
|
||||||
|
+ repodir = prepare_config(workdir, opts.config_url, opts.config_branch,
|
||||||
|
+ opts.source_repo)
|
||||||
|
init_atomic_repo(opts.atomic_repo, log_dir=opts.log_dir)
|
||||||
|
- make_ostree_repo(opts.atomic_repo, opts.treefile, log_dir=opts.log_dir)
|
||||||
|
+ treefile = os.path.join(repodir, opts.treefile)
|
||||||
|
+ make_ostree_repo(opts.atomic_repo, treefile, log_dir=opts.log_dir)
|
||||||
|
+ shutil.rmtree(workdir)
|
||||||
|
|
||||||
|
|
||||||
|
def main(args=None):
|
||||||
|
@@ -45,6 +83,12 @@ def main(args=None):
|
||||||
|
help='where to put the atomic repo')
|
||||||
|
parser.add_argument('--treefile', required=True,
|
||||||
|
help='treefile for rpm-ostree')
|
||||||
|
+ parser.add_argument('--config-url', required=True,
|
||||||
|
+ help='git repository with the treefile')
|
||||||
|
+ parser.add_argument('--config-branch', default='master',
|
||||||
|
+ help='git branch to be used')
|
||||||
|
+ parser.add_argument('--source-repo', required=True,
|
||||||
|
+ help='yum repo used as source for')
|
||||||
|
|
||||||
|
opts = parser.parse_args(args)
|
||||||
|
|
||||||
|
diff --git a/pungi/phases/ostree.py b/pungi/phases/ostree.py
|
||||||
|
index 36cbc97..79e58d4 100644
|
||||||
|
--- a/pungi/phases/ostree.py
|
||||||
|
+++ b/pungi/phases/ostree.py
|
||||||
|
@@ -2,12 +2,11 @@
|
||||||
|
|
||||||
|
import os
|
||||||
|
from kobo.threads import ThreadPool, WorkerThread
|
||||||
|
-import re
|
||||||
|
|
||||||
|
from .base import ConfigGuardedPhase
|
||||||
|
from .. import util
|
||||||
|
from ..paths import translate_path
|
||||||
|
-from ..wrappers import scm, kojiwrapper
|
||||||
|
+from ..wrappers import kojiwrapper
|
||||||
|
|
||||||
|
|
||||||
|
class OSTreePhase(ConfigGuardedPhase):
|
||||||
|
@@ -42,15 +41,11 @@ class OSTreeThread(WorkerThread):
|
||||||
|
|
||||||
|
msg = 'OSTree phase for variant %s, arch %s' % (variant.uid, arch)
|
||||||
|
self.pool.log_info('[BEGIN] %s' % msg)
|
||||||
|
- workdir = compose.paths.work.topdir('atomic')
|
||||||
|
self.logdir = compose.paths.log.topdir('{}/atomic'.format(arch))
|
||||||
|
- repodir = os.path.join(workdir, 'config_repo')
|
||||||
|
|
||||||
|
source_variant = compose.variants[config['source_repo_from']]
|
||||||
|
source_repo = translate_path(compose, compose.paths.compose.repository(arch, source_variant))
|
||||||
|
|
||||||
|
- self._clone_repo(repodir, config['config_url'], config.get('config_branch', 'master'))
|
||||||
|
- self._tweak_mirrorlist(repodir, source_repo)
|
||||||
|
self._run_atomic_cmd(compose, variant, arch, config, source_repo)
|
||||||
|
|
||||||
|
self.pool.log_info('[DONE ] %s' % msg)
|
||||||
|
@@ -60,6 +55,9 @@ class OSTreeThread(WorkerThread):
|
||||||
|
'pungi-make-ostree',
|
||||||
|
'--log-dir={}'.format(self.logdir),
|
||||||
|
'--treefile={}'.format(config['treefile']),
|
||||||
|
+ '--config-url={}'.format(config['config_url']),
|
||||||
|
+ '--config-branch={}'.format(config.get('config_branch', 'master')),
|
||||||
|
+ '--source-repo={}'.format(source_repo),
|
||||||
|
config['atomic_repo']
|
||||||
|
]
|
||||||
|
|
||||||
|
@@ -77,22 +75,3 @@ class OSTreeThread(WorkerThread):
|
||||||
|
if output["retcode"] != 0:
|
||||||
|
raise RuntimeError("Runroot task failed: %s. See %s for more details."
|
||||||
|
% (output["task_id"], log_file))
|
||||||
|
-
|
||||||
|
- def _clone_repo(self, repodir, url, branch):
|
||||||
|
- scm.get_dir_from_scm({'scm': 'git', 'repo': url, 'branch': branch, 'dir': '.'},
|
||||||
|
- repodir, logger=self.pool._logger)
|
||||||
|
-
|
||||||
|
- def _tweak_mirrorlist(self, repodir, source_repo):
|
||||||
|
- for file in os.listdir(repodir):
|
||||||
|
- if file.endswith('.repo'):
|
||||||
|
- tweak_file(os.path.join(repodir, file), source_repo)
|
||||||
|
-
|
||||||
|
-
|
||||||
|
-def tweak_file(path, source_repo):
|
||||||
|
- """Replace mirrorlist line in repo file with baseurl pointing to source_repo."""
|
||||||
|
- with open(path, 'r') as f:
|
||||||
|
- contents = f.read()
|
||||||
|
- replacement = 'baseurl={}'.format(source_repo)
|
||||||
|
- contents = re.sub(r'^mirrorlist=.*$', replacement, contents)
|
||||||
|
- with open(path, 'w') as f:
|
||||||
|
- f.write(contents)
|
||||||
|
diff --git a/tests/helpers.py b/tests/helpers.py
|
||||||
|
index 11c07a4..d93e095 100644
|
||||||
|
--- a/tests/helpers.py
|
||||||
|
+++ b/tests/helpers.py
|
||||||
|
@@ -5,6 +5,7 @@ import os
|
||||||
|
import unittest
|
||||||
|
import tempfile
|
||||||
|
import shutil
|
||||||
|
+import errno
|
||||||
|
|
||||||
|
from pungi.util import get_arch_variant_data
|
||||||
|
from pungi import paths
|
||||||
|
@@ -15,7 +16,11 @@ class PungiTestCase(unittest.TestCase):
|
||||||
|
self.topdir = tempfile.mkdtemp()
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
- shutil.rmtree(self.topdir)
|
||||||
|
+ try:
|
||||||
|
+ shutil.rmtree(self.topdir)
|
||||||
|
+ except OSError as err:
|
||||||
|
+ if err.errno != errno.ENOENT:
|
||||||
|
+ raise
|
||||||
|
|
||||||
|
|
||||||
|
class DummyCompose(object):
|
||||||
|
diff --git a/tests/test_atomic_script.py b/tests/test_atomic_script.py
|
||||||
|
index a871659..4b0b396 100755
|
||||||
|
--- a/tests/test_atomic_script.py
|
||||||
|
+++ b/tests/test_atomic_script.py
|
||||||
|
@@ -17,20 +17,37 @@ from pungi import atomic
|
||||||
|
|
||||||
|
class OstreeScriptTest(helpers.PungiTestCase):
|
||||||
|
|
||||||
|
+ def _dummy_config_repo(self, scm_dict, target, logger=None):
|
||||||
|
+ helpers.touch(os.path.join(target, 'fedora-atomic-docker-host.json'))
|
||||||
|
+ helpers.touch(os.path.join(target, 'fedora-rawhide.repo'))
|
||||||
|
+
|
||||||
|
+ @mock.patch('tempfile.mkdtemp')
|
||||||
|
@mock.patch('kobo.shortcuts.run')
|
||||||
|
- def test_full_run(self, run):
|
||||||
|
+ @mock.patch('pungi.wrappers.scm.get_dir_from_scm')
|
||||||
|
+ def test_full_run(self, get_dir_from_scm, run, tempfile):
|
||||||
|
+ tempfile.return_value = self.topdir
|
||||||
|
+ get_dir_from_scm.side_effect = self._dummy_config_repo
|
||||||
|
+
|
||||||
|
atomic.main([
|
||||||
|
'--log-dir={}'.format(os.path.join(self.topdir, 'logs', 'Atomic')),
|
||||||
|
- '--treefile={}'.format(os.path.join(self.topdir, 'work', 'fedora-atomic-docker-host.json')),
|
||||||
|
+ '--treefile={}'.format('fedora-atomic-docker-host.json'),
|
||||||
|
+ '--config-url=https://git.fedorahosted.org/git/fedora-atomic.git',
|
||||||
|
+ '--config-branch=f24',
|
||||||
|
+ '--source-repo=https://kojipkgs.fedoraproject.org/repo',
|
||||||
|
os.path.join(self.topdir, 'atomic'),
|
||||||
|
])
|
||||||
|
+
|
||||||
|
self.maxDiff = None
|
||||||
|
+ self.assertEqual(get_dir_from_scm.call_args_list,
|
||||||
|
+ [mock.call({'scm': 'git', 'repo': 'https://git.fedorahosted.org/git/fedora-atomic.git',
|
||||||
|
+ 'branch': 'f24', 'dir': '.'},
|
||||||
|
+ self.topdir + '/config_repo')])
|
||||||
|
self.assertItemsEqual(
|
||||||
|
run.call_args_list,
|
||||||
|
[mock.call(['ostree', 'init', '--repo={}/atomic'.format(self.topdir), '--mode=archive-z2'],
|
||||||
|
logfile=self.topdir + '/logs/Atomic/init-atomic-repo.log'),
|
||||||
|
mock.call(['rpm-ostree', 'compose', 'tree', '--repo={}/atomic'.format(self.topdir),
|
||||||
|
- self.topdir + '/work/fedora-atomic-docker-host.json'],
|
||||||
|
+ self.topdir + '/config_repo/fedora-atomic-docker-host.json'],
|
||||||
|
logfile=self.topdir + '/logs/Atomic/create-atomic-repo.log')])
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/tests/test_ostree_phase.py b/tests/test_ostree_phase.py
|
||||||
|
index e4664e1..fe0036c 100755
|
||||||
|
--- a/tests/test_ostree_phase.py
|
||||||
|
+++ b/tests/test_ostree_phase.py
|
||||||
|
@@ -74,13 +74,8 @@ class OSTreePhaseTest(helpers.PungiTestCase):
|
||||||
|
|
||||||
|
class OSTreeThreadTest(helpers.PungiTestCase):
|
||||||
|
|
||||||
|
- def _dummy_config_repo(self, scm_dict, target, logger=None):
|
||||||
|
- helpers.touch(os.path.join(target, 'fedora-atomic-docker-host.json'))
|
||||||
|
- helpers.touch(os.path.join(target, 'fedora-rawhide.repo'))
|
||||||
|
-
|
||||||
|
- @mock.patch('pungi.wrappers.scm.get_dir_from_scm')
|
||||||
|
@mock.patch('pungi.wrappers.kojiwrapper.KojiWrapper')
|
||||||
|
- def test_run(self, KojiWrapper, get_dir_from_scm):
|
||||||
|
+ def test_run(self, KojiWrapper):
|
||||||
|
compose = helpers.DummyCompose(self.topdir, {
|
||||||
|
'koji_profile': 'koji',
|
||||||
|
'runroot_tag': 'rrt',
|
||||||
|
@@ -93,7 +88,6 @@ class OSTreeThreadTest(helpers.PungiTestCase):
|
||||||
|
'treefile': 'fedora-atomic-docker-host.json',
|
||||||
|
'atomic_repo': '/other/place/for/atomic'
|
||||||
|
}
|
||||||
|
- get_dir_from_scm.side_effect = self._dummy_config_repo
|
||||||
|
koji = KojiWrapper.return_value
|
||||||
|
koji.run_runroot_cmd.return_value = {
|
||||||
|
'task_id': 1234,
|
||||||
|
@@ -105,15 +99,14 @@ class OSTreeThreadTest(helpers.PungiTestCase):
|
||||||
|
|
||||||
|
t.process((compose, compose.variants['Everything'], 'x86_64', cfg), 1)
|
||||||
|
|
||||||
|
- self.assertEqual(get_dir_from_scm.call_args_list,
|
||||||
|
- [mock.call({'scm': 'git', 'repo': 'https://git.fedorahosted.org/git/fedora-atomic.git',
|
||||||
|
- 'branch': 'f24', 'dir': '.'},
|
||||||
|
- self.topdir + '/work/atomic/config_repo', logger=pool._logger)])
|
||||||
|
self.assertEqual(koji.get_runroot_cmd.call_args_list,
|
||||||
|
[mock.call('rrt', 'x86_64',
|
||||||
|
['pungi-make-ostree',
|
||||||
|
'--log-dir={}/logs/x86_64/atomic'.format(self.topdir),
|
||||||
|
'--treefile=fedora-atomic-docker-host.json',
|
||||||
|
+ '--config-url=https://git.fedorahosted.org/git/fedora-atomic.git',
|
||||||
|
+ '--config-branch=f24',
|
||||||
|
+ '--source-repo={}/compose/Everything/x86_64/os'.format(self.topdir),
|
||||||
|
'/other/place/for/atomic'],
|
||||||
|
channel=None, mounts=[self.topdir],
|
||||||
|
packages=['pungi', 'ostree', 'rpm-ostree'],
|
||||||
|
--
|
||||||
|
2.7.3
|
||||||
|
|
1494
0005-ostree-Rename-atomic-to-ostree.patch
Normal file
1494
0005-ostree-Rename-atomic-to-ostree.patch
Normal file
File diff suppressed because it is too large
Load Diff
168
0006-ostree-Use-explicit-work-directory.patch
Normal file
168
0006-ostree-Use-explicit-work-directory.patch
Normal file
@ -0,0 +1,168 @@
|
|||||||
|
From 79ee9a4ffaf4627eade703c9bd819c870258745f Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= <lsedlar@redhat.com>
|
||||||
|
Date: Tue, 5 Apr 2016 12:46:59 +0200
|
||||||
|
Subject: [PATCH 6/6] [ostree] Use explicit work directory
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
|
||||||
|
---
|
||||||
|
pungi/ostree.py | 26 +++++++++++++++++++-------
|
||||||
|
pungi/phases/ostree.py | 2 ++
|
||||||
|
tests/test_ostree_phase.py | 1 +
|
||||||
|
tests/test_ostree_script.py | 9 ++++-----
|
||||||
|
4 files changed, 26 insertions(+), 12 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/pungi/ostree.py b/pungi/ostree.py
|
||||||
|
index de2cfcd..c0c8a04 100644
|
||||||
|
--- a/pungi/ostree.py
|
||||||
|
+++ b/pungi/ostree.py
|
||||||
|
@@ -8,17 +8,26 @@ It is expected to be runnable in Koji runroot.
|
||||||
|
import argparse
|
||||||
|
import os
|
||||||
|
from kobo import shortcuts
|
||||||
|
-import tempfile
|
||||||
|
-import shutil
|
||||||
|
import re
|
||||||
|
+import errno
|
||||||
|
|
||||||
|
from .wrappers import scm
|
||||||
|
|
||||||
|
|
||||||
|
+def ensure_dir(path):
|
||||||
|
+ try:
|
||||||
|
+ os.makedirs(path)
|
||||||
|
+ except OSError as err:
|
||||||
|
+ if err.errno != errno.EEXIST:
|
||||||
|
+ raise
|
||||||
|
+ return path
|
||||||
|
+
|
||||||
|
+
|
||||||
|
def make_log_file(log_dir, filename):
|
||||||
|
"""Return path to log file with given name, if log_dir is set."""
|
||||||
|
if not log_dir:
|
||||||
|
return None
|
||||||
|
+ ensure_dir(log_dir)
|
||||||
|
return os.path.join(log_dir, '{}.log'.format(filename))
|
||||||
|
|
||||||
|
|
||||||
|
@@ -26,14 +35,15 @@ def init_ostree_repo(repo, log_dir=None):
|
||||||
|
"""If the ostree repo does not exist, initialize it."""
|
||||||
|
log_file = make_log_file(log_dir, 'init-ostree-repo')
|
||||||
|
if not os.path.isdir(repo):
|
||||||
|
+ ensure_dir(repo)
|
||||||
|
shortcuts.run(['ostree', 'init', '--repo={}'.format(repo), '--mode=archive-z2'],
|
||||||
|
- logfile=log_file)
|
||||||
|
+ show_cmd=True, logfile=log_file)
|
||||||
|
|
||||||
|
|
||||||
|
def make_ostree_repo(repo, config, log_dir=None):
|
||||||
|
log_file = make_log_file(log_dir, 'create-ostree-repo')
|
||||||
|
shortcuts.run(['rpm-ostree', 'compose', 'tree', '--repo={}'.format(repo), config],
|
||||||
|
- logfile=log_file)
|
||||||
|
+ show_cmd=True, logfile=log_file)
|
||||||
|
|
||||||
|
|
||||||
|
def clone_repo(repodir, url, branch):
|
||||||
|
@@ -52,7 +62,7 @@ def tweak_file(path, source_repo):
|
||||||
|
with open(path, 'r') as f:
|
||||||
|
contents = f.read()
|
||||||
|
replacement = 'baseurl={}'.format(source_repo)
|
||||||
|
- contents = re.sub(r'^mirrorlist=.*$', replacement, contents)
|
||||||
|
+ contents = re.sub(r'^mirrorlist=.*$', replacement, contents, flags=re.MULTILINE)
|
||||||
|
with open(path, 'w') as f:
|
||||||
|
f.write(contents)
|
||||||
|
|
||||||
|
@@ -65,19 +75,21 @@ def prepare_config(workdir, config_url, config_branch, source_repo):
|
||||||
|
|
||||||
|
|
||||||
|
def run(opts):
|
||||||
|
- workdir = tempfile.mkdtemp()
|
||||||
|
+ workdir = ensure_dir(opts.work_dir)
|
||||||
|
repodir = prepare_config(workdir, opts.config_url, opts.config_branch,
|
||||||
|
opts.source_repo)
|
||||||
|
+ ensure_dir(repodir)
|
||||||
|
init_ostree_repo(opts.ostree_repo, log_dir=opts.log_dir)
|
||||||
|
treefile = os.path.join(repodir, opts.treefile)
|
||||||
|
make_ostree_repo(opts.ostree_repo, treefile, log_dir=opts.log_dir)
|
||||||
|
- shutil.rmtree(workdir)
|
||||||
|
|
||||||
|
|
||||||
|
def main(args=None):
|
||||||
|
parser = argparse.ArgumentParser()
|
||||||
|
parser.add_argument('--log-dir',
|
||||||
|
help='where to log output')
|
||||||
|
+ parser.add_argument('--work-dir', required=True,
|
||||||
|
+ help='where to put temporary files')
|
||||||
|
|
||||||
|
parser.add_argument('ostree_repo', metavar='OSTREE_REPO',
|
||||||
|
help='where to put the ostree repo')
|
||||||
|
diff --git a/pungi/phases/ostree.py b/pungi/phases/ostree.py
|
||||||
|
index 810716e..77e4838 100644
|
||||||
|
--- a/pungi/phases/ostree.py
|
||||||
|
+++ b/pungi/phases/ostree.py
|
||||||
|
@@ -51,9 +51,11 @@ class OSTreeThread(WorkerThread):
|
||||||
|
self.pool.log_info('[DONE ] %s' % msg)
|
||||||
|
|
||||||
|
def _run_ostree_cmd(self, compose, variant, arch, config, source_repo):
|
||||||
|
+ workdir = os.path.join(compose.paths.work.topdir(arch), 'ostree')
|
||||||
|
cmd = [
|
||||||
|
'pungi-make-ostree',
|
||||||
|
'--log-dir={}'.format(self.logdir),
|
||||||
|
+ '--work-dir={}'.format(workdir),
|
||||||
|
'--treefile={}'.format(config['treefile']),
|
||||||
|
'--config-url={}'.format(config['config_url']),
|
||||||
|
'--config-branch={}'.format(config.get('config_branch', 'master')),
|
||||||
|
diff --git a/tests/test_ostree_phase.py b/tests/test_ostree_phase.py
|
||||||
|
index 9f8fdf1..7617dde 100755
|
||||||
|
--- a/tests/test_ostree_phase.py
|
||||||
|
+++ b/tests/test_ostree_phase.py
|
||||||
|
@@ -103,6 +103,7 @@ class OSTreeThreadTest(helpers.PungiTestCase):
|
||||||
|
[mock.call('rrt', 'x86_64',
|
||||||
|
['pungi-make-ostree',
|
||||||
|
'--log-dir={}/logs/x86_64/ostree'.format(self.topdir),
|
||||||
|
+ '--work-dir={}/work/x86_64/ostree'.format(self.topdir),
|
||||||
|
'--treefile=fedora-atomic-docker-host.json',
|
||||||
|
'--config-url=https://git.fedorahosted.org/git/fedora-atomic.git',
|
||||||
|
'--config-branch=f24',
|
||||||
|
diff --git a/tests/test_ostree_script.py b/tests/test_ostree_script.py
|
||||||
|
index 744af4d..7b59680 100755
|
||||||
|
--- a/tests/test_ostree_script.py
|
||||||
|
+++ b/tests/test_ostree_script.py
|
||||||
|
@@ -21,17 +21,16 @@ class OstreeScriptTest(helpers.PungiTestCase):
|
||||||
|
helpers.touch(os.path.join(target, 'fedora-atomic-docker-host.json'))
|
||||||
|
helpers.touch(os.path.join(target, 'fedora-rawhide.repo'))
|
||||||
|
|
||||||
|
- @mock.patch('tempfile.mkdtemp')
|
||||||
|
@mock.patch('kobo.shortcuts.run')
|
||||||
|
@mock.patch('pungi.wrappers.scm.get_dir_from_scm')
|
||||||
|
- def test_full_run(self, get_dir_from_scm, run, tempfile):
|
||||||
|
- tempfile.return_value = self.topdir
|
||||||
|
+ def test_full_run(self, get_dir_from_scm, run):
|
||||||
|
get_dir_from_scm.side_effect = self._dummy_config_repo
|
||||||
|
|
||||||
|
repo = os.path.join(self.topdir, 'atomic')
|
||||||
|
|
||||||
|
ostree.main([
|
||||||
|
'--log-dir={}'.format(os.path.join(self.topdir, 'logs', 'Atomic')),
|
||||||
|
+ '--work-dir={}'.format(self.topdir),
|
||||||
|
'--treefile={}'.format('fedora-atomic-docker-host.json'),
|
||||||
|
'--config-url=https://git.fedorahosted.org/git/fedora-atomic.git',
|
||||||
|
'--config-branch=f24',
|
||||||
|
@@ -47,10 +46,10 @@ class OstreeScriptTest(helpers.PungiTestCase):
|
||||||
|
self.assertItemsEqual(
|
||||||
|
run.call_args_list,
|
||||||
|
[mock.call(['ostree', 'init', '--repo={}'.format(repo), '--mode=archive-z2'],
|
||||||
|
- logfile=self.topdir + '/logs/Atomic/init-ostree-repo.log'),
|
||||||
|
+ logfile=self.topdir + '/logs/Atomic/init-ostree-repo.log', show_cmd=True),
|
||||||
|
mock.call(['rpm-ostree', 'compose', 'tree', '--repo={}'.format(repo),
|
||||||
|
self.topdir + '/config_repo/fedora-atomic-docker-host.json'],
|
||||||
|
- logfile=self.topdir + '/logs/Atomic/create-ostree-repo.log')])
|
||||||
|
+ logfile=self.topdir + '/logs/Atomic/create-ostree-repo.log', show_cmd=True)])
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
--
|
||||||
|
2.7.3
|
||||||
|
|
54
c52cb198c5ffc0593720c927f469793bedb3d4a4.patch
Normal file
54
c52cb198c5ffc0593720c927f469793bedb3d4a4.patch
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
From c52cb198c5ffc0593720c927f469793bedb3d4a4 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Peter Robinson <pbrobinson@gmail.com>
|
||||||
|
Date: Mar 16 2016 22:03:33 +0000
|
||||||
|
Subject: Fix locations of ppc lorax templates for PowerPC iso creation
|
||||||
|
|
||||||
|
|
||||||
|
PowerPC needs a mapping file for iso creation, with lorax moving the
|
||||||
|
templates locations in 24+ we need to update this so runroot iso
|
||||||
|
creation doesn't fail.
|
||||||
|
|
||||||
|
Signed-off-by: Peter Robinson <pbrobinson@fedoraproject.org>
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
diff --git a/pungi/gather.py b/pungi/gather.py
|
||||||
|
index 2e5048c..c27070f 100644
|
||||||
|
--- a/pungi/gather.py
|
||||||
|
+++ b/pungi/gather.py
|
||||||
|
@@ -1590,7 +1590,7 @@ class Pungi(PungiBase):
|
||||||
|
return
|
||||||
|
|
||||||
|
isolist = []
|
||||||
|
- ppcbootinfo = '/usr/share/lorax/config_files/ppc'
|
||||||
|
+ ppcbootinfo = '/usr/share/lorax/templates.d/99-generic/config_files/ppc'
|
||||||
|
|
||||||
|
pungi.util._ensuredir(self.isodir, self.logger,
|
||||||
|
force=self.config.getboolean('pungi', 'force'),
|
||||||
|
diff --git a/pungi/phases/createiso.py b/pungi/phases/createiso.py
|
||||||
|
index f88b20d..eab3133 100644
|
||||||
|
--- a/pungi/phases/createiso.py
|
||||||
|
+++ b/pungi/phases/createiso.py
|
||||||
|
@@ -142,7 +142,7 @@ class CreateisoPhase(PhaseBase):
|
||||||
|
buildinstall_method = self.compose.conf["buildinstall_method"]
|
||||||
|
if buildinstall_method == "lorax":
|
||||||
|
# TODO: $arch instead of ppc
|
||||||
|
- mkisofs_kwargs["boot_args"] = iso.get_boot_options(arch, "/usr/share/lorax/config_files/ppc")
|
||||||
|
+ mkisofs_kwargs["boot_args"] = iso.get_boot_options(arch, "/usr/share/lorax/templates.d/99-generic/config_files/ppc")
|
||||||
|
elif buildinstall_method == "buildinstall":
|
||||||
|
mkisofs_kwargs["boot_args"] = iso.get_boot_options(arch, "/usr/lib/anaconda-runtime/boot")
|
||||||
|
|
||||||
|
diff --git a/pungi/phases/product_img.py b/pungi/phases/product_img.py
|
||||||
|
index 687d261..8da4e23 100644
|
||||||
|
--- a/pungi/phases/product_img.py
|
||||||
|
+++ b/pungi/phases/product_img.py
|
||||||
|
@@ -230,7 +230,7 @@ def rebuild_boot_iso(compose, arch, variant, package_sets):
|
||||||
|
boot_files = None
|
||||||
|
if buildinstall_method == "lorax":
|
||||||
|
# TODO: $arch instead of ppc
|
||||||
|
- mkisofs_kwargs["boot_args"] = iso.get_boot_options(arch, "/usr/share/lorax/config_files/ppc")
|
||||||
|
+ mkisofs_kwargs["boot_args"] = iso.get_boot_options(arch, "/usr/share/lorax/templates.d/99-generic/config_files/ppc")
|
||||||
|
elif buildinstall_method == "buildinstall":
|
||||||
|
boot_files = explode_anaconda(compose, arch, variant, package_sets)
|
||||||
|
mkisofs_kwargs["boot_args"] = iso.get_boot_options(arch, boot_files)
|
||||||
|
|
16
pungi.spec
16
pungi.spec
@ -1,6 +1,6 @@
|
|||||||
Name: pungi
|
Name: pungi
|
||||||
Version: 4.1.1
|
Version: 4.1.1
|
||||||
Release: 2%{?dist}
|
Release: 3%{?dist}
|
||||||
Summary: Distribution compose tool
|
Summary: Distribution compose tool
|
||||||
|
|
||||||
Group: Development/Tools
|
Group: Development/Tools
|
||||||
@ -10,7 +10,11 @@ Source0: https://fedorahosted.org/pungi/attachment/wiki/%{version}/%{name
|
|||||||
Patch0: 0001-checksum-Add-arch-to-file-name.patch
|
Patch0: 0001-checksum-Add-arch-to-file-name.patch
|
||||||
Patch1: 0002-atomic-Stop-creating-the-os-directory.patch
|
Patch1: 0002-atomic-Stop-creating-the-os-directory.patch
|
||||||
Patch2: 0003-ostree-Fix-call-to-kobo.shortcuts.run.patch
|
Patch2: 0003-ostree-Fix-call-to-kobo.shortcuts.run.patch
|
||||||
|
Patch3: 0004-ostree-Move-cloning-config-repo-to-chroot.patch
|
||||||
|
Patch4: 0005-ostree-Rename-atomic-to-ostree.patch
|
||||||
|
Patch5: 0006-ostree-Use-explicit-work-directory.patch
|
||||||
|
# bandaid for https://pagure.io/pungi/issue/231 until we get things fixed properly upstream
|
||||||
|
Patch6: c52cb198c5ffc0593720c927f469793bedb3d4a4.patch
|
||||||
|
|
||||||
BuildRequires: python-nose, python-nose-cov, python-mock
|
BuildRequires: python-nose, python-nose-cov, python-mock
|
||||||
BuildRequires: python-devel, python-setuptools, python2-productmd
|
BuildRequires: python-devel, python-setuptools, python2-productmd
|
||||||
@ -55,6 +59,10 @@ A tool to create anaconda based installation trees/isos of a set of rpms.
|
|||||||
%patch0 -p1
|
%patch0 -p1
|
||||||
%patch1 -p1
|
%patch1 -p1
|
||||||
%patch2 -p1
|
%patch2 -p1
|
||||||
|
%patch3 -p1
|
||||||
|
%patch4 -p1
|
||||||
|
%patch5 -p1
|
||||||
|
%patch6 -p1
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%{__python} setup.py build
|
%{__python} setup.py build
|
||||||
@ -88,6 +96,10 @@ cd tests && ./test_compose.sh
|
|||||||
/var/cache/pungi
|
/var/cache/pungi
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Apr 05 2016 Dennis Gilmore <dennis@ausil.us> - 4.1.1-3
|
||||||
|
- add some more ostree fixes
|
||||||
|
- add a bandaid for ppc until we get a proper fix
|
||||||
|
|
||||||
* Mon Apr 04 2016 Dennis Gilmore <dennis@ausil.us> - 4.1.1-2
|
* Mon Apr 04 2016 Dennis Gilmore <dennis@ausil.us> - 4.1.1-2
|
||||||
- add upstream patches for bugfixes in ostree and checksums
|
- add upstream patches for bugfixes in ostree and checksums
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user