From f42101e552de9897f7671994f1e3922cc48aee4a Mon Sep 17 00:00:00 2001 From: niku64 Date: Thu, 9 Apr 2020 17:00:10 +0300 Subject: [PATCH] Fix exception on nonexisted use flag (#91) --- sls/_modules/ebuildpkg.py | 5 ++++- sls/_states/pkg.py | 5 +++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/sls/_modules/ebuildpkg.py b/sls/_modules/ebuildpkg.py index d30d291..0f525b2 100644 --- a/sls/_modules/ebuildpkg.py +++ b/sls/_modules/ebuildpkg.py @@ -743,7 +743,10 @@ def install(name=None, changes[param] = {'version': version(param), 'old': {'use': all_uses[0]}, 'new': {'use': all_uses[1]}} - else: continue + else: + if '[' in target: + log.warning( + 'Package {0} does not have an update or flag changes, but requested to be installed, so there is probably a nonexistent flag in requested use, use equery to confirm that', target) targets.append(target) else: diff --git a/sls/_states/pkg.py b/sls/_states/pkg.py index b34069c..b381392 100644 --- a/sls/_states/pkg.py +++ b/sls/_states/pkg.py @@ -2462,10 +2462,11 @@ def latest( slot = kwargs.get('slot', None) if slot is not None: fname += ':{0}'.format(slot) + if fromrepo is not None: + fname += '::{0}'.format(fromrepo) if __salt__['portage_config.is_changed_uses'](fname): log.debug( - 'Package is up-to-date, but USE flags are changed so we need to reinstall it' - ) + 'Package {0} is up-to-date, but uses were changed, so we need to reinstall it', fname) targets[pkg] = cur[pkg] else: # Package either a) is not installed, or b) is installed and has an