COMAR betiklerinide derlemeye başlamadan kontrol et, hata varsa derlemeye çalışma
This commit is contained in:
+22
-7
@@ -180,6 +180,7 @@ class Builder:
|
|||||||
ctx.ui.status(_("Building PiSi source package: %s") % self.spec.source.name)
|
ctx.ui.status(_("Building PiSi source package: %s") % self.spec.source.name)
|
||||||
|
|
||||||
self.compile_action_script()
|
self.compile_action_script()
|
||||||
|
self.compile_comar_script()
|
||||||
|
|
||||||
# check if all patch files exists, if there are missing no need to unpack!
|
# check if all patch files exists, if there are missing no need to unpack!
|
||||||
self.patch_exists()
|
self.patch_exists()
|
||||||
@@ -356,23 +357,35 @@ class Builder:
|
|||||||
|
|
||||||
return abandoned_files
|
return abandoned_files
|
||||||
|
|
||||||
|
def compile_script(self, fname):
|
||||||
def compile_action_script(self):
|
"""Compiles given string to check syntax error in it and sets the actionLocals and actionGlobals"""
|
||||||
"""Compiles actions.py and sets the actionLocals and actionGlobals"""
|
|
||||||
scriptfile = util.join_path(self.specdir, ctx.const.actions_file)
|
|
||||||
try:
|
try:
|
||||||
localSymbols = globalSymbols = {}
|
localSymbols = globalSymbols = {}
|
||||||
buf = open(scriptfile).read()
|
buf = open(fname).read()
|
||||||
exec compile(buf, "error", "exec") in localSymbols, globalSymbols
|
exec compile(buf, "error", "exec") in localSymbols, globalSymbols
|
||||||
except IOError, e:
|
except IOError, e:
|
||||||
raise Error(_("Unable to read Action Script (%s): %s") %(scriptfile,e))
|
raise Error(_("Unable to read file (%s): %s") %(fname,e))
|
||||||
except SyntaxError, e:
|
except SyntaxError, e:
|
||||||
raise Error(_("SyntaxError in Action Script (%s): %s") %(scriptfile,e))
|
raise Error(_("SyntaxError in file (%s): %s") %(fname,e))
|
||||||
|
|
||||||
self.actionLocals = localSymbols
|
self.actionLocals = localSymbols
|
||||||
self.actionGlobals = globalSymbols
|
self.actionGlobals = globalSymbols
|
||||||
self.srcDir = self.pkg_src_dir()
|
self.srcDir = self.pkg_src_dir()
|
||||||
|
|
||||||
|
def compile_action_script(self):
|
||||||
|
"""Compiles actions.py to check syntax errors"""
|
||||||
|
fname = util.join_path(self.specdir, ctx.const.actions_file)
|
||||||
|
self.compile_script(fname)
|
||||||
|
|
||||||
|
def compile_comar_script(self):
|
||||||
|
"""Compiles comar scripts to check syntax errors"""
|
||||||
|
for package in self.spec.packages:
|
||||||
|
for pcomar in package.providesComar:
|
||||||
|
fname = util.join_path(ctx.const.comar_dir,
|
||||||
|
pcomar.script)
|
||||||
|
|
||||||
|
self.compile_script(fname)
|
||||||
|
|
||||||
def pkg_src_dir(self):
|
def pkg_src_dir(self):
|
||||||
"""Returns the real path of WorkDir for an unpacked archive."""
|
"""Returns the real path of WorkDir for an unpacked archive."""
|
||||||
try:
|
try:
|
||||||
@@ -784,6 +797,7 @@ class Builder:
|
|||||||
for pcomar in package.providesComar:
|
for pcomar in package.providesComar:
|
||||||
fname = util.join_path(ctx.const.comar_dir,
|
fname = util.join_path(ctx.const.comar_dir,
|
||||||
pcomar.script)
|
pcomar.script)
|
||||||
|
# self.compile_comar_script(fname)
|
||||||
pkg.add_to_package(fname)
|
pkg.add_to_package(fname)
|
||||||
|
|
||||||
# add xmls and files
|
# add xmls and files
|
||||||
@@ -908,6 +922,7 @@ def build_until(pspec, state):
|
|||||||
pb = Builder.from_name(pspec)
|
pb = Builder.from_name(pspec)
|
||||||
|
|
||||||
pb.compile_action_script()
|
pb.compile_action_script()
|
||||||
|
pb.compile_comar_script()
|
||||||
|
|
||||||
last = pb.get_state()
|
last = pb.get_state()
|
||||||
ctx.ui.info("Last state was %s"%last)
|
ctx.ui.info("Last state was %s"%last)
|
||||||
|
|||||||
Reference in New Issue
Block a user