pmbootstrap/pmb
Oliver Smith 5ea00e0862
pmbootstrap newapkbuild: Properly parse arguments (#1320)
* pmbootstrap newapkbuild: Properly parse arguments

The `pmbootstrap newapkbuild` action wraps Alpine's `newapkbuild`. We
used to directly pass all arguments to `newapkbuild` without verifying
in Python whether they make sense or not. However, as `newpakbuild`
doesn't do strict sanity checks on the arguments, it is easy to end up
with unexpected behavior when using the command for the first time.

For example, `newapkbuild` allows either specifying a PKGNAME or SRCURL
as last parameter, and also allows setting a PKGNAME with the `-n`
parameter. It only makes sense to use that option when passing a
SRCURL.

With this commit, we duplicate the optins that should be passed through
to `newapkbuild` and use argparse to fully sanitize the options and
display a help page (`pmbootstrap newapkbuild -h`) that is consistent
with the other help pages.

Details:
* The `-f` (force) flag does not get passed through anymore. Instead we
  use it in Python to skip asking if an existing aport should be
  overwritten (the aports are outside of the chroot, so `newapkbuild`
  can't handle it in a way that makes sense for pmbootstrap).
* Output of `newapkbuild` gets redirected to the log file now, as we
  don't need it to display a help page.
* Don't verify the pkgver while creating the new APKBUILD. When passing
  a SRCURL, the pkgver gets extracted from the end of the URL and may
  not have a valid format yet (but we want the APKBUILD anyway).
* Stored options passed through in `pmb/config/__init__.py` and use it
  in both `pmb/parse/arguments.py` and `pmb/helpers/frontend.py`.
* Only allow `-n` with SRCURL
* The postmarketOS aports folder gets specified with `--folder` now.
  That way the generated help page is much closer to the original one
  from `newapkbuild`. The default is `main`.
* Made the package type flags (CMake, autotools, ...) exclusive so only
  one of them can be specified
2018-03-15 21:42:34 +00:00
..
aportgen Fix aportgen without initializing buildenv 2018-03-12 17:17:32 +01:00
build pmbootstrap newapkbuild: Properly parse arguments (#1320) 2018-03-15 21:42:34 +00:00
chroot aportgen: Gracefully handle old aports_upstream (#1291) 2018-03-11 14:18:21 +00:00
config pmbootstrap newapkbuild: Properly parse arguments (#1320) 2018-03-15 21:42:34 +00:00
export Use default partitions in odin export if not specified in deviceinfo (#1271) 2018-02-28 01:28:36 +00:00
flasher Happy new year! (update copyright to 2018) 2018-01-04 04:53:35 +01:00
helpers pmbootstrap newapkbuild: Properly parse arguments (#1320) 2018-03-15 21:42:34 +00:00
install deviceinfo: remove external_disk_install and external_disk, use external_storage instead (#1301) 2018-03-07 22:35:02 +00:00
parse pmbootstrap newapkbuild: Properly parse arguments (#1320) 2018-03-15 21:42:34 +00:00
qemu qemu: allow the user to specify the kernel flavor (#1256) 2018-02-25 19:20:22 +00:00
__init__.py pmbootstrap: Disallow running as root (#1120) 2018-01-14 08:13:35 +00:00