From bdb6950b0ac30151c07972245e426cb0dcb2f62a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Metin?= Date: Wed, 8 Jun 2005 13:49:54 +0000 Subject: [PATCH] =?UTF-8?q?taslak=20pisi-build=20=C5=9Feysi?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pisi-build.py | 70 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 src/pisi-build.py diff --git a/src/pisi-build.py b/src/pisi-build.py new file mode 100644 index 00000000..4fb4c8fb --- /dev/null +++ b/src/pisi-build.py @@ -0,0 +1,70 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- + +from specfile import SpecFile +import fetcher +import archive +import pisipackage +import pisiutils # patch, fileutils? + +class PisiBuildError(Exception): + pass + +class PisiBuild: + """PisiBuild class, provides the package build and creation rutines""" + def __init__(self, pspecfile): + self.pspecfile = pspecfile + self.pspec = SpecFile(pspecfile) + # pspec.getTag("tagname"), pspec.getAttribute("tagname","attribute"), vs. + # fonksiyonları olacak bu amcanın + +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 excepts one (and only one) pspec file currently" + else: + pspec = args[0] + + + # doing the real job... vs. vs... + pb = PisiBuild(pspec) + pb.fetchArchive() + pb.unpackArchive() + pb.applyPatches() + pb.buildSource() + pb.installTarget() + pb.buildPisiPackage() + + +if __name__ == "__main__": + main()