diff options
author | 2010-08-01 15:21:22 -0300 | |
---|---|---|
committer | 2010-08-01 15:21:22 -0300 | |
commit | b76468ce4c9c0750bce281ff512e18fa683d8c13 (patch) | |
tree | b14709031b600fde5276079a47da328473d23aca | |
parent | moved overlay_bootstrap() from g_octave.config to g_octave.package_manager (diff) | |
download | g-octave-b76468ce4c9c0750bce281ff512e18fa683d8c13.tar.gz g-octave-b76468ce4c9c0750bce281ff512e18fa683d8c13.tar.bz2 g-octave-b76468ce4c9c0750bce281ff512e18fa683d8c13.zip |
added the option --oneshot to the main script
-rw-r--r-- | g_octave/package_manager.py | 22 | ||||
-rwxr-xr-x | scripts/g-octave | 16 |
2 files changed, 26 insertions, 12 deletions
diff --git a/g_octave/package_manager.py b/g_octave/package_manager.py index 0d48669..a8a482a 100644 --- a/g_octave/package_manager.py +++ b/g_octave/package_manager.py @@ -71,12 +71,13 @@ class Portage(Base): '# emerge -av --depclean', ] - def __init__(self, ask=False, verbose=False, pretend=False, nocolor=False): + def __init__(self, ask=False, verbose=False, pretend=False, oneshot=False, nocolor=False): self.overlay_bootstrap() self._fullcommand = [self._client] ask and self._fullcommand.append('--ask') verbose and self._fullcommand.append('--verbose') pretend and self._fullcommand.append('--pretend') + oneshot and self._fullcommand.append('--oneshot') nocolor and self._fullcommand.append('--color=n') def run_command(self, command): @@ -133,11 +134,12 @@ class Pkgcore(Base): '# pmerge -av --clean', ] - def __init__(self, ask=False, verbose=False, pretend=False, nocolor=False): + def __init__(self, ask=False, verbose=False, pretend=False, oneshot=False, nocolor=False): self._fullcommand = [self._client] ask and self._fullcommand.append('--ask') verbose and self._fullcommand.append('--verbose') pretend and self._fullcommand.append('--pretend') + oneshot and self._fullcommand.append('--oneshot') nocolor and self._fullcommand.append('--nocolor') def run_command(self, command): @@ -186,8 +188,9 @@ class Paludis(Base): '# paludis --pretend --uninstall-unused', ] - def __init__(self, ask=False, verbose=False, pretend=False, nocolor=False): + def __init__(self, ask=False, verbose=False, pretend=False, oneshot=False, nocolor=False): self._fullcommand = [self._client] + self._oneshot = oneshot # paludis doesn't supports '--ask' if verbose: self._fullcommand += [ @@ -196,18 +199,21 @@ class Paludis(Base): '--show-package-descriptions', 'all', ] pretend and self._fullcommand.append('--pretend') + oneshot and self._fullcommand.append('--preserve-world') nocolor and self._fullcommand.append('--no-color') def run_command(self, command): return subprocess.call(self._fullcommand + command) def install_package(self, pkgatom, catpkg): - return self.run_command([ + cmd = [ '--install', - '--dl-upgrade', 'as-needed', - '--add-to-world-spec', catpkg, - pkgatom - ]) + '--dl-upgrade', 'as-needed' + ] + if not self._oneshot: + cmd += ['--add-to-world-spec', catpkg] + cmd.append(pkgatom) + return self.run_command(cmd) def uninstall_package(self, pkgatom, catpkg): return self.run_command(['--uninstall', pkgatom]) diff --git a/scripts/g-octave b/scripts/g-octave index 1e62439..b43435d 100755 --- a/scripts/g-octave +++ b/scripts/g-octave @@ -99,7 +99,15 @@ def main(): action = 'store_true', dest = 'verbose', default = False, - help = 'Portage makes a lot of noise.' + help = 'package manager\'s makes a lot of noise.' + ) + + parser.add_option( + '-1', '--oneshot', + action = 'store_true', + dest = 'oneshot', + default = False, + help = 'do not add the packages to the world file for later updating.' ) parser.add_option( @@ -205,13 +213,13 @@ def main(): if conf_prefetch.package_manager == 'portage': log.info('Your package manager is: Portage') - pkg_manager = Portage(options.ask, options.verbose, options.pretend, not options.colors) + pkg_manager = Portage(options.ask, options.verbose, options.pretend, options.oneshot, not options.colors) elif conf_prefetch.package_manager == 'pkgcore': log.info('Your package manager is: Pkgcore') - pkg_manager = Pkgcore(options.ask, options.verbose, options.pretend, not options.colors) + pkg_manager = Pkgcore(options.ask, options.verbose, options.pretend, options.oneshot, not options.colors) elif conf_prefetch.package_manager == 'paludis': log.info('Your package manager is: Paludis') - pkg_manager = Paludis(options.ask, options.verbose, options.pretend, not options.colors) + pkg_manager = Paludis(options.ask, options.verbose, options.pretend, options.oneshot, not options.colors) else: log.error('Invalid package manager: %s' % conf_prefetch.package_manager) out.eerror('Invalid package manager: %s' % conf_prefetch.package_manager) |