Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 374957 - app-portage/smart-live-rebuild-1.0.1: [AttributeError] 'NoneType' object has no attribute 'cpv'
Summary: app-portage/smart-live-rebuild-1.0.1: [AttributeError] 'NoneType' object has ...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Michał Górny
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks:
 
Reported: 2011-07-12 13:12 UTC by Marc Schiffbauer
Modified: 2011-07-15 19:22 UTC (History)
0 users

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


Attachments
emerge --info (emerge--info,5.71 KB, text/plain)
2011-07-12 13:12 UTC, Marc Schiffbauer
Details
Patch for core.py (core.py.diff,454 bytes, text/plain)
2011-07-13 11:21 UTC, Marc Schiffbauer
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Marc Schiffbauer gentoo-dev 2011-07-12 13:12:43 UTC
Created attachment 279875 [details]
emerge --info

Hi,

while running smart-live-rebuild I see lots of errors like:

!!! Error enumerating kde-base/kwin-4.7.49.9999: [AttributeError] 'NoneType' object has no attribute 'cpv'

which causes a rebuild for every package with that error (178 packages on my system)

What might be the cause for that?
Comment 1 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2011-07-12 20:03:08 UTC
Could you open smartliverebuild/core.py and add a 'raise' before the line with 'Error enumerating ...'? This should make it output a complete backtrace.
Comment 2 Marc Schiffbauer gentoo-dev 2011-07-13 01:28:41 UTC
Hi Michał,

this is the bt:

*** Updating the repositories...
->  git://anongit.kde.org/kde-runtime
--> git ls-remote --heads git://anongit.kde.org/kde-runtime KDE/4.7
Traceback (most recent call last):
  File "/usr/bin/smart-live-rebuild-2.7", line 26, in <module>
    sys.exit(main(sys.argv))
  File "/usr/lib64/python2.7/site-packages/smartliverebuild/cli.py", line 144, in main
    packages = SmartLiveRebuild(opts, cliargs = args)
  File "/usr/lib64/python2.7/site-packages/smartliverebuild/core.py", line 145, in SmartLiveRebuild
    elif rebuilds[uri].cpv[0] in packages:
AttributeError: 'NoneType' object has no attribute 'cpv'
Comment 3 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2011-07-13 07:46:28 UTC
(In reply to comment #2)
> Hi Michał,
> 
> this is the bt:
> 
> *** Updating the repositories...
> ->  git://anongit.kde.org/kde-runtime
> --> git ls-remote --heads git://anongit.kde.org/kde-runtime KDE/4.7
> Traceback (most recent call last):
>   File "/usr/bin/smart-live-rebuild-2.7", line 26, in <module>
>     sys.exit(main(sys.argv))
>   File "/usr/lib64/python2.7/site-packages/smartliverebuild/cli.py", line 144,
> in main
>     packages = SmartLiveRebuild(opts, cliargs = args)
>   File "/usr/lib64/python2.7/site-packages/smartliverebuild/core.py", line 145,
> in SmartLiveRebuild
>     elif rebuilds[uri].cpv[0] in packages:
> AttributeError: 'NoneType' object has no attribute 'cpv'

Honestly, I was afraid of that. I don't get how such a thing could happen. Considering that rebuilds[uri] is set only on l140 [1], to vcs. And vcs is the result of class instantiation on l135 [2]. I don't really think that can return None.

You could try to print values of these vars in various places but I'd start by checking another Python version.

[1]:https://github.com/mgorny/smart-live-rebuild/blob/smart-live-rebuild-1.0.1/smartliverebuild/core.py#L140
[2]:https://github.com/mgorny/smart-live-rebuild/blob/smart-live-rebuild-1.0.1/smartliverebuild/core.py#L135
Comment 4 Marc Schiffbauer gentoo-dev 2011-07-13 11:21:07 UTC
Hi Michał,

I am getting the same errors with python2.6 or python3.2

Honestly I do not fully understand the code as I have not read it completely or spent enough time on it.

But what I have found is:

The problem seems to have to do with packages that share the same vcs repo.

I added that raise you mentioned as well as some debug output where I could see that the rebuilds array looked like that before the first error:

rebuilds = {'git://anongit.kde.org/kde-workspace': None, 'git://anongit.kde.org/kalzium': <smartliverebuild.vcs.git_2.Git2Support object at 0x61cd490>, 'git://anongit.kde.org/kde-runtime': None}

That is where the "None" comes from.

So if we do not only check "if uri not in rebuilds:" but "if uri not in rebuilds or rebuilds[uri] == None:" instead it seems to work fine here.

Please review the "fix" carefully as I am not sure if that really fixes the root cause or is just an ugly hack.
Comment 5 Marc Schiffbauer gentoo-dev 2011-07-13 11:21:48 UTC
Created attachment 279965 [details]
Patch for core.py
Comment 6 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2011-07-13 13:39:44 UTC
Ok, I see where my mistake was. This is fixed in dec3f8bd2e [1]. I will try to release 1.1 this week, with the fix included.

[1]:https://github.com/mgorny/smart-live-rebuild/commit/dec3f8bd2e
Comment 7 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2011-07-15 19:22:32 UTC
Ok, s-l-r-1.1 in the tree now.