Skip to content

Fix confusing error message for invalid makedepends

Created by: ollieparanoid

I ran into this, and I think @PureTryOut and @craftyguy did also have this issue?


This happens currently, when a makedepend is invalid:

Traceback (most recent call last):
  File "/home/user/code/pmbootstrap/pmb/__init__.py", line 53, in main
    getattr(frontend, args.action)(args)
  File "/home/user/code/pmbootstrap/pmb/helpers/frontend.py", line 84, in build
    args.buildinfo)
  File "/home/user/code/pmbootstrap/pmb/build/package.py", line 62, in package
    pmb.chroot.apk.install(args, apkbuild["makedepends"], suffix)
  File "/home/user/code/pmbootstrap/pmb/chroot/apk.py", line 197, in install
    strict=True)
  File "/home/user/code/pmbootstrap/pmb/parse/depends.py", line 88, in recurse
    if pkgname is None and strict:
UnboundLocalError: local variable 'pkgname' referenced before assignment

With this patch, you get the meaning full error that should have been printed instead:

ERROR: Could not find package 'invalid-package' in the aports folder and could not find it in any APKINDEX

Merge request reports