pmbootstrap init: Fix regexp for int (MR 2086)
This improves handling input in pmbootstrap init. Various config options in "Additional options" are int, thus whole input must be checked: This fixes obvious error: Jobs [9]: 5e and less obvious errors: Extra space size: 600.5 Extra space size: 600m ... $ pmbootstrap install [17:28:23] *** (3/4) PREPARE INSTALL BLOCKDEVICE *** [17:28:23] ERROR: invalid literal for int() with base 10: '600.5' NOTE: I suppose moving ^ $ to ReadlineTabCompleter.ask() would break some of already defined regexes. Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
This commit is contained in:
parent
db12e987d0
commit
ba07c4cf14
|
@ -391,20 +391,20 @@ def ask_for_additional_options(args, cfg):
|
|||
" How much extra free space do you want to add to the image"
|
||||
" (in MB)?")
|
||||
answer = pmb.helpers.cli.ask(args, "Extra space size", None,
|
||||
args.extra_space, validation_regex="[0-9]+")
|
||||
args.extra_space, validation_regex="^[0-9]+$")
|
||||
cfg["pmbootstrap"]["extra_space"] = answer
|
||||
|
||||
# Boot size
|
||||
logging.info("What should be the boot partition size (in MB)?")
|
||||
answer = pmb.helpers.cli.ask(args, "Boot size", None, args.boot_size,
|
||||
validation_regex="[1-9][0-9]*")
|
||||
validation_regex="^[1-9][0-9]*$")
|
||||
cfg["pmbootstrap"]["boot_size"] = answer
|
||||
|
||||
# Parallel job count
|
||||
logging.info("How many jobs should run parallel on this machine, when"
|
||||
" compiling?")
|
||||
answer = pmb.helpers.cli.ask(args, "Jobs", None, args.jobs,
|
||||
validation_regex="[1-9][0-9]*")
|
||||
validation_regex="^[1-9][0-9]*$")
|
||||
cfg["pmbootstrap"]["jobs"] = answer
|
||||
|
||||
# Ccache size
|
||||
|
|
Loading…
Reference in New Issue