From e5d09165d44d95fd8b8d45916f173ac0c805e48e Mon Sep 17 00:00:00 2001 From: Yu Ming Zhu Date: Jul 13 2021 10:06:08 +0000 Subject: yzhu --- diff --git a/hub/kojihub.py b/hub/kojihub.py index 825f3af..0b2242b 100644 --- a/hub/kojihub.py +++ b/hub/kojihub.py @@ -7582,9 +7582,10 @@ def delete_rpm_sig(rpminfo, sigkey=None, sighash=None): sigcachepathlist = [] signedpathlist = [] list_sigkeys = [] - if sigkey is not None: - sigcachepath = "%s/%s" % (builddir, koji.pathinfo.sighdr(rinfo, sigkey)) - signedpath = "%s/%s" % (builddir, koji.pathinfo.signed(rinfo, sigkey)) + + for rpmsig in rpm_query_result: + sigcachepath = "%s/%s" % (builddir, koji.pathinfo.sighdr(rinfo, rpmsig['sigkey'])) + signedpath = "%s/%s" % (builddir, koji.pathinfo.signed(rinfo, rpmsig['sigkey'])) for path in [sigcachepath, signedpath]: try: os.remove(path) @@ -7592,21 +7593,8 @@ def delete_rpm_sig(rpminfo, sigkey=None, sighash=None): logger.warning("Error when deleting %s file" % (path)) signedpathlist.append(signedpath) sigcachepathlist.append(sigcachepath) - if sigkey != '': - list_sigkeys = [sigkey] - else: - for rpmsig in rpm_query_result: - sigcachepath = "%s/%s" % (builddir, koji.pathinfo.sighdr(rinfo, rpmsig['sigkey'])) - signedpath = "%s/%s" % (builddir, koji.pathinfo.signed(rinfo, rpmsig['sigkey'])) - for path in [sigcachepath, signedpath]: - try: - os.remove(path) - except OSError: - logger.warning("Error when deleting %s file" % (path)) - signedpathlist.append(signedpath) - sigcachepathlist.append(sigcachepath) - if rpmsig['sigkey'] not in list_sigkeys: - list_sigkeys.append(rpmsig['sigkey']) + if rpmsig['sigkey'] not in list_sigkeys: + list_sigkeys.append(rpmsig['sigkey']) for path in list(set(sigcachepathlist + signedpathlist)): basedir = os.path.dirname(path)