From f01960d719ca0216c2da7dc9b66a1567a09b14bf Mon Sep 17 00:00:00 2001 From: Nils Philippsen Date: Mon, 25 Nov 2019 17:57:17 +0100 Subject: [PATCH] allow lazy expansion of log format strings Signed-off-by: Nils Philippsen --- distgit_bugzilla_sync/package_summaries.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/distgit_bugzilla_sync/package_summaries.py b/distgit_bugzilla_sync/package_summaries.py index 1ad2e82..ca275d6 100644 --- a/distgit_bugzilla_sync/package_summaries.py +++ b/distgit_bugzilla_sync/package_summaries.py @@ -33,8 +33,7 @@ log = logging.getLogger(__name__) def download_db(name, repomd_url, archive): - log.info('%s Downloading file: %s to %s' % ( - name.ljust(12), repomd_url, archive)) + log.info('%-12s Downloading file: %s to %s', name, repomd_url, archive) response = requests.get(repomd_url, verify=True) with open(archive, 'wb') as stream: stream.write(response.content) @@ -42,7 +41,7 @@ def download_db(name, repomd_url, archive): def decompress_db(name, archive, location): ''' Decompress the given archive at the specified location. ''' - log.info('%s Extracting %s to %s' % (name.ljust(12), archive, location)) + log.info('%-12s Extracting %s to %s', name, archive, location) if archive.endswith('.xz'): import lzma with contextlib.closing(lzma.LZMAFile(archive)) as stream_xz: @@ -140,8 +139,8 @@ def get_primary_xml(destfolder, url, name): # Have we downloaded this before? Did it change? destfile = os.path.join(destfolder, db) - if not needs_update(destfile, shasum, shatype): - log.debug('%s No change of %s' % (name.ljust(12), repomd_url)) + if not needs_update(destfile, hash_digest, hash_type): + log.debug('%s No change of %s', name.ljust(12), repomd_url) else: # If it has changed, then download it and move it into place. archive = os.path.join(destfolder, filename)