Add fetch command...
faik@pluto ~ $ pisi fetch amsn amsn package found in pardus-2009 repository amsn-0.98b_11234-25-5.pisi (3.5 MB)100% 1.88 MB/s [00:00:00] [tamamlandı] or pisi fetch -o output_dir amsn
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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 [<package1> <package2> ... <packagen>]
|
||||
|
||||
<packagei>: 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)
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user