From 6bc980d843dc00413c11a1cfaf4703eabcdfd50e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eray=20=C3=96zkural?= Date: Sat, 18 Jun 2005 22:30:22 +0000 Subject: [PATCH] * oops, too early to do that --- bin/pisi | 2 ++ bin/pisi-build | 59 ++++++++++++++++++++++++++++++++++++++++++++++++ bin/pisi-install | 44 ++++++++++++++++++++++++++++++++++++ 3 files changed, 105 insertions(+) create mode 100644 bin/pisi-build create mode 100644 bin/pisi-install diff --git a/bin/pisi b/bin/pisi index 1391b7c0..8449541d 100755 --- a/bin/pisi +++ b/bin/pisi @@ -1,5 +1,7 @@ #!/usr/bin/python # -*- coding: utf-8 -*- +# This is the CLI for PISI client +# It uses an interface similar to cvs/svn # system modules import sys diff --git a/bin/pisi-build b/bin/pisi-build new file mode 100644 index 00000000..f2d1c505 --- /dev/null +++ b/bin/pisi-build @@ -0,0 +1,59 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- + +# python standard library +from os.path import basename +import sys + +sys.path.append("./lib") +import pisi.context +import pisi.util +from pisi.build import PisiBuild, PisiBuildError + +def usage(progname = "pisi-build"): + print """ +Usage: +%s [options] package-name.pspec +""" %(progname) + +def main(): + import sys + import getopt + + # wrapper for usage(progname) function + help = lambda: usage(sys.argv[0]) + + # getopt magic + try: + opts, args = getopt.getopt(sys.argv[1:],"h",["help"]) + except getopt.GetoptError: + help() + sys.exit(1) + + for opt, arg in opts: + if opt == "-h": + help() + sys.exit(1) + + # pspec(PISI Spec) to be used for package + pspec = "" + + # TODO: We accept only one pspec file (at a time) currently, + # but pisi-build may build many packages (pspecs given in order) + # sequentially. + if len(args) != 1: + help() + raise PisiBuildError, "pisi-build expects one (and only one) pspec file currently" + else: + pspec = args[0] + + # What we need to do first is create a context with our specfile + ctx = pisi.context.Context(pspec) + + # don't do the real job here. this is just a CLI! + pb = PisiBuild(ctx) + pb.build() + + +if __name__ == "__main__": + main() diff --git a/bin/pisi-install b/bin/pisi-install new file mode 100644 index 00000000..5cd24d89 --- /dev/null +++ b/bin/pisi-install @@ -0,0 +1,44 @@ +#! /usr/bin/python +# -*- coding: utf-8 -*- + +# sys modules +import sys +from optparse import OptionParser + +sys.path.append("./lib") +import pisi.install +import pisi.util + +class ArgError(Exception): + pass + +def main(): + + usage = "usage: %prog [options] " + parser = OptionParser(usage=usage,version="%prog " + pisi.__version__) + parser.add_option("-D", "--destdir", action="store") + parser.add_option("-v", "--verbose", action="store_true", + dest="verbose", default=False, + help="detailed output") + parser.add_option("-d", "--debug", action="store_true", default=True) + parser.add_option("-n", "--dry-run", action="store_true", + default = "do not perform any action, just show what\ + would be done") + + (options, args) = parser.parse_args() + + # package filename + package_fn = "" + + # TODO: We accept only one package file arg ATM + if len(args) != 1: + print usage + raise ArgError, "pisi-install expects one (and only one) package file currently" + else: + package_fn = args[0] + + pisi.install.install_package_file(package_fn) + + +if __name__ == "__main__": + main()