summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGunnar Wrobel <p@rdus.de>2008-11-14 21:10:46 +0000
committerGunnar Wrobel <p@rdus.de>2008-11-14 21:10:46 +0000
commite503b6215945a156465250a5b1fe71be698d9e26 (patch)
tree8b97feba6ac5e6d48a6a986f6fa3300dc392a25d
parent9a2684da6dec776f074def7e656736aec404a476 (diff)
downloadlayman-e503b6215945a156465250a5b1fe71be698d9e26.tar.gz
layman-e503b6215945a156465250a5b1fe71be698d9e26.tar.bz2
layman-e503b6215945a156465250a5b1fe71be698d9e26.zip
layman: pass --quiet flag down to the version control
system (#236165). http://bugs.gentoo.org/show_bug.cgi?id=236165
-rw-r--r--ChangeLog4
-rw-r--r--layman/action.py8
-rw-r--r--layman/db.py8
-rw-r--r--layman/overlays/bzr.py4
-rw-r--r--layman/overlays/cvs.py18
-rw-r--r--layman/overlays/darcs.py4
-rw-r--r--layman/overlays/git.py18
-rw-r--r--layman/overlays/mercurial.py4
-rw-r--r--layman/overlays/overlay.py4
-rw-r--r--layman/overlays/rsync.py11
-rw-r--r--layman/overlays/svn.py18
-rw-r--r--layman/overlays/tar.py4
12 files changed, 74 insertions, 31 deletions
diff --git a/ChangeLog b/ChangeLog
index 3d87c66..adcabf4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2008-11-14 Gunnar Wrobel <p@rdus.de>
+ * layman/*: layman: pass --quiet flag down to the version control
+ system (#236165).
+ http://bugs.gentoo.org/show_bug.cgi?id=236165
+
* layman/db.py (RemoteDB.path): Use the hashlib library (#237625).
http://bugs.gentoo.org/show_bug.cgi?id=237625
diff --git a/layman/action.py b/layman/action.py
index b472114..ece35ab 100644
--- a/layman/action.py
+++ b/layman/action.py
@@ -90,6 +90,8 @@ class Sync:
self.rdb = RemoteDB(config)
+ self.quiet = config['quiet']
+
self.selection = config['sync']
if config['sync_all'] or 'ALL' in self.selection:
@@ -118,7 +120,7 @@ class Sync:
'dding the overlay!')
try:
- self.db.sync(i)
+ self.db.sync(i, self.quiet)
success.append('Successfully synchronized overlay "' + i + '".')
except Exception, error:
warnings.append(
@@ -155,6 +157,8 @@ class Add:
self.rdb = RemoteDB(config)
+ self.quiet = config['quiet']
+
self.selection = config['add']
enc = sys.getfilesystemencoding()
@@ -178,7 +182,7 @@ class Add:
if overlay:
try:
- self.db.add(overlay)
+ self.db.add(overlay, self.quiet)
OUT.info('Successfully added overlay "' + i + '".', 2)
except Exception, error:
OUT.warn('Failed to add overlay "' + i + '".\nError was: '
diff --git a/layman/db.py b/layman/db.py
index 64b2421..8b469cc 100644
--- a/layman/db.py
+++ b/layman/db.py
@@ -60,7 +60,7 @@ class DB(Overlays):
OUT.debug('DB handler initiated', 6)
- def add(self, overlay):
+ def add(self, overlay, quiet = False):
'''
Add an overlay to the local list of overlays.
@@ -106,7 +106,7 @@ class DB(Overlays):
'''
if overlay.name not in self.overlays.keys():
- result = overlay.add(self.config['storage'])
+ result = overlay.add(self.config['storage'], quiet)
if result == 0:
if 'priority' in self.config.keys():
overlay.set_priority(self.config['priority'])
@@ -185,13 +185,13 @@ class DB(Overlays):
else:
raise Exception('No local overlay named "' + overlay.name + '"!')
- def sync(self, overlay_name):
+ def sync(self, overlay_name, quiet = False):
'''Synchronize the given overlay.'''
overlay = self.select(overlay_name)
if overlay:
- result = overlay.sync(self.config['storage'])
+ result = overlay.sync(self.config['storage'], quiet)
if result:
raise Exception('Syncing overlay "' + overlay_name +
'" returned status ' + str(result) + '!')
diff --git a/layman/overlays/bzr.py b/layman/overlays/bzr.py
index 8e8bb47..6bb6d2f 100644
--- a/layman/overlays/bzr.py
+++ b/layman/overlays/bzr.py
@@ -42,7 +42,7 @@ class BzrOverlay(Overlay):
binary_command = '/usr/bin/bzr'
- def add(self, base):
+ def add(self, base, quiet = False):
'''Add overlay.'''
self.supported()
@@ -50,7 +50,7 @@ class BzrOverlay(Overlay):
return self.cmd(self.binary_command + ' get "' + self.src + '/" "' +\
path([base, self.name]) + '"')
- def sync(self, base):
+ def sync(self, base, quiet = False):
'''Sync overlay.'''
self.supported()
diff --git a/layman/overlays/cvs.py b/layman/overlays/cvs.py
index 95f20ea..e36f758 100644
--- a/layman/overlays/cvs.py
+++ b/layman/overlays/cvs.py
@@ -49,22 +49,32 @@ class CvsOverlay(Overlay):
else:
self.subpath = ''
- def add(self, base):
+ def add(self, base, quiet = False):
'''Add overlay.'''
self.supported()
+ if quiet:
+ quiet_option = ' -q'
+ else:
+ quiet_option = ''
+
return self.cmd('cd "' + base + '" && CVSROOT="' + self.src + '" ' +
- self.binary + ' co -d "' + self.name
+ self.binary + quiet_option + ' co -d "' + self.name
+ '" "' + self.subpath + '"' )
- def sync(self, base):
+ def sync(self, base, quiet = False):
'''Sync overlay.'''
self.supported()
+ if quiet:
+ quiet_option = ' -q'
+ else:
+ quiet_option = ''
+
return self.cmd('cd "' + path([base, self.name]) + '" && ' +
- self.binary + ' update')
+ self.binary + quiet_option + ' update')
def supported(self):
'''Overlay type supported?'''
diff --git a/layman/overlays/darcs.py b/layman/overlays/darcs.py
index 56e6d91..82054af 100644
--- a/layman/overlays/darcs.py
+++ b/layman/overlays/darcs.py
@@ -41,7 +41,7 @@ class DarcsOverlay(Overlay):
binary_command = '/usr/bin/darcs'
- def add(self, base):
+ def add(self, base, quiet = False):
'''Add overlay.'''
self.supported()
@@ -49,7 +49,7 @@ class DarcsOverlay(Overlay):
return self.cmd(self.binary_command + ' get --partial "' + self.src +
'/" "' + path([base, self.name]) + '"')
- def sync(self, base):
+ def sync(self, base, quiet = False):
'''Sync overlay.'''
self.supported()
diff --git a/layman/overlays/git.py b/layman/overlays/git.py
index 3a149b5..1aa6739 100644
--- a/layman/overlays/git.py
+++ b/layman/overlays/git.py
@@ -40,25 +40,35 @@ class GitOverlay(Overlay):
binary_command = '/usr/bin/git'
- def add(self, base):
+ def add(self, base, quiet = False):
'''Add overlay.'''
self.supported()
+ if quiet:
+ quiet_option = '-q '
+ else:
+ quiet_option = ''
+
# http:// should get trailing slash, other protocols shouldn't
slash = ''
if self.src.split(':')[0] == 'http':
slash = '/'
- return self.cmd(self.binary_command + ' clone "' + self.src + slash
+ return self.cmd(self.binary_command + ' clone ' + quiet_option + '"' + self.src + slash
+ '" "' + path([base, self.name]) + '"')
- def sync(self, base):
+ def sync(self, base, quiet = False):
'''Sync overlay.'''
self.supported()
+ if quiet:
+ quiet_option = '-q '
+ else:
+ quiet_option = ''
+
return self.cmd('cd "' + path([base, self.name]) + '" && '
- + self.binary_command + ' pull')
+ + self.binary_command + ' pull' + quiet_option)
def supported(self):
'''Overlay type supported?'''
diff --git a/layman/overlays/mercurial.py b/layman/overlays/mercurial.py
index 3def5fc..d31b5e5 100644
--- a/layman/overlays/mercurial.py
+++ b/layman/overlays/mercurial.py
@@ -41,7 +41,7 @@ class MercurialOverlay(Overlay):
binary_command = '/usr/bin/hg'
- def add(self, base):
+ def add(self, base, quiet = False):
'''Add overlay.'''
self.supported()
@@ -49,7 +49,7 @@ class MercurialOverlay(Overlay):
return self.cmd(self.binary_command + ' clone "' + self.src + '/" "' +
path([base, self.name]) + '"')
- def sync(self, base):
+ def sync(self, base, quiet = False):
'''Sync overlay.'''
self.supported()
diff --git a/layman/overlays/overlay.py b/layman/overlays/overlay.py
index 51463db..d870afa 100644
--- a/layman/overlays/overlay.py
+++ b/layman/overlays/overlay.py
@@ -123,7 +123,7 @@ class Overlay:
return dict_to_node(self.data, document, 'overlay')
- def add(self, base):
+ def add(self, base, quiet = False):
'''Add the overlay.'''
mdir = path([base, self.name])
@@ -134,7 +134,7 @@ class Overlay:
os.makedirs(mdir)
- def sync(self, base):
+ def sync(self, base, quiet = False):
'''Sync the overlay.'''
pass
diff --git a/layman/overlays/rsync.py b/layman/overlays/rsync.py
index 18d563f..0f6c5f5 100644
--- a/layman/overlays/rsync.py
+++ b/layman/overlays/rsync.py
@@ -44,7 +44,7 @@ class RsyncOverlay(Overlay):
'--timeout=180 --exclude="distfiles/*" --exclude="local/*" ' + \
'--exclude="packages/*" '
- def add(self, base):
+ def add(self, base, quiet = False):
'''Add overlay.'''
self.supported()
@@ -53,12 +53,17 @@ class RsyncOverlay(Overlay):
return self.sync(base)
- def sync(self, base):
+ def sync(self, base, quiet = False):
'''Sync overlay.'''
self.supported()
- return self.cmd(self.base + '"' + self.src + '/" "' +
+ if quiet:
+ quiet_option = '-q '
+ else:
+ quiet_option = ''
+
+ return self.cmd(self.base + quiet_option + '"' + self.src + '/" "' +
path([base, self.name]) + '"')
def supported(self):
diff --git a/layman/overlays/svn.py b/layman/overlays/svn.py
index 5086448..421f8f1 100644
--- a/layman/overlays/svn.py
+++ b/layman/overlays/svn.py
@@ -40,22 +40,32 @@ class SvnOverlay(Overlay):
binary = '/usr/bin/svn'
- def add(self, base):
+ def add(self, base, quiet = False):
'''Add overlay.'''
self.supported()
Overlay.add(self, base)
- return self.cmd(self.binary + ' co "' + self.src + '/" "' +
+ if quiet:
+ quiet_option = '-q '
+ else:
+ quiet_option = ''
+
+ return self.cmd(self.binary + ' co ' + quiet_option + '"' + self.src + '/" "' +
path([base, self.name]) + '"')
- def sync(self, base):
+ def sync(self, base, quiet = False):
'''Sync overlay.'''
self.supported()
- return self.cmd(self.binary + ' update "' + path([base, self.name]) +
+ if quiet:
+ quiet_option = '-q '
+ else:
+ quiet_option = ''
+
+ return self.cmd(self.binary + ' up ' + quiet_option + '"' + path([base, self.name]) +
'"')
def supported(self):
diff --git a/layman/overlays/tar.py b/layman/overlays/tar.py
index ce89450..9ce488e 100644
--- a/layman/overlays/tar.py
+++ b/layman/overlays/tar.py
@@ -88,7 +88,7 @@ class TarOverlay(Overlay):
else:
self.category = ''
- def add(self, base):
+ def add(self, base, quiet = False):
'''Add overlay.'''
self.supported()
@@ -163,7 +163,7 @@ class TarOverlay(Overlay):
return result
- def sync(self, base):
+ def sync(self, base, quiet = False):
'''Sync overlay.'''
self.supported()