yeni komutlar, action'lar ayrı ayrı bölünüyor... Bu işi yapan kod epey çirkin şu anda. arayüzün nasıl olacağına karar verelim onu düzeltirim.
This commit is contained in:
+16
-8
@@ -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
|
||||
|
||||
+48
-8
@@ -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)
|
||||
|
||||
+3
-1
@@ -5,7 +5,9 @@ where <command> is one of:
|
||||
help
|
||||
build
|
||||
build-unpack
|
||||
build-runactions
|
||||
build-runsetupaction
|
||||
build-runbuildaction
|
||||
build-runinstallaction
|
||||
index
|
||||
info
|
||||
install
|
||||
|
||||
+21
-2
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user