Bug 1419516 - dnf.rpm.basearch('armhfp') throws KeyError
Summary: dnf.rpm.basearch('armhfp') throws KeyError
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: dnf
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: rpm-software-management
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-02-06 11:48 UTC by Lubomír Sedlář
Modified: 2017-02-06 12:02 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-02-06 12:02:00 UTC
Type: Bug


Attachments (Terms of Use)

Description Lubomír Sedlář 2017-02-06 11:48:09 UTC
Description of problem:
Asking for basearch of 'armhfp' throws an exception.

Version-Release number of selected component:
Current master branch.

How reproducible:
Always.

Steps to Reproduce:

>>> import dnf.rpm
>>> dnf.rpm.basearch('armhfp')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/site-packages/dnf/rpm/__init__.py", line 107, in basearch
    return _BASEARCH_MAP[arch]
KeyError: 'armhfp'

Actual results:
It throws an exception.

Expected results:
It should return 'armhfp'.

Additional info:
Yum returns 'armhfp' in this case:

>>> import rpmUtils.arch
>>> rpmUtils.arch.getBaseArch('armhfp')
'armhfp'

Comment 1 Igor Gnatenko 2017-02-06 12:02:00 UTC
Unfortunately, armhfp is not architecture, but base-architecture.. in yum it worked because:

if myarch not in arches: # this is dumb, but <shrug>
    return myarch

There are couple of options..
1) You catch KeyError and set your string (which is what yum actually does)
2) We can return same string if it's base-arch we know about
3) We can define some exception which you can catch instead of KeyError
4) You do something different ;)

If you think that 1) or 4) are not something what you want -- feel free to reopen bug.


Note You need to log in before you can comment on or make changes to this bug.