allow getRPMHeaders to get all headers if none are explicitly requested

This commit is contained in:
Christopher O'Brien 2020-07-22 11:11:51 -04:00 committed by Tomas Kopecek
parent ace354a15c
commit 22fcdc1ad2
2 changed files with 7 additions and 3 deletions

View file

@ -11670,8 +11670,7 @@ class RootExports(object):
is not valid or the rpm does not exist on the file system, an empty map
will be returned.
"""
if not headers:
headers = []
if rpmID:
rpm_info = get_rpm(rpmID)
if not rpm_info or not rpm_info['build_id']:

View file

@ -1030,7 +1030,7 @@ def _get_header_field(hdr, name):
return hdr[hdr_key]
def get_header_fields(X, fields, src_arch=False):
def get_header_fields(X, fields=None, src_arch=False):
"""Extract named fields from an rpm header and return as a dictionary
X may be either the rpm header or the rpm filename
@ -1040,8 +1040,13 @@ def get_header_fields(X, fields, src_arch=False):
else:
hdr = X
ret = {}
if fields is None:
fields = [rpm.tagnames[k] for k in hdr.keys()]
for f in fields:
ret[f] = get_header_field(hdr, f, src_arch=src_arch)
return ret