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