pmbootstrap lint: avoid looping and copying files (MR 2100)

Before this commit, package folders were copied into the chroot one by
one in order to run apkbuild-lint on them. This logic is replaced by
mounting pmaports.git into the chroot and using a single apkbuild-lint
invocation to lint the supplied packages.

Both of these changes result in a performance improvement, especially
when linting multiple packages at once.

Before this change:

    $ time ./pmbootstrap.py -q lint $(cd ../pmaports/cross; echo *) \
        > /dev/null

    real    0m5,261s
    user    0m7,046s
    sys     0m1,842s

Using the pmaports.git mount but calling apkbuild-lint in a loop:

    $ time ./pmbootstrap.py -q lint $(cd ../pmaports/cross; echo *) \
        > /dev/null

    real    0m4,089s
    user    0m6,418s
    sys     0m1,219s

After this change:

    $ time ./pmbootstrap.py -q lint $(cd ../pmaports/cross; echo *) \
        > /dev/null

    real    0m3,518s
    user    0m5,968s
    sys     0m0,959s

Additionally, running apkbuild-lint from the pmaports.git mount point
has the benefit that every printed violation contains a nice source
identifier à la "./cross/grub-x86/APKBUILD". This makes it possible to
differentiate between different packages even though only a single
apkbuild-lint invocation is used.

Relates: postmarketOS/pmaports#564
This commit is contained in:
Johannes Marbach 2021-08-30 09:24:46 +02:00 committed by Clayton Craft
parent 0b95779e30
commit ac4c967e18
No known key found for this signature in database
GPG key ID: 7A3461CA187CEA54
5 changed files with 48 additions and 16 deletions

View file

@ -586,8 +586,7 @@ def lint(args):
if not packages:
packages = pmb.helpers.pmaports.get_list(args)
for package in packages:
pmb.helpers.lint.check(args, package)
pmb.helpers.lint.check(args, packages)
def status(args):