* calistirtirt

This commit is contained in:
Eray Özkural
2005-07-18 12:19:49 +00:00
parent 65b4b98b7a
commit 39454ee886
6 changed files with 53 additions and 37 deletions
+9 -1
View File
@@ -1,3 +1,11 @@
import sys
from optparse import OptionParser
import pisi
from pisi.config import config
import pisi.operations
from pisi.purl import PUrl
from common import *
# helper functions
def cmdObject(cmd, fail=False):
commands = {"help": Help,
@@ -22,7 +30,7 @@ class Command(object):
"""generic help string for any command"""
def __init__(self):
# now for the real parser
self.parser = OptionParser(usage=usage_text,
self.parser = OptionParser(usage="",
version="%prog " + pisi.__version__)
self.options()
self.parser = commonopts(self.parser)
+33
View File
@@ -0,0 +1,33 @@
usage_text = """%prog <command> [options] [arguments]
where <command> is one of:
help
build
index
info
install
remove
updatedb
Use \"%prog help <command>\" for help on a specific subcommand.
PISI Package Manager
"""
def commonopts(parser):
p = parser
p.add_option("-D", "--destdir", action="store")
p.add_option("-u", "--username", action="store")
p.add_option("-p", "--password", action="store")
p.add_option("-P", action="store_true", dest="getpass", default=False,
help="Get password from the command line")
p.add_option("-v", "--verbose", action="store_true",
dest="verbose", default=False,
help="detailed output")
p.add_option("-d", "--debug", action="store_true",
default=True, help="show debugging information")
p.add_option("-n", "--dry-run", action="store_true", default=False,
help = "do not perform any action, just show what\
would be done")
return p
+1 -34
View File
@@ -7,43 +7,10 @@ import pisi
from pisi.config import config
import pisi.operations
from pisi.purl import PUrl
from common import *
from commands import *
# globals
usage_text = """%prog <command> [options] [arguments]
where <command> is one of:
help
build
index
info
install
remove
updatedb
Use \"%prog help <command>\" for help on a specific subcommand.
PISI Package Manager
"""
def commonopts(parser):
p = parser
p.add_option("-D", "--destdir", action="store")
p.add_option("-u", "--username", action="store")
p.add_option("-p", "--password", action="store")
p.add_option("-P", action="store_true", dest="getpass", default=False,
help="Get password from the command line")
p.add_option("-v", "--verbose", action="store_true",
dest="verbose", default=False,
help="detailed output")
p.add_option("-d", "--debug", action="store_true",
default=True, help="show debugging information")
p.add_option("-n", "--dry-run", action="store_true", default=False,
help = "do not perform any action, just show what\
would be done")
return p
+7
View File
@@ -50,6 +50,13 @@ class InstallDB:
else:
return False
def list_installed(self):
l = []
for (pkg, (status,version,release)) in self.d.iteritems():
if status=='i':
l.append(pkg)
return l
def get_version(self, pkg):
pkg = str(pkg)
(status, version, release) = self.d[pkg]
+3 -1
View File
@@ -14,4 +14,6 @@ def remove(package_name):
from install import Installer
def install(package_name):
Installer
i = Installer(package_name), i.install()
-1
View File
@@ -75,7 +75,6 @@ class Package:
# extract control files
self.package.extract_PISI_files(tmpdir)
filesxml =
self.metadata = MetaData()
self.metadata.read( join(tmpdir, config.metadata_xml) )
if not metadata.verify():