ostree: Add force_new_commit option - test added
Relates: https://pagure.io/pungi/issue/811 Signed-off-by: Ondrej Nosek <onosek@redhat.com>
This commit is contained in:
parent
161b7f974b
commit
51cd359057
@ -1220,7 +1220,7 @@ repository with a new commit.
|
|||||||
deliverable is not release blocking.
|
deliverable is not release blocking.
|
||||||
* ``update_summary`` -- (*bool*) Update summary metadata after tree composing.
|
* ``update_summary`` -- (*bool*) Update summary metadata after tree composing.
|
||||||
Defaults to ``False``.
|
Defaults to ``False``.
|
||||||
* ``force_new_commit`` -- (*bool*) Do not use rpm-ostree's built in change
|
* ``force_new_commit`` -- (*bool*) Do not use rpm-ostree's built-in change
|
||||||
detection.
|
detection.
|
||||||
Defaults to ``False``.
|
Defaults to ``False``.
|
||||||
* ``version`` -- (*str*) Version string to be added as versioning metadata.
|
* ``version`` -- (*str*) Version string to be added as versioning metadata.
|
||||||
|
@ -42,6 +42,8 @@ def main(args=None):
|
|||||||
help='update summary metadata')
|
help='update summary metadata')
|
||||||
treep.add_argument('--ostree-ref', metavar='PATH',
|
treep.add_argument('--ostree-ref', metavar='PATH',
|
||||||
help='override ref value from treefile')
|
help='override ref value from treefile')
|
||||||
|
treep.add_argument('--force-new-commit', action='store_true',
|
||||||
|
help='do not use rpm-ostree\'s built-in change detection')
|
||||||
|
|
||||||
installerp = subparser.add_parser("installer", help="Create an OSTree installer image")
|
installerp = subparser.add_parser("installer", help="Create an OSTree installer image")
|
||||||
installerp.set_defaults(_class=Installer, func='run')
|
installerp.set_defaults(_class=Installer, func='run')
|
||||||
|
@ -126,6 +126,9 @@ class OSTreeThread(WorkerThread):
|
|||||||
if ostree_ref:
|
if ostree_ref:
|
||||||
cmd.append('--ostree-ref=%s' % ostree_ref)
|
cmd.append('--ostree-ref=%s' % ostree_ref)
|
||||||
|
|
||||||
|
if config.get('force_new_commit', False):
|
||||||
|
cmd.append('--force-new-commit')
|
||||||
|
|
||||||
runroot_channel = compose.conf.get("runroot_channel")
|
runroot_channel = compose.conf.get("runroot_channel")
|
||||||
runroot_tag = compose.conf["runroot_tag"]
|
runroot_tag = compose.conf["runroot_tag"]
|
||||||
|
|
||||||
|
@ -164,6 +164,29 @@ class OstreeTreeScriptTest(helpers.PungiTestCase):
|
|||||||
# repos should stay unchanged
|
# repos should stay unchanged
|
||||||
self.assertEqual(original_repos, new_repos)
|
self.assertEqual(original_repos, new_repos)
|
||||||
|
|
||||||
|
@mock.patch('kobo.shortcuts.run')
|
||||||
|
def test_force_new_commit(self, run):
|
||||||
|
repo = os.path.join(self.topdir, 'atomic')
|
||||||
|
|
||||||
|
helpers.touch(os.path.join(repo, 'initialized'))
|
||||||
|
|
||||||
|
ostree.main([
|
||||||
|
'tree',
|
||||||
|
'--repo=%s' % repo,
|
||||||
|
'--log-dir=%s' % os.path.join(self.topdir, 'logs', 'Atomic'),
|
||||||
|
'--treefile=%s/fedora-atomic-docker-host.json' % self.topdir,
|
||||||
|
'--force-new-commit',
|
||||||
|
])
|
||||||
|
|
||||||
|
self.maxDiff = None
|
||||||
|
self.assertItemsEqual(
|
||||||
|
run.call_args_list,
|
||||||
|
[mock.call(['rpm-ostree', 'compose', 'tree', '--repo=%s' % repo,
|
||||||
|
'--write-commitid-to=%s' % (self.topdir + '/logs/Atomic/commitid.log'),
|
||||||
|
'--force-nocache',
|
||||||
|
self.topdir + '/fedora-atomic-docker-host.json'],
|
||||||
|
logfile=self.topdir + '/logs/Atomic/create-ostree-repo.log', show_cmd=True, stdout=True)])
|
||||||
|
|
||||||
@mock.patch('pungi.ostree.utils.datetime')
|
@mock.patch('pungi.ostree.utils.datetime')
|
||||||
@mock.patch('kobo.shortcuts.run')
|
@mock.patch('kobo.shortcuts.run')
|
||||||
def test_extra_config_with_extra_repos(self, run, time):
|
def test_extra_config_with_extra_repos(self, run, time):
|
||||||
|
Loading…
Reference in New Issue
Block a user