diff --git a/pisi/api.py b/pisi/api.py index ab6ae9e4..81586a2e 100644 --- a/pisi/api.py +++ b/pisi/api.py @@ -384,6 +384,7 @@ def fetch(packages=[], path=os.path.curdir): repodb = pisi.db.repodb.RepoDB() for name in packages: package, repo = packagedb.get_package_repo(name) + ctx.ui.info(_("%s package found in %s repository") % (package.name, repo)) uri = pisi.uri.URI(package.packageURI) if uri.is_absolute_path(): url = str(pkg_uri) diff --git a/pisi/cli/fetch.py b/pisi/cli/fetch.py new file mode 100644 index 00000000..571085c1 --- /dev/null +++ b/pisi/cli/fetch.py @@ -0,0 +1,56 @@ +# -*- coding:utf-8 -*- +# +# Copyright (C) 2009, TUBITAK/UEKAE +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 of the License, or (at your option) +# any later version. +# +# Please read the COPYING file. +# + +import os +import optparse + +import gettext +__trans = gettext.translation('pisi', fallback=True) +_ = __trans.ugettext + +import pisi.cli.command as command +import pisi.context as ctx +import pisi.api + +class Fetch(command.Command): + __doc__ = _("""Fetch a package + +Usage: fetch [ ... ] + +: package name + +Downloads the given pisi packages to working directory +""") + __metaclass__ = command.autocommand + + def __init__(self,args): + super(Fetch, self).__init__(args) + + name = ("fetch", "fc") + + def options(self): + group = optparse.OptionGroup(self.parser, _("fetch options")) + self.add_options(group) + self.parser.add_option_group(group) + + def add_options(self, group): + group.add_option("-o", "--output-dir", action="store", default=os.path.curdir, + help=_("Output directory for the fetched packages")) + + def run(self): + self.init(database = False, write = False) + + if not self.args: + self.help() + return + + pisi.api.fetch(self.args, ctx.config.options.output_dir) diff --git a/pisi/cli/pisicli.py b/pisi/cli/pisicli.py index 00faa74e..53260169 100644 --- a/pisi/cli/pisicli.py +++ b/pisi/cli/pisicli.py @@ -29,6 +29,7 @@ import pisi.cli.configurepending import pisi.cli.deletecache import pisi.cli.delta import pisi.cli.emerge +import pisi.cli.fetch import pisi.cli.graph import pisi.cli.index import pisi.cli.info