| |
@@ -58,15 +58,15 @@
|
| |
sourcemotif = re.compile(r"Package:\s+%s\n" % name)
|
| |
result = sourcemotif.search(content)
|
| |
if result is not None:
|
| |
- log.info("Package found in : %s" % url)
|
| |
+ log.info("Package found in : %s", url)
|
| |
versionmotif = re.compile(r"Package:\s+%s\nVersion:(.*)" % name)
|
| |
version = versionmotif.search(content).group(1).strip()
|
| |
return (version)
|
| |
else:
|
| |
- log.info("Not Found: %s in %s" % (name, url))
|
| |
+ log.info("Not Found: %s in %s", name, url)
|
| |
except IOError as ex:
|
| |
print('Could not contact the repository at url: %s' % url)
|
| |
- log.debug('Error: %s' % ex)
|
| |
+ log.debug('Error: %s', ex)
|
| |
return None
|
| |
|
| |
|
| |
@@ -138,7 +138,7 @@
|
| |
|
| |
url = self.source0.rsplit('/', 1)[0]
|
| |
url = '%s/%s' % (url, self.source)
|
| |
- self.log.info('Downloading %s' % url)
|
| |
+ self.log.info('Downloading %s', url)
|
| |
|
| |
remotefile = urllib_request.urlopen(url)
|
| |
with open(sources, 'wb') as localfile:
|
| |
@@ -148,14 +148,14 @@
|
| |
""" Extract the sources into the current directory. """
|
| |
sourcedir = get_rpm_tag('_sourcedir')
|
| |
tarball = "%s/%s" % (sourcedir, self.source)
|
| |
- self.log.info("Opening: %s" % tarball)
|
| |
+ self.log.info("Opening: %s", tarball)
|
| |
try:
|
| |
tar = tarfile.open(tarball)
|
| |
tar.extractall()
|
| |
tar.close()
|
| |
except TarError as err:
|
| |
self.log.debug("Error while extracting the tarball")
|
| |
- self.log.debug("ERROR: %s" % err)
|
| |
+ self.log.debug("ERROR: %s", err)
|
| |
|
| |
def get(self, key):
|
| |
""" Retrieve the given key from the description information known
|
| |
@@ -175,7 +175,7 @@
|
| |
from in them.
|
| |
"""
|
| |
description = '%s/DESCRIPTION' % self.name
|
| |
- self.log.info('Loading "%s"' % description)
|
| |
+ self.log.info('Loading "%s"', description)
|
| |
if os.path.exists(self.name) and os.path.isfile(description):
|
| |
try:
|
| |
stream = open(description, 'r')
|
| |
@@ -183,9 +183,9 @@
|
| |
stream.close()
|
| |
except IOError as err:
|
| |
self.log.info(
|
| |
- 'An error occured while reading the DESCRIPTION file: %s' \
|
| |
- % description)
|
| |
- self.log.debug('ERROR: %s' % err)
|
| |
+ 'An error occurred while reading the DESCRIPTION file: %s',
|
| |
+ description)
|
| |
+ self.log.debug('ERROR: %s', err)
|
| |
key = None
|
| |
for row in content.split('\n'):
|
| |
if row.strip():
|
| |
@@ -197,8 +197,8 @@
|
| |
self.description[key] = self.description[key] + ' ' + \
|
| |
row.strip()
|
| |
else:
|
| |
- self.log.info('Could not find a DESCRIPTION file "%s" to read' \
|
| |
- % description)
|
| |
+ self.log.info('Could not find a DESCRIPTION file "%s" to read',
|
| |
+ description)
|
| |
|
| |
def read_config(self):
|
| |
""" Read the general configuration containing the repo information
|
| |
@@ -212,13 +212,13 @@
|
| |
""" Remove the source we extracted in the current working
|
| |
directory.
|
| |
"""
|
| |
- self.log.info('Removing extracted sources: "%s"' % self.name)
|
| |
+ self.log.info('Removing extracted sources: "%s"', self.name)
|
| |
try:
|
| |
shutil.rmtree(self.name)
|
| |
except (IOError, OSError) as err:
|
| |
- self.log.info('Could not remove the extracted sources: "%s"'\
|
| |
- % self.name)
|
| |
- self.log.debug('ERROR: %s' % err)
|
| |
+ self.log.info('Could not remove the extracted sources: "%s"',
|
| |
+ self.name)
|
| |
+ self.log.debug('ERROR: %s', err)
|
| |
|
| |
def search_package_in_repo(self):
|
| |
""" Search a package in all R repositories listed in the general
|
| |
@@ -235,8 +235,8 @@
|
| |
break
|
| |
if version is None:
|
| |
self.log.info(
|
| |
- 'Could not find package "%s" in any of the congifure repos' \
|
| |
- % self.name)
|
| |
+ 'Could not find package "%s" in any of the configured repos',
|
| |
+ self.name)
|
| |
raise R2specError(
|
| |
'Could not find package "%s" in any of the configured repos' \
|
| |
% self.name)
|
| |
The log methods are supposed to do the interpolation for you. This saves
a bit of work if there's no output.