Don't allow trailing comma in additional packages

Prior to this commit, it was possible to type in packages with a
trailing comma in `pmbootstrap init` when asked for extra packages.

This leads to problems during `pmbootstrap install`, so now we disallow
it. Fixes #1540.
This commit is contained in:
Oliver Smith 2018-07-09 22:53:34 +02:00
parent 796668d7df
commit 2c5cbbb954
1 changed files with 4 additions and 3 deletions

View File

@ -337,9 +337,10 @@ def frontend(args):
logging.info("Additional packages that will be installed to rootfs."
" Specify them in a comma separated list (e.g.: vim,file)"
" or \"none\"")
cfg["pmbootstrap"]["extra_packages"] = pmb.helpers.cli.ask(args, "Extra packages",
None, args.extra_packages,
validation_regex="^(|[-.+\w\s]+(?:,[-.+\w\s]*)*)$")
extra = pmb.helpers.cli.ask(args, "Extra packages", None,
args.extra_packages,
validation_regex="^([\w-]+)(,[\w-]+)*$")
cfg["pmbootstrap"]["extra_packages"] = extra
# Configure timezone info
cfg["pmbootstrap"]["timezone"] = ask_for_timezone(args)