ostree: Use --touch-if-changed

There are three different cases:

 * we expect commitid and it's there
 * we expect commitid and it's missing
 * we don't expect commitid

This patch helps differentiate between the second two. In former one we
should report an error and mark the phase as failed. The latter is
perfectly fine and no error should be reported

Fixes: https://pagure.io/pungi/issue/1046
Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2018-09-13 15:50:22 +02:00
parent 93bc843682
commit 36c347eb79
5 changed files with 30 additions and 14 deletions

View file

@ -28,8 +28,17 @@ class Tree(OSTree):
def _make_tree(self):
"""Compose OSTree tree"""
log_file = make_log_file(self.logdir, 'create-ostree-repo')
cmd = ['rpm-ostree', 'compose', 'tree', '--repo=%s' % self.repo,
'--write-commitid-to=%s' % self.commitid_file]
cmd = [
"rpm-ostree",
"compose",
"tree",
"--repo=%s" % self.repo,
"--write-commitid-to=%s" % self.commitid_file,
# Touch the file if a new commit was created. This can help us tell
# if the commitid file is missing because no commit was created or
# because something went wrong.
"--touch-if-changed=%s.stamp" % self.commitid_file,
]
if self.version:
# Add versioning metadata
cmd.append('--add-metadata-string=version=%s' % self.version)