Bug 1419516

Summary: dnf.rpm.basearch('armhfp') throws KeyError
Product: [Fedora] Fedora Reporter: Lubomír Sedlář <lsedlar>
Component: dnfAssignee: rpm-software-management
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: packaging-team-maint, rpm-software-management, vmukhame
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-02-06 12:02:00 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 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.