summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordol-sen <brian.dolbec@gmail.com>2011-08-21 02:19:09 -0700
committerdol-sen <brian.dolbec@gmail.com>2011-08-24 07:01:05 -0700
commitfb629bea7f7c19790078ec0b72acc7671f1ae2f3 (patch)
treee182204243f89e541f8384eee9986c37f43a4beb
parent2c9df94436e25e45f0324929ebdbf33a1aa1a2d5 (diff)
downloadlayman-fb629bea7f7c19790078ec0b72acc7671f1ae2f3.tar.gz
layman-fb629bea7f7c19790078ec0b72acc7671f1ae2f3.tar.bz2
layman-fb629bea7f7c19790078ec0b72acc7671f1ae2f3.zip
clean out nearly useless quiet parameter, use config['quiet'] instead.
-rwxr-xr-xlayman/api.py4
-rw-r--r--layman/db.py16
-rw-r--r--layman/dbbase.py7
-rw-r--r--layman/overlays/bzr.py8
-rw-r--r--layman/overlays/cvs.py12
-rw-r--r--layman/overlays/darcs.py8
-rw-r--r--layman/overlays/g_common.py10
-rw-r--r--layman/overlays/git.py12
-rw-r--r--layman/overlays/mercurial.py8
-rwxr-xr-xlayman/overlays/overlay.py23
-rw-r--r--layman/overlays/rsync.py10
-rw-r--r--layman/overlays/source.py14
-rw-r--r--layman/overlays/svn.py12
-rw-r--r--layman/overlays/tar.py16
14 files changed, 79 insertions, 81 deletions
diff --git a/layman/api.py b/layman/api.py
index 7894c56..5e624d1 100755
--- a/layman/api.py
+++ b/layman/api.py
@@ -146,7 +146,7 @@ class LaymanAPI(object):
success = False
try:
success = self._get_installed_db().add(
- self._get_remote_db().select(ovl), quiet=True)
+ self._get_remote_db().select(ovl))
except Exception, e:
self._error("Exception caught enabling repository '"+ovl+
"' : "+str(e))
@@ -357,7 +357,7 @@ class LaymanAPI(object):
try:
self.output.debug("API.sync(); starting db.sync(ovl)", 5)
- db.sync(ovl, self.config['quiet'])
+ db.sync(ovl)
success.append((ovl,'Successfully synchronized overlay "' + ovl + '".'))
except Exception, error:
fatals.append((ovl,
diff --git a/layman/db.py b/layman/db.py
index 08af0f6..17453b8 100644
--- a/layman/db.py
+++ b/layman/db.py
@@ -59,13 +59,13 @@ class DB(DbBase):
else:
ignore = 1
- quiet = int(config['quietness']) < 3
+ #quiet = int(config['quietness']) < 3
DbBase.__init__(self,
config,
paths=[config['local_list'], ],
ignore=ignore,
- quiet=quiet)
+ )
self.output.debug('DB handler initiated', 6)
@@ -73,7 +73,7 @@ class DB(DbBase):
def _broken_catalog_hint(self):
return ''
- def add(self, overlay, quiet = False):
+ def add(self, overlay):
'''
Add an overlay to the local list of overlays.
@@ -121,7 +121,7 @@ class DB(DbBase):
'''
if overlay.name not in self.overlays.keys():
- result = overlay.add(self.config['storage'], quiet)
+ result = overlay.add(self.config['storage'])
if result == 0:
if 'priority' in self.config.keys():
overlay.set_priority(self.config['priority'])
@@ -218,11 +218,11 @@ class DB(DbBase):
return False
return True
- def sync(self, overlay_name, quiet = False):
+ def sync(self, overlay_name):
'''Synchronize the given overlay.'''
overlay = self.select(overlay_name)
- result = overlay.sync(self.config['storage'], quiet)
+ result = overlay.sync(self.config['storage'])
if result:
raise Exception('Syncing overlay "' + overlay_name +
'" returned status ' + str(result) + '!' +
@@ -263,10 +263,10 @@ class RemoteDB(DbBase):
else:
ignore = 0
- quiet = int(config['quietness']) < 3
+ #quiet = int(config['quietness']) < 3
DbBase.__init__(self, config, paths=paths, ignore=ignore,
- quiet=quiet, ignore_init_read_errors=ignore_init_read_errors)
+ ignore_init_read_errors=ignore_init_read_errors)
# overrider
def _broken_catalog_hint(self):
diff --git a/layman/dbbase.py b/layman/dbbase.py
index 45be724..a31ced9 100644
--- a/layman/dbbase.py
+++ b/layman/dbbase.py
@@ -79,11 +79,10 @@ class DbBase(object):
''' Handle a list of overlays.'''
def __init__(self, config, paths=None, ignore = 0,
- quiet = False, ignore_init_read_errors=False
+ ignore_init_read_errors=False
):
self.config = config
- self.quiet = quiet
self.paths = paths
self.ignore = ignore
self.output = config['output']
@@ -157,7 +156,7 @@ class DbBase(object):
for overlay in overlays:
self.output.debug('Parsing overlay: %s' % overlay, 9)
ovl = Overlay(config=self.config, xml=overlay,
- ignore=self.ignore, quiet=self.quiet)
+ ignore=self.ignore)
self.overlays[ovl.name] = ovl
return
@@ -184,7 +183,7 @@ class DbBase(object):
for overlay in overlays:
self.output.debug('Parsing overlay entry', 8)
ovl = Overlay(self.config, ovl_dict=overlay,
- ignore=self.ignore, quiet=self.quiet)
+ ignore=self.ignore)
self.overlays[ovl.name] = ovl
return
diff --git a/layman/overlays/bzr.py b/layman/overlays/bzr.py
index 40e5b81..0fbd712 100644
--- a/layman/overlays/bzr.py
+++ b/layman/overlays/bzr.py
@@ -41,13 +41,13 @@ class BzrOverlay(OverlaySource):
type = 'Bzr'
type_key = 'bzr'
- def __init__(self, parent, config, _location, ignore = 0, quiet = False):
+ def __init__(self, parent, config, _location, ignore = 0):
super(BzrOverlay, self).__init__(parent,
- config, _location, ignore, quiet)
+ config, _location, ignore)
self.subpath = None
- def add(self, base, quiet = False):
+ def add(self, base):
'''Add overlay.'''
if not self.supported():
@@ -66,7 +66,7 @@ class BzrOverlay(OverlaySource):
self.run_command(self.command(), args, cmd=self.type),
cwd=target)
- def sync(self, base, quiet = False):
+ def sync(self, base):
'''Sync overlay.'''
if not self.supported():
diff --git a/layman/overlays/cvs.py b/layman/overlays/cvs.py
index c902250..883baa3 100644
--- a/layman/overlays/cvs.py
+++ b/layman/overlays/cvs.py
@@ -41,9 +41,9 @@ class CvsOverlay(OverlaySource):
type = 'cvs'
type_key = 'cvs'
- def __init__(self, parent, config, _location, ignore = 0, quiet = False):
+ def __init__(self, parent, config, _location, ignore = 0):
- super(CvsOverlay, self).__init__(parent, config, _location, ignore, quiet)
+ super(CvsOverlay, self).__init__(parent, config, _location, ignore)
self.subpath = None
@@ -63,7 +63,7 @@ class CvsOverlay(OverlaySource):
repo_elem.append(_subpath)
del _subpath
- def add(self, base, quiet = False):
+ def add(self, base):
'''Add overlay.'''
if not self.supported():
@@ -74,7 +74,7 @@ class CvsOverlay(OverlaySource):
# cvs [-q] co -d SOURCE SCOPE
args = []
- if quiet:
+ if self.config['quiet']:
args.append('-q')
args.append('co')
args.append('-d')
@@ -88,7 +88,7 @@ class CvsOverlay(OverlaySource):
env=dict(CVSROOT=self.src), cmd=self.type),
cwd=target)
- def sync(self, base, quiet = False):
+ def sync(self, base):
'''Sync overlay.'''
if not self.supported():
@@ -99,7 +99,7 @@ class CvsOverlay(OverlaySource):
# cvs [-q] update -d
args = []
- if quiet:
+ if self.config['quiet']:
args.append('-q')
args.append('update')
args.append('-d')
diff --git a/layman/overlays/darcs.py b/layman/overlays/darcs.py
index 3e24ebe..d3eec6a 100644
--- a/layman/overlays/darcs.py
+++ b/layman/overlays/darcs.py
@@ -40,13 +40,13 @@ class DarcsOverlay(OverlaySource):
type = 'Darcs'
type_key = 'darcs'
- def __init__(self, parent, config, _location, ignore = 0, quiet = False):
+ def __init__(self, parent, config, _location, ignore = 0):
super(DarcsOverlay, self).__init__(parent, config,
- _location, ignore, quiet)
+ _location, ignore)
self.subpath = None
- def add(self, base, quiet = False):
+ def add(self, base):
'''Add overlay.'''
if not self.supported():
@@ -67,7 +67,7 @@ class DarcsOverlay(OverlaySource):
self.run_command(self.command(), args, cmd=self.type),
cwd=target)
- def sync(self, base, quiet = False):
+ def sync(self, base):
'''Sync overlay.'''
if not self.supported():
diff --git a/layman/overlays/g_common.py b/layman/overlays/g_common.py
index cb162e8..5f0e9bc 100644
--- a/layman/overlays/g_common.py
+++ b/layman/overlays/g_common.py
@@ -38,15 +38,15 @@ class GCommonOverlay(OverlaySource):
type = 'g-common'
type_key = 'g-common'
- def __init__(self, parent, config, _location, ignore = 0, quiet = False):
+ def __init__(self, parent, config, _location, ignore = 0):
super(GCommonOverlay, self).__init__(parent, config,
- _location, ignore, quiet)
+ _location, ignore)
#split source into driver and remote uri.
self.driver=self.src[:self.src.find(' ')]
self.remote_uri=self.src[self.src.find(' ')+1:]
self.subpath = None
- def add(self, base, quiet = False):
+ def add(self, base):
'''Add overlay.'''
if not self.supported():
@@ -56,9 +56,9 @@ class GCommonOverlay(OverlaySource):
os.makedirs(target)
- return self.sync(base, quiet)
+ return self.sync(base)
- def sync(self, base, quiet = False):
+ def sync(self, base):
'''Sync overlay.'''
if not self.supported():
diff --git a/layman/overlays/git.py b/layman/overlays/git.py
index 64a0dfb..3cdc21e 100644
--- a/layman/overlays/git.py
+++ b/layman/overlays/git.py
@@ -39,12 +39,12 @@ class GitOverlay(OverlaySource):
type = 'Git'
type_key = 'git'
- def __init__(self, parent, config, _location, ignore = 0, quiet = False):
+ def __init__(self, parent, config, _location, ignore = 0):
super(GitOverlay, self).__init__(parent, config,
- _location, ignore, quiet)
+ _location, ignore)
self.subpath = None
- def add(self, base, quiet = False):
+ def add(self, base):
'''Add overlay.'''
if not self.supported():
@@ -61,7 +61,7 @@ class GitOverlay(OverlaySource):
# git clone [-q] SOURCE TARGET
args = ['clone']
- if quiet:
+ if self.config['quiet']:
args.append('-q')
if len(cfg_opts):
args.append(cfg_opts)
@@ -71,7 +71,7 @@ class GitOverlay(OverlaySource):
self.run_command(self.command(), args, cmd=self.type),
cwd=target)
- def sync(self, base, quiet = False):
+ def sync(self, base):
'''Sync overlay.'''
self.output.debug("git.sync(); starting...%s" % self.parent.name, 6)
@@ -82,7 +82,7 @@ class GitOverlay(OverlaySource):
target = path([base, self.parent.name])
args = ['pull']
- if quiet:
+ if self.config['quiet']:
args.append('-q')
if len(cfg_opts):
args.append(cfg_opts)
diff --git a/layman/overlays/mercurial.py b/layman/overlays/mercurial.py
index 5247e78..0d8250e 100644
--- a/layman/overlays/mercurial.py
+++ b/layman/overlays/mercurial.py
@@ -41,13 +41,13 @@ class MercurialOverlay(OverlaySource):
type_key = 'mercurial'
def __init__(self, parent, config,
- _location, ignore = 0, quiet = False):
+ _location, ignore = 0):
super(MercurialOverlay, self).__init__(parent,
- config, _location, ignore, quiet)
+ config, _location, ignore)
self.subpath = None
- def add(self, base, quiet = False):
+ def add(self, base):
'''Add overlay.'''
if not self.supported():
@@ -66,7 +66,7 @@ class MercurialOverlay(OverlaySource):
self.run_command(self.command(), args, cmd=self.type),
cwd=target)
- def sync(self, base, quiet = False):
+ def sync(self, base):
'''Sync overlay.'''
if not self.supported():
diff --git a/layman/overlays/overlay.py b/layman/overlays/overlay.py
index a14aa99..7eb76bb 100755
--- a/layman/overlays/overlay.py
+++ b/layman/overlays/overlay.py
@@ -73,8 +73,7 @@ class Overlay(object):
''' Derive the real implementations from this.'''
def __init__(self, config, xml=None, ovl_dict=None,
- ignore = 0, quiet = False
- ):
+ ignore = 0):
'''
>>> here = os.path.dirname(os.path.realpath(__file__))
>>> import xml.etree.ElementTree as ET # Python 2.5
@@ -104,12 +103,12 @@ class Overlay(object):
self._encoding_ = get_encoding(self.output)
if xml is not None:
- self.from_xml(xml, ignore, quiet)
+ self.from_xml(xml, ignore)
elif ovl_dict is not None:
- self.from_dict(ovl_dict, ignore, quiet)
+ self.from_dict(ovl_dict, ignore)
- def from_xml(self, xml, ignore, quiet):
+ def from_xml(self, xml, ignore):
"""Process an xml overlay definition
"""
def strip_text(node):
@@ -147,7 +146,7 @@ class Overlay(object):
'Unknown overlay type "%s"!' % _type)
_location = ensure_unicode(strip_text(source_elem))
return _class(parent=self, config=self.config,
- _location=_location, ignore=ignore, quiet=quiet)
+ _location=_location, ignore=ignore)
if not len(_sources):
raise Exception('Overlay from_xml(), "' + self.name + \
@@ -236,7 +235,7 @@ class Overlay(object):
self.irc = None
- def from_dict(self, overlay, ignore, quiet):
+ def from_dict(self, overlay, ignore):
"""Process an xml overlay definition
"""
self.output.debug("Overlay from_dict(); overlay" + str(overlay))
@@ -262,7 +261,7 @@ class Overlay(object):
'Unknown overlay type "%s"!' % _type)
_location = ensure_unicode(_src)
return _class(parent=self, config=self.config,
- _location=_location, ignore=ignore, quiet=quiet)
+ _location=_location, ignore=ignore)
self.sources = [create_dict_overlay_source(e) for e in _sources]
@@ -401,14 +400,14 @@ class Overlay(object):
return repo
- def add(self, base, quiet = False):
+ def add(self, base):
res = 1
first_s = True
for s in self.sources:
if not first_s:
self.output.info("\nTrying next source of listed sources...", 4)
try:
- res = s.add(base, quiet)
+ res = s.add(base)
if res == 0:
# Worked, throw other sources away
self.sources = [s]
@@ -419,10 +418,10 @@ class Overlay(object):
return res
- def sync(self, base, quiet = False):
+ def sync(self, base):
self.output.debug("overlay.sync(); name = %s" % self.name, 4)
assert len(self.sources) == 1
- return self.sources[0].sync(base, quiet)
+ return self.sources[0].sync(base)
def delete(self, base):
diff --git a/layman/overlays/rsync.py b/layman/overlays/rsync.py
index 3c03ae2..f87a7e0 100644
--- a/layman/overlays/rsync.py
+++ b/layman/overlays/rsync.py
@@ -40,13 +40,13 @@ class RsyncOverlay(OverlaySource):
type_key = 'rsync'
- def __init__(self, parent, config, _location, ignore = 0, quiet = False):
+ def __init__(self, parent, config, _location, ignore = 0):
super(RsyncOverlay, self).__init__(parent, config,
- _location, ignore, quiet)
+ _location, ignore)
self.subpath = None
- def add(self, base, quiet = False):
+ def add(self, base):
'''Add overlay.'''
if not self.supported():
@@ -56,7 +56,7 @@ class RsyncOverlay(OverlaySource):
return self.sync(base)
- def sync(self, base, quiet = False):
+ def sync(self, base):
'''Sync overlay.'''
if not self.supported():
@@ -70,7 +70,7 @@ class RsyncOverlay(OverlaySource):
cfg_opts = self.config["rsync_syncopts"]
target = path([base, self.parent.name])
- if quiet:
+ if self.config['quiet']:
args.append('-q')
if len(cfg_opts):
args.append(cfg_opts)
diff --git a/layman/overlays/source.py b/layman/overlays/source.py
index 3e685e2..03bccc4 100644
--- a/layman/overlays/source.py
+++ b/layman/overlays/source.py
@@ -66,12 +66,11 @@ class OverlaySource(object):
type_key = None
def __init__(self, parent, config, _location,
- ignore = 0, quiet = False):
+ ignore = 0):
self.parent = parent
self.src = _location
self.config = config
self.ignore = ignore
- self.quiet = quiet
self.output = config['output']
@@ -81,7 +80,7 @@ class OverlaySource(object):
def __ne__(self, other):
return not self.__eq__(other)
- def add(self, base, quiet = False):
+ def add(self, base):
'''Add the overlay.'''
mdir = path([base, self.parent.name])
@@ -94,7 +93,7 @@ class OverlaySource(object):
os.makedirs(mdir)
return True
- def sync(self, base, quiet = False):
+ def sync(self, base):
'''Sync the overlay.'''
pass
@@ -151,7 +150,8 @@ class OverlaySource(object):
cmd = kwargs.get('cmd', '')
self.output.info('Running %s... # %s' % (cmd, command_repr), 2)
- if self.quiet:
+ if self.config['quiet']:
+
input_source = subprocess.PIPE
output_target = open('/dev/null', 'w')
else:
@@ -166,7 +166,7 @@ class OverlaySource(object):
cwd=cwd,
env=env)
- if self.quiet:
+ if self.config['quiet']:
# Make child non-interactive
proc.stdin.close()
@@ -183,7 +183,7 @@ class OverlaySource(object):
self.output.error('Original error was: %s' % str(err), 2)
result = 1
- if self.quiet:
+ if self.config['quiet']:
output_target.close()
if result:
diff --git a/layman/overlays/svn.py b/layman/overlays/svn.py
index b9a5a34..3e5497c 100644
--- a/layman/overlays/svn.py
+++ b/layman/overlays/svn.py
@@ -40,13 +40,13 @@ class SvnOverlay(OverlaySource):
type_key = 'svn'
def __init__(self, parent, config, _location,
- ignore = 0, quiet = False):
+ ignore = 0):
super(SvnOverlay, self).__init__(
- parent, config, _location, ignore, quiet)
+ parent, config, _location, ignore)
self.subpath = None
- def add(self, base, quiet = False):
+ def add(self, base):
'''Add overlay.'''
if not self.supported():
@@ -58,7 +58,7 @@ class SvnOverlay(OverlaySource):
self.target = path([base, self.parent.name])
args = ['co']
- if quiet:
+ if self.config['quiet']:
args.append('-q')
if len(cfg_opts):
args.append(cfg_opts)
@@ -69,7 +69,7 @@ class SvnOverlay(OverlaySource):
self.run_command(self.command(), args, cmd=self.type),
cwd=self.target)
- def sync(self, base, quiet = False):
+ def sync(self, base):
'''Sync overlay.'''
if not self.supported():
@@ -88,7 +88,7 @@ class SvnOverlay(OverlaySource):
# svn up [-q] TARGET
args = ['up']
- if quiet:
+ if self.config['quiet']:
args.append('-q')
if len(cfg_opts):
args.append(cfg_opts)
diff --git a/layman/overlays/tar.py b/layman/overlays/tar.py
index f061ad6..6fd5ba8 100644
--- a/layman/overlays/tar.py
+++ b/layman/overlays/tar.py
@@ -62,7 +62,7 @@ class TarOverlay(OverlaySource):
>>> testdir = os.tmpnam()
>>> os.mkdir(testdir)
>>> from layman.overlays.overlay import Overlay
- >>> a = Overlay(config, repo, quiet=False)
+ >>> a = Overlay(config, repo)
>>> config['output'].set_colorize(False)
>>> a.add(testdir)
0
@@ -76,10 +76,10 @@ class TarOverlay(OverlaySource):
type = 'Tar'
type_key = 'tar'
- def __init__(self, parent, config, _location, ignore = 0, quiet = False):
+ def __init__(self, parent, config, _location, ignore = 0):
super(TarOverlay, self).__init__(parent,
- config, _location, ignore, quiet)
+ config, _location, ignore)
self.output = config['output']
self.subpath = None
@@ -132,7 +132,7 @@ class TarOverlay(OverlaySource):
os.unlink(pkg)
return result
- def _add_unchecked(self, base, quiet):
+ def _add_unchecked(self, base):
def try_to_wipe(folder):
if not os.path.exists(folder):
return
@@ -177,7 +177,7 @@ class TarOverlay(OverlaySource):
try_to_wipe(temp_path)
return result
- def add(self, base, quiet = False):
+ def add(self, base):
'''Add overlay.'''
if not self.supported():
@@ -190,10 +190,10 @@ class TarOverlay(OverlaySource):
' Will not overwrite its contents!')
return self.postsync(
- self._add_unchecked(base, quiet),
+ self._add_unchecked(base),
cwd=target)
- def sync(self, base, quiet = False):
+ def sync(self, base):
'''Sync overlay.'''
if not self.supported():
@@ -202,7 +202,7 @@ class TarOverlay(OverlaySource):
target = path([base, self.parent.name])
return self.postsync(
- self._add_unchecked(base, quiet),
+ self._add_unchecked(base),
cwd=target)
def supported(self):