PR#1227: Added volume id as argument to livemedia and livecd tasks
Merges #1227 https://pagure.io/koji/pull-request/1227 Fixes: #833 https://pagure.io/koji/issue/833 Improve volume id substitutions
This commit is contained in:
commit
4f450593d2
3 changed files with 25 additions and 3 deletions
|
|
@ -3152,7 +3152,12 @@ class LiveCDTask(ImageTask):
|
|||
cmd = ['/usr/bin/livecd-creator', '-c', kskoji, '-d', '-v',
|
||||
'--logfile', livecd_log, '--cache', cachedir]
|
||||
isoname = '%s-%s-%s' % (name, version, release)
|
||||
cmd.extend(['-f', self._shortenVolID(name, version, release)])
|
||||
volid = opts.get('volid')
|
||||
if not volid:
|
||||
volid = self._shortenVolID(name, version, release)
|
||||
if len(volid) > 32:
|
||||
raise koji.LiveCDError('volume ID is longer than 32 characters')
|
||||
cmd.extend(['-f', volid])
|
||||
|
||||
# Run livecd-creator
|
||||
rv = broot.mock(['--cwd', broot.tmpdir(within=True), '--chroot', '--'] + cmd)
|
||||
|
|
@ -3337,11 +3342,18 @@ class LiveMediaTask(ImageTask):
|
|||
#'--tmp', '/tmp'
|
||||
]
|
||||
|
||||
|
||||
volid = opts.get('volid')
|
||||
if not volid:
|
||||
volid = self._shortenVolID(name, version, release)
|
||||
if len(volid) > 32:
|
||||
raise koji.LiveMediaError('volume ID is longer than 32 characters')
|
||||
|
||||
# note: at the moment, we are only generating live isos. We may add support
|
||||
# for other types in the future
|
||||
|
||||
cmd.extend(['--make-iso',
|
||||
'--volid', self._shortenVolID(name, version, release),
|
||||
'--volid', volid,
|
||||
'--iso-only',
|
||||
])
|
||||
|
||||
|
|
|
|||
|
|
@ -5479,6 +5479,7 @@ def handle_spin_livecd(options, session, args):
|
|||
"RPMs in the LiveCD. May be used multiple times. The " +
|
||||
"build tag repo associated with the target is the default."))
|
||||
parser.add_option("--release", help=_("Forcibly set the release field"))
|
||||
parser.add_option("--volid", help=_("Set the volume id"))
|
||||
parser.add_option("--specfile", metavar="URL",
|
||||
help=_("SCM URL to spec file fragment to use to generate wrapper RPMs"))
|
||||
parser.add_option("--skip-tag", action="store_true",
|
||||
|
|
@ -5492,6 +5493,8 @@ def handle_spin_livecd(options, session, args):
|
|||
" architecture, a build target, and a relative path to" +
|
||||
" a kickstart file."))
|
||||
assert False # pragma: no cover
|
||||
if task_options.volid is not None and len(task_options.volid) > 32:
|
||||
parser.error(_('Volume ID has a maximum length of 32 characters'))
|
||||
return _build_image(options, task_options, session, args, 'livecd')
|
||||
|
||||
|
||||
|
|
@ -5527,6 +5530,7 @@ def handle_spin_livemedia(options, session, args):
|
|||
"build tag repo associated with the target is the default."))
|
||||
parser.add_option("--release", help=_("Forcibly set the release field"))
|
||||
parser.add_option("--title", help=_("Set the image title (defaults to <name>)"))
|
||||
parser.add_option("--volid", help=_("Set the volume id"))
|
||||
parser.add_option("--specfile", metavar="URL",
|
||||
help=_("SCM URL to spec file fragment to use to generate wrapper RPMs"))
|
||||
parser.add_option("--skip-tag", action="store_true",
|
||||
|
|
@ -5552,6 +5556,8 @@ def handle_spin_livemedia(options, session, args):
|
|||
if task_options.lorax_url is not None and task_options.lorax_dir is None:
|
||||
parser.error(_('The "--lorax_url" option requires that "--lorax_dir" '
|
||||
'also be used.'))
|
||||
if task_options.volid is not None and len(task_options.volid) > 32:
|
||||
parser.error(_('Volume ID has a maximum length of 32 characters'))
|
||||
return _build_image(options, task_options, session, args, 'livemedia')
|
||||
|
||||
|
||||
|
|
@ -5927,7 +5933,7 @@ def _build_image(options, task_opts, session, args, img_type):
|
|||
passthru_opts = [
|
||||
'format', 'install_tree_url', 'isoname', 'ksurl',
|
||||
'ksversion', 'release', 'repo', 'scratch', 'skip_tag',
|
||||
'specfile', 'title', 'vcpu', 'vmem', 'optional_arches',
|
||||
'specfile', 'title', 'vcpu', 'vmem', 'volid', 'optional_arches',
|
||||
'lorax_dir', 'lorax_url',
|
||||
]
|
||||
for opt in passthru_opts:
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ LIVECD_OPTIONS = {
|
|||
"ksversion": None,
|
||||
"repo": None,
|
||||
"release": None,
|
||||
"volid": None,
|
||||
"specfile": None,
|
||||
}
|
||||
|
||||
|
|
@ -41,6 +42,7 @@ LIVEMEDIA_OPTIONS = {
|
|||
"lorax_url": None,
|
||||
"optional_arches": None,
|
||||
"title": None,
|
||||
"volid": None,
|
||||
}
|
||||
|
||||
APPLIANCE_OPTIONS = {
|
||||
|
|
@ -413,6 +415,7 @@ Options:
|
|||
is the default.
|
||||
--release=RELEASE Forcibly set the release field
|
||||
--title=TITLE Set the image title (defaults to <name>)
|
||||
--volid=VOLID Set the volume id
|
||||
--specfile=URL SCM URL to spec file fragment to use to generate
|
||||
wrapper RPMs
|
||||
--skip-tag Do not attempt to tag package
|
||||
|
|
@ -499,6 +502,7 @@ Options:
|
|||
The build tag repo associated with the target is the
|
||||
default.
|
||||
--release=RELEASE Forcibly set the release field
|
||||
--volid=VOLID Set the volume id
|
||||
--specfile=URL SCM URL to spec file fragment to use to generate
|
||||
wrapper RPMs
|
||||
--skip-tag Do not attempt to tag package
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue