• Oliver Smith's avatar
    newapkbuild: check arguments and improve usage() · a68354eb
    Oliver Smith authored
    Changes:
    * argument sanity checks:
      * `PKGNAME[-PKGVER] | SRCURL`
        * check if missing
        * check if specified more than once (see below)
      * specifying more than one buildtype flag
      * `-n` (set pkgname) without using SRCURL as last argument
      * `-s` (sourceforge source) without using PKGNAME as last argument
    * Typo fix: exist -> exists
    * `usage()`:
      * always print PKGNAME and PKGDESC (instead of NAME and DESC,
        NAME was used in one place and PKGNAME in another)
      * link to <https://spdx.org/licenses/>
      * `-m` (meson) flag was missing in short usage line at the top
      * indicate that the buildtypes are exclusive
      * `-c` flag: remove "to new directory" wording to make the
        message shorter (this should be obvious)
      * remove empty line at the end
    
    NOTE: Before this commit, the `PKGNAME[-PKGVER] | SRCURL` was allowed
    to be specified more than once, and the code looped over the arguments.
    But this was not documented in `usage()` and had unexpected results:
    
    ```
    $ newapkbuild first second third
    $ tree
    .
    ___ first
        ___ APKBUILD
        ___ first
        ___ ___ APKBUILD
        ___ ___ first
        ___ ___ ___ APKBUILD
        ___ ___ ___ src
        ___ ___ src
        ___ src
    ```
    a68354eb
newapkbuild.in 8.57 KB