Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 915551 - sys-apps/portage: NameError: name 'pkg' is not defined
Summary: sys-apps/portage: NameError: name 'pkg' is not defined
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS
: 916335 (view as bug list)
Depends on: 916031
Blocks:
  Show dependency tree
 
Reported: 2023-10-10 16:13 UTC by Markus Walter
Modified: 2023-10-27 12:21 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
emerge --info (emerge--info.txt,10.90 KB, text/plain)
2023-10-10 19:20 UTC, Markus Walter
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Walter 2023-10-10 16:13:29 UTC
On my amd64 machine I see the following traceback from portage. Indeed looking at the code in question the offending variable is undefined. This seems to be a trivial bug.

```
Traceback (most recent call last):
  File "/usr/lib/python-exec/python3.11/emerge", line 59, in <module>
    retval = emerge_main()
             ^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/_emerge/main.py", line 1306, in emerge_main
    return run_action(emerge_config)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/_emerge/actions.py", line 4020, in run_action
    retval = action_build(emerge_config, spinner=spinner)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/_emerge/actions.py", line 677, in action_build
    retval = mergetask.merge()
             ^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/_emerge/Scheduler.py", line 1263, in merge
    color = "PKG_BINARY_MERGE" if pkg.built else "INFORM"
                                  ^^^
NameError: name 'pkg' is not defined
```

Reproducible: Always

Steps to Reproduce:
1. Try to merge something that fails (which triggers the faulty output path).
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-10-10 16:19:31 UTC
Please include emerge --info.
Comment 2 Markus Walter 2023-10-10 19:20:49 UTC
Created attachment 872521 [details]
emerge --info
Comment 3 Zac Medico gentoo-dev 2023-10-20 02:34:01 UTC
It was this change from bug 914159, and it looks like we might have to search through self._failed_pkgs_all to match the key variable to a package cpv.


https://gitweb.gentoo.org/proj/portage.git/commit/?id=f5081b7def54bc9e49aac117ce2b1ebc89379c79
Comment 4 Larry the Git Cow gentoo-dev 2023-10-22 04:38:00 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/portage.git/commit/?id=935d1432b2ea42fc0a49b9e3368a1766a673e1a9

commit 935d1432b2ea42fc0a49b9e3368a1766a673e1a9
Author:     Zac Medico <zmedico@gentoo.org>
AuthorDate: 2023-10-21 01:31:44 +0000
Commit:     Zac Medico <zmedico@gentoo.org>
CommitDate: 2023-10-22 04:36:43 +0000

    _emerge: Fix NameError 'pkg' bug 915551
    
    Use (pkg.cpv, pkg.root) to lookup package
    instances corresponding to die messages.
    
    Bug: https://bugs.gentoo.org/915551
    Signed-off-by: Zac Medico <zmedico@gentoo.org>

 lib/_emerge/Scheduler.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
Comment 5 Larry the Git Cow gentoo-dev 2023-10-25 05:49:02 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2b9128b401def05cac46f9e6d66048e5a0d888b8

commit 2b9128b401def05cac46f9e6d66048e5a0d888b8
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2023-10-25 05:48:31 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2023-10-25 05:48:40 +0000

    sys-apps/portage: add 3.0.54
    
    Closes: https://bugs.gentoo.org/905869
    Closes: https://bugs.gentoo.org/915551
    Closes: https://bugs.gentoo.org/915896
    Closes: https://bugs.gentoo.org/916106
    Closes: https://bugs.gentoo.org/916108
    Closes: https://bugs.gentoo.org/916112
    Closes: https://bugs.gentoo.org/916116
    Closes: https://bugs.gentoo.org/916139
    Closes: https://bugs.gentoo.org/916141
    Closes: https://bugs.gentoo.org/916142
    Closes: https://bugs.gentoo.org/916149
    Closes: https://bugs.gentoo.org/916182
    Closes: https://bugs.gentoo.org/916231
    Closes: https://bugs.gentoo.org/916235
    Closes: https://bugs.gentoo.org/916240
    Closes: https://bugs.gentoo.org/916242
    Closes: https://bugs.gentoo.org/916245
    Closes: https://bugs.gentoo.org/916248
    Closes: https://bugs.gentoo.org/899898
    Closes: https://bugs.gentoo.org/906129
    Closes: https://bugs.gentoo.org/906156
    Closes: https://bugs.gentoo.org/916031
    Signed-off-by: Sam James <sam@gentoo.org>

 sys-apps/portage/Manifest              |   1 +
 sys-apps/portage/portage-3.0.54.ebuild | 238 +++++++++++++++++++++++++++++++++
 2 files changed, 239 insertions(+)
Comment 6 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-10-27 12:21:25 UTC
*** Bug 916335 has been marked as a duplicate of this bug. ***