Bug 1016148
Summary: | yum localinstall throws: ValueError: <any rpm> has no attribute basepath | ||
---|---|---|---|
Product: | Red Hat Enterprise Linux 6 | Reporter: | Michal Karm Babacek <mbabacek> |
Component: | yum | Assignee: | Valentina Mukhamedzhanova <vmukhame> |
Status: | CLOSED ERRATA | QA Contact: | Marek Marusic <mmarusic> |
Severity: | unspecified | Docs Contact: | |
Priority: | unspecified | ||
Version: | 6.4 | CC: | akostadi, james.antill, jzeleny, mbabacek, mmarusic, vmukhame |
Target Milestone: | rc | ||
Target Release: | --- | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
Whiteboard: | |||
Fixed In Version: | yum-3.2.29-61.el6 | Doc Type: | Bug Fix |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2015-07-22 07:21:07 UTC | Type: | Bug |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: |
Description
Michal Karm Babacek
2013-10-07 15:32:14 UTC
While I have no idea where yum-checksum plugin comes from (it's neither from "yum" or "yum-utils"), it very likely just treats YumLocalPackage instances as YumAvailablePackage instances. The following patch should fix this issue on Yum side. diff --git a/yum/packages.py b/yum/packages.py index deb44e4..042a50b 100644 --- a/yum/packages.py +++ b/yum/packages.py @@ -1333,6 +1333,9 @@ def _rpm_long_size_hack(hdr, size): # which are actual rpms. class YumHeaderPackage(YumAvailablePackage): """Package object built from an rpm header""" + + remote_url = '<local>' + def __init__(self, repo, hdr): """hand in an rpm header, we'll assume it's installed and query from there""" Zdeněk, this is a plug-in to help us verify our RPMs are what we actually expect them to be. Here is the plug-in source: https://svn.devel.redhat.com/repos/jboss-qa/beaker/trunk/eap/6.2/yum_checksum.py I'm not an expert, this is first thing I write in python and first thing I write for yum. So please let me know if something is wrong. It just logs the sha1 of every installed package through yum. Thank you! Np, the plugin code seems correct, it just does not handle local packages. pkg.remote_url is probably the only problem there. My patch from comment 3 should work this around. Alternatively, you can fix the plugin with something like: --- yum_checksum.py.orig 2013-10-08 15:43:05.592878389 +0200 +++ yum_checksum.py 2013-10-08 15:45:57.386388083 +0200 @@ -52,6 +52,10 @@ for pkg in conduit.getDownloadPackages(): # see remote_url() and checksum() fname = pkg.localPkg() - log.write('%s %s %s %s %s\n' % (hashfile(fname), fname, pkg.name, pkg.checksum, pkg.remote_url)) + if getattr(pkg, 'pkgtype', None) == 'local': + url = '<local package at %s>' % fname + else: + url = pkg.remote_url + log.write('%s %s %s %s %s\n' % (hashfile(fname), fname, pkg.name, pkg.checksum, url)) finally: log.close() Zdeněk, thank you for the advice.
I see value in your patch to packages.py because the fact that a package is local does not mean it should not have an URL defined as well it's easier to code plug-ins wen attributes are always there.
Do you think your patch will go upstream or should I use the method you suggest above to fix for yum_checksum only?
btw I think it will be most straightforward to have packages.py like:
> remote_url = 'file://' + urllib.pathname2url(os.path.abspath(pkg.localPkg()))
because otherwise url would not really be an url and next time I decide to write some weird plugin incarnation of non-sense it may break again..
WDYT?
If you need to track the package source, then file:// URL would certainly help. I was just trying to return a dummy string instead. http://lists.baseurl.org/pipermail/yum-devel/2013-October/010387.html Merged upstream. http://yum.baseurl.org/gitweb?p=yum.git;a=commitdiff;h=da3b4624 This request was evaluated by Red Hat Product Management for inclusion in the current release of Red Hat Enterprise Linux. Because the affected component is not scheduled to be updated in the current release, Red Hat is unable to address this request at this time. Red Hat invites you to ask your support representative to propose this request, if appropriate, in the next release of Red Hat Enterprise Linux. Zdeněk, I tried your suggested patch but it fails badly for me:
> if getattr(pkg, 'pkgtype', None) == 'local':
> File "/usr/lib/python2.6/site-packages/yum/sqlitesack.py", line 270, in __getattr__
> raise KeyError, str(e)
> KeyError: 'no such column: pkgtype'
This is RHEL6 but I need it working on RHEL5 as well. Since your other patch will not be backported to RHEL at least for the time being, I thought it's better to have a fix locally.
Forgot to say I'm seeing the error trying to install a package from remote repo. Sorry, was too quick writing this. Try to replace the above with: - if getattr(pkg, 'pkgtype', None) == 'local': + if hasattr(pkg, 'pkgtype') and po.pkgtype == 'local': Usually these are equivalent, but sqlitesack overrides __getattr__ .. Thank you! + if hasattr(pkg, 'pkgtype') and pkg.pkgtype == 'local': ..to fix the obvious copy-paste error. Guys? Ain't we gonna close this one or something? :-) Not yet. It seems simple enough, I'm proposing this to be fixed in RHEL 6.7 ... Patch to backport - comment 8. Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://rhn.redhat.com/errata/RHBA-2015-1384.html |