From 0c3ccec5afa30fb7d078fbb723cfbbb0158f12d7 Mon Sep 17 00:00:00 2001 From: Faik Uygur Date: Fri, 26 Jan 2007 22:08:47 +0000 Subject: [PATCH] Ahmet's request: Do not open database with write access for --fetch-only. This way when only fetching packages for install or upgrade, pisi can be used to install, build or emerge other packages. --- pisi/cli/commands.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/pisi/cli/commands.py b/pisi/cli/commands.py index 53374e56..03f32995 100644 --- a/pisi/cli/commands.py +++ b/pisi/cli/commands.py @@ -555,8 +555,8 @@ class PackageOp(Command): group.add_option("-n", "--dry-run", action="store_true", default=False, help = _("Do not perform any action, just show what would be done")) - def init(self): - super(PackageOp, self).init(True) + def init(self, database=True, write=True): + super(PackageOp, self).init(database, write) def finalize(self): #self.finalize_db() @@ -599,7 +599,11 @@ expanded to package names. self.parser.add_option_group(group) def run(self): - self.init() + + if self.options.fetch_only: + self.init(database=True, write=False) + else: + self.init() components = ctx.get_option('component') if not components and not self.args: @@ -700,7 +704,11 @@ expanded to package names. return list(packages) def run(self): - self.init() + + if self.options.fetch_only: + self.init(database=True, write=False) + else: + self.init() if not ctx.get_option('bypass_update_repo'): ctx.ui.info(_('Updating repositories'))