* build.py: Build states set by functions, Little typo fix
* toplevel.py: setStates calls removed
* common.py and commands.py: build-do* calls renamed as build-*
This commit is contained in:
+8
-6
@@ -108,12 +108,12 @@ class PisiBuild:
|
||||
if os.path.exists(self.ctx.pkg_dir()):
|
||||
util.clean_dir(self.ctx.pkg_dir())
|
||||
|
||||
self.compileActionScript()
|
||||
|
||||
self.fetchSourceArchive()
|
||||
|
||||
self.unpackSourceArchive()
|
||||
|
||||
self.compileActionScript()
|
||||
|
||||
self.solveBuildDependencies()
|
||||
|
||||
# apply the patches and prepare a source directory for build.
|
||||
@@ -144,26 +144,28 @@ class PisiBuild:
|
||||
ui.info("Source archive is stored: %s/%s\n"
|
||||
%(self.ctx.archives_dir(), self.spec.source.archiveName))
|
||||
|
||||
|
||||
def unpackSourceArchive(self):
|
||||
ui.info("Unpacking archive...")
|
||||
self.sourceArchive.unpack()
|
||||
ui.info(" unpacked (%s)\n" % self.ctx.pkg_work_dir())
|
||||
self.setState("unpacked")
|
||||
|
||||
def runSetupAction(self):
|
||||
# Run configure, build and install phase
|
||||
ui.action("Setting up source...\n")
|
||||
self.runActionFunction(const.setup_func)
|
||||
self.setState("setupaction")
|
||||
|
||||
def runBuildAction(self):
|
||||
ui.action("Building source...\n")
|
||||
self.runActionFunction(const.build_func)
|
||||
self.setState("buildaction")
|
||||
|
||||
def runInstallAction(self):
|
||||
ui.action("Intalling...\n")
|
||||
ui.action("Installing...\n")
|
||||
# install function is mandatory!
|
||||
self.runActionFunction(const.install_func, True)
|
||||
|
||||
self.setState("installaction")
|
||||
|
||||
def compileActionScript(self):
|
||||
"""Compiles actions.py and sets the actionLocals and actionGlobals"""
|
||||
@@ -192,7 +194,6 @@ class PisiBuild:
|
||||
workdir = self.spec.source.name + "-" + self.spec.source.version
|
||||
|
||||
return os.path.join(self.ctx.pkg_work_dir(), workdir)
|
||||
|
||||
|
||||
def runActionFunction(self, func, mandatory=False):
|
||||
"""Calls the corresponding function in actions.py.
|
||||
@@ -332,3 +333,4 @@ class PisiBuild:
|
||||
|
||||
pkg.close()
|
||||
os.chdir(c)
|
||||
self.setState("buildpackages")
|
||||
|
||||
+15
-19
@@ -23,11 +23,11 @@ def cmdObject(cmd, fail=False):
|
||||
commands = {"help": Help,
|
||||
"build": Build,
|
||||
"build-until": BuildUntil,
|
||||
"build-dounpack": BuildDoUnpack,
|
||||
"build-dosetup": BuildDoSetup,
|
||||
"build-dobuild": BuildDoBuild,
|
||||
"build-doinstall": BuildDoInstall,
|
||||
"build-dopackage": BuildDoPackage,
|
||||
"build-unpack": BuildUnpack,
|
||||
"build-setup": BuildSetup,
|
||||
"build-build": BuildBuild,
|
||||
"build-install": BuildInstall,
|
||||
"build-package": BuildPackage,
|
||||
"info": Info,
|
||||
"install": Install,
|
||||
"list-installed": ListInstalled,
|
||||
@@ -426,7 +426,7 @@ for you.
|
||||
for arg in self.args:
|
||||
pisi.toplevel.build_until(arg, state, self.authInfo)
|
||||
|
||||
class BuildDoUnpack(Command):
|
||||
class BuildUnpack(Command):
|
||||
"""Unpack the source archive
|
||||
|
||||
Usage:
|
||||
@@ -435,7 +435,7 @@ class BuildDoUnpack(Command):
|
||||
TODO: desc.
|
||||
"""
|
||||
def __init__(self):
|
||||
super(BuildDoUnpack, self).__init__()
|
||||
super(BuildUnpack, self).__init__()
|
||||
|
||||
def run(self):
|
||||
if not self.args:
|
||||
@@ -446,7 +446,7 @@ TODO: desc.
|
||||
pisi.toplevel.build_until(arg, "unpack", self.authInfo)
|
||||
|
||||
|
||||
class BuildDoSetup(Command):
|
||||
class BuildSetup(Command):
|
||||
"""Setup the source
|
||||
|
||||
Usage:
|
||||
@@ -455,7 +455,7 @@ class BuildDoSetup(Command):
|
||||
TODO: desc.
|
||||
"""
|
||||
def __init__(self):
|
||||
super(BuildDoSetup, self).__init__()
|
||||
super(BuildSetup, self).__init__()
|
||||
|
||||
def run(self):
|
||||
if not self.args:
|
||||
@@ -466,7 +466,7 @@ TODO: desc.
|
||||
pisi.toplevel.build_until(arg, "setupaction", self.authInfo)
|
||||
|
||||
|
||||
class BuildDoBuild(Command):
|
||||
class BuildBuild(Command):
|
||||
"""Setup the source
|
||||
|
||||
Usage:
|
||||
@@ -475,7 +475,7 @@ class BuildDoBuild(Command):
|
||||
TODO: desc.
|
||||
"""
|
||||
def __init__(self):
|
||||
super(BuildDoBuild, self).__init__()
|
||||
super(BuildBuild, self).__init__()
|
||||
|
||||
def run(self):
|
||||
if not self.args:
|
||||
@@ -485,7 +485,7 @@ TODO: desc.
|
||||
for arg in self.args:
|
||||
pisi.toplevel.build_until(arg, "buildaction", self.authInfo)
|
||||
|
||||
class BuildDoInstall(Command):
|
||||
class BuildInstall(Command):
|
||||
"""Install to the sandbox
|
||||
|
||||
Usage:
|
||||
@@ -494,7 +494,7 @@ class BuildDoInstall(Command):
|
||||
TODO: desc.
|
||||
"""
|
||||
def __init__(self):
|
||||
super(BuildDoInstall, self).__init__()
|
||||
super(BuildInstall, self).__init__()
|
||||
|
||||
def run(self):
|
||||
if not self.args:
|
||||
@@ -504,7 +504,7 @@ TODO: desc.
|
||||
for arg in self.args:
|
||||
pisi.toplevel.build_until(arg, "installaction", self.authInfo)
|
||||
|
||||
class BuildDoPackage(Command):
|
||||
class BuildPackage(Command):
|
||||
"""Setup the source
|
||||
|
||||
Usage:
|
||||
@@ -513,7 +513,7 @@ class BuildDoPackage(Command):
|
||||
TODO: desc.
|
||||
"""
|
||||
def __init__(self):
|
||||
super(BuildDoPackage, self).__init__()
|
||||
super(BuildPackage, self).__init__()
|
||||
|
||||
def run(self):
|
||||
if not self.args:
|
||||
@@ -522,7 +522,3 @@ TODO: desc.
|
||||
|
||||
for arg in self.args:
|
||||
pisi.toplevel.build_until(arg, "buildpackages", self.authInfo)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
+5
-5
@@ -15,11 +15,11 @@ where <command> is one of:
|
||||
help
|
||||
build
|
||||
build-until
|
||||
build-dounpack
|
||||
build-dosetup
|
||||
build-dobuild
|
||||
build-doinstall
|
||||
build-dopackage
|
||||
build-unpack
|
||||
build-setup
|
||||
build-build
|
||||
build-install
|
||||
build-package
|
||||
index
|
||||
info
|
||||
install
|
||||
|
||||
@@ -238,40 +238,30 @@ def __buildState_unpack(pb):
|
||||
pb.unpackSourceArchive()
|
||||
pb.applyPatches()
|
||||
|
||||
pb.setState("unpack")
|
||||
|
||||
def __buildState_setupaction(pb, last):
|
||||
|
||||
if order[last] < order["unpack"]:
|
||||
__buildState_unpack(pb)
|
||||
pb.runSetupAction()
|
||||
|
||||
pb.setState("setupaction")
|
||||
|
||||
def __buildState_buildaction(pb, last):
|
||||
|
||||
if order[last] < order["setupaction"]:
|
||||
__buildState_setupaction(pb, last)
|
||||
pb.runBuildAction()
|
||||
|
||||
pb.setState("buildaction")
|
||||
|
||||
def __buildState_installaction(pb, last):
|
||||
|
||||
if order[last] < order["buildaction"]:
|
||||
__buildState_buildaction(pb, last)
|
||||
pb.runInstallAction()
|
||||
|
||||
pb.setState("installaction")
|
||||
|
||||
def __buildState_buildpackages(pb, last):
|
||||
|
||||
if order[last] < order["installaction"]:
|
||||
__buildState_installaction(pb, last)
|
||||
pb.buildPackages()
|
||||
|
||||
pb.setState("buildpackages")
|
||||
|
||||
def build_until(pspecfile, state, authInfo=None):
|
||||
pb = prepare_for_build(pspecfile, authInfo)
|
||||
pb.compileActionScript()
|
||||
@@ -294,12 +284,7 @@ def build_until(pspecfile, state, authInfo=None):
|
||||
return
|
||||
|
||||
if state == "installaction":
|
||||
print "blibli"
|
||||
__buildState_installaction(pb, last)
|
||||
return
|
||||
|
||||
__buildState_buildpackages(pb, last)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user