From 321f0371dc7aeabf007767d77edbbb55a4a535f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Metin?= Date: Fri, 29 Jul 2005 09:46:54 +0000 Subject: [PATCH] =?UTF-8?q?yeni=20komutlar,=20action'lar=20ayr=C4=B1=20ayr?= =?UTF-8?q?=C4=B1=20b=C3=B6l=C3=BCn=C3=BCyor...=20Bu=20i=C5=9Fi=20yapan=20?= =?UTF-8?q?kod=20epey=20=C3=A7irkin=20=C5=9Fu=20anda.=20aray=C3=BCz=C3=BCn?= =?UTF-8?q?=20nas=C4=B1l=20olaca=C4=9F=C4=B1na=20karar=20verelim=20onu=20d?= =?UTF-8?q?=C3=BCzeltirim.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pisi/build.py | 24 ++++++++++++------- pisi/cli/commands.py | 56 +++++++++++++++++++++++++++++++++++++------- pisi/cli/common.py | 4 +++- pisi/toplevel.py | 23 ++++++++++++++++-- 4 files changed, 88 insertions(+), 19 deletions(-) diff --git a/pisi/build.py b/pisi/build.py index cbcb6fac..50b680f2 100644 --- a/pisi/build.py +++ b/pisi/build.py @@ -94,7 +94,9 @@ class PisiBuild: # apply the patches and prepare a source directory for build. self.applyPatches() - self.runActions() + self.runSetupAction() + self.runBuildAction() + self.runInstallAction() # after all, we are ready to build/prepare the packages self.buildPackages() @@ -123,22 +125,20 @@ class PisiBuild: self.sourceArchive.unpack() ui.info(" unpacked (%s)\n" % self.ctx.pkg_work_dir()) - def runActions(self): - # we'll need our working directory after actionscript - # finished its work in the archive source directory. - curDir = os.getcwd() - os.chdir(self.srcDir) - + def runSetupAction(self): # Run configure, build and install phase ui.action("Setting up source...\n") self.runActionFunction(const.setup_func) + + def runBuildAction(self): ui.action("Building source...\n") self.runActionFunction(const.build_func) + + def runInstallAction(self): ui.action("Intalling...\n") # install function is mandatory! self.runActionFunction(const.install_func, True) - os.chdir(curDir) def compileActionScript(self): """Compiles actions.py and sets the actionLocals and actionGlobals""" @@ -177,12 +177,20 @@ class PisiBuild: If mandatory parameter is True, and function is not present in actionLocals PisiBuildError will be raised.""" + # we'll need our working directory after actionscript + # finished its work in the archive source directory. + curDir = os.getcwd() + os.chdir(self.srcDir) + + if func in self.actionLocals: self.actionLocals[func]() else: if mandatory: PisiBuildError, "unable to call function from actions: %s" %func + os.chdir(curDir) + def solveBuildDependencies(self): """pre-alpha: fail if dependencies not satisfied""" pass diff --git a/pisi/cli/commands.py b/pisi/cli/commands.py index 579ec441..1afb10bf 100644 --- a/pisi/cli/commands.py +++ b/pisi/cli/commands.py @@ -13,7 +13,9 @@ def cmdObject(cmd, fail=False): commands = {"help": Help, "build": Build, "build-unpack": BuildUnpack, - "build-runactions": BuildRunActions, + "build-runsetupaction": BuildRunSetupAction, + "build-runbuildaction": BuildRunBuildAction, + "build-runinstallaction": BuildRunInstallAction, "info": Info, "install": Install, "list-installed": ListInstalled, @@ -394,18 +396,16 @@ for you. for arg in self.args: pisi.toplevel.build_unpack(arg, self.authInfo) -class BuildRunActions(Command): +class BuildRunSetupAction(Command): """Unpack source using a pspec.xml file Usage: - build-runactions pspec.xml + build-runsetupaction pspec.xml -You can give an URI of the pspec.xml file. PISI will fetch all -necessary files and unpack the source, prepare a source directory and -run the functions in actions.py. +TODO: Some desc. """ def __init__(self): - super(BuildRunActions, self).__init__() + super(BuildRunSetupAction, self).__init__() def run(self): if not self.args: @@ -413,4 +413,44 @@ run the functions in actions.py. return for arg in self.args: - pisi.toplevel.build_runactions(arg, self.authInfo) + pisi.toplevel.build_runSetupAction(arg, self.authInfo) + + +class BuildRunBuildAction(Command): + """Unpack source using a pspec.xml file + + Usage: + build-runbuildaction pspec.xml + +TODO: Some desc. +""" + def __init__(self): + super(BuildRunBuildAction, self).__init__() + + def run(self): + if not self.args: + self.help() + return + + for arg in self.args: + pisi.toplevel.build_runBuildAction(arg, self.authInfo) + + +class BuildRunInstallAction(Command): + """Unpack source using a pspec.xml file + + Usage: + build-runsetupactions pspec.xml + +TODO: Some desc. +""" + def __init__(self): + super(BuildRunInstallAction, self).__init__() + + def run(self): + if not self.args: + self.help() + return + + for arg in self.args: + pisi.toplevel.build_runInstallAction(arg, self.authInfo) diff --git a/pisi/cli/common.py b/pisi/cli/common.py index 7752837a..529b46b8 100644 --- a/pisi/cli/common.py +++ b/pisi/cli/common.py @@ -5,7 +5,9 @@ where is one of: help build build-unpack -build-runactions +build-runsetupaction +build-runbuildaction +build-runinstallaction index info install diff --git a/pisi/toplevel.py b/pisi/toplevel.py index f9d55a02..e152ba7d 100644 --- a/pisi/toplevel.py +++ b/pisi/toplevel.py @@ -151,13 +151,32 @@ def build_unpack(pspecfile, authInfo=None): pb.compileActionScript() pb.applyPatches() -def build_runactions(pspecfile, authInfo=None): +def build_runSetupAction(pspecfile, authInfo=None): pb = prepare_for_build(pspecfile, authInfo) pb.fetchSourceArchive() pb.unpackSourceArchive() pb.compileActionScript() pb.applyPatches() - pb.runActions() + pb.runSetupAction() + +def build_runBuildAction(pspecfile, authInfo=None): + pb = prepare_for_build(pspecfile, authInfo) + pb.fetchSourceArchive() + pb.unpackSourceArchive() + pb.compileActionScript() + pb.applyPatches() + pb.runSetupAction() + pb.runBuildAction() + +def build_runInstallAction(pspecfile, authInfo=None): + pb = prepare_for_build(pspecfile, authInfo) + pb.fetchSourceArchive() + pb.unpackSourceArchive() + pb.compileActionScript() + pb.applyPatches() + pb.runSetupAction() + pb.runBuildAction() + pb.runInstallAction() def build(pspecfile, authInfo=None): pb = prepare_for_build(pspecfile, authInfo)