From bf6f5cb884d9e2eb8c684bb04f9c3e9d634278f8 Mon Sep 17 00:00:00 2001 From: Oliver Smith Date: Tue, 19 Sep 2017 19:51:43 +0000 Subject: [PATCH] Fix confusing error message for invalid makedepends (#540) This happens currently, when a makedepend is invalid: ERROR: 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 --- pmb/parse/depends.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pmb/parse/depends.py b/pmb/parse/depends.py index 87124e00..c74909d3 100644 --- a/pmb/parse/depends.py +++ b/pmb/parse/depends.py @@ -25,7 +25,7 @@ import pmb.parse.apkindex def recurse_error_message(pkgname, in_aports, in_apkindexes): ret = "Could not find package '" + pkgname + "'" if in_aports: - ret += " aport" + ret += " in the aports folder" if in_apkindexes: ret += " and could not find it" if in_apkindexes: @@ -64,6 +64,7 @@ def recurse(args, pkgnames, arch=None, in_apkindexes=True, in_aports=True, # Get depends and pkgname from aports logging.verbose("Get dependencies of: " + pkgname_depend) depends = None + pkgname = None if in_aports: aport = pmb.build.find_aport(args, pkgname_depend, False) if aport: @@ -88,7 +89,7 @@ def recurse(args, pkgnames, arch=None, in_apkindexes=True, in_aports=True, if pkgname is None and strict: raise RuntimeError( recurse_error_message( - pkgname, + pkgname_depend, in_aports, in_apkindexes))