diff --git a/hub/kojihub.py b/hub/kojihub.py index 8953bf0d..4f558307 100644 --- a/hub/kojihub.py +++ b/hub/kojihub.py @@ -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']: diff --git a/koji/__init__.py b/koji/__init__.py index 5a48b1f2..0b475c10 100644 --- a/koji/__init__.py +++ b/koji/__init__.py @@ -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