allow lazy expansion of log format strings
Signed-off-by: Nils Philippsen <nils@redhat.com>
This commit is contained in:
parent
6e574a5067
commit
f01960d719
1 changed files with 4 additions and 5 deletions
|
@ -33,8 +33,7 @@ log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def download_db(name, repomd_url, archive):
|
def download_db(name, repomd_url, archive):
|
||||||
log.info('%s Downloading file: %s to %s' % (
|
log.info('%-12s Downloading file: %s to %s', name, repomd_url, archive)
|
||||||
name.ljust(12), repomd_url, archive))
|
|
||||||
response = requests.get(repomd_url, verify=True)
|
response = requests.get(repomd_url, verify=True)
|
||||||
with open(archive, 'wb') as stream:
|
with open(archive, 'wb') as stream:
|
||||||
stream.write(response.content)
|
stream.write(response.content)
|
||||||
|
@ -42,7 +41,7 @@ def download_db(name, repomd_url, archive):
|
||||||
|
|
||||||
def decompress_db(name, archive, location):
|
def decompress_db(name, archive, location):
|
||||||
''' Decompress the given archive at the specified 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'):
|
if archive.endswith('.xz'):
|
||||||
import lzma
|
import lzma
|
||||||
with contextlib.closing(lzma.LZMAFile(archive)) as stream_xz:
|
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?
|
# Have we downloaded this before? Did it change?
|
||||||
destfile = os.path.join(destfolder, db)
|
destfile = os.path.join(destfolder, db)
|
||||||
if not needs_update(destfile, shasum, shatype):
|
if not needs_update(destfile, hash_digest, hash_type):
|
||||||
log.debug('%s No change of %s' % (name.ljust(12), repomd_url))
|
log.debug('%s No change of %s', name.ljust(12), repomd_url)
|
||||||
else:
|
else:
|
||||||
# If it has changed, then download it and move it into place.
|
# If it has changed, then download it and move it into place.
|
||||||
archive = os.path.join(destfolder, filename)
|
archive = os.path.join(destfolder, filename)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue