Merge pull request #336 from learnleapfly/fix_status_list
Fix status list
This commit is contained in:
commit
0db47936f2
2 changed files with 29 additions and 5 deletions
|
@ -19,6 +19,9 @@ class LibffiRecipe(Recipe):
|
||||||
for arch in self.filtered_archs:
|
for arch in self.filtered_archs:
|
||||||
self.build(arch)
|
self.build(arch)
|
||||||
|
|
||||||
|
# since we don't run cache_execution, call this here for `status`
|
||||||
|
self.update_state("{}.build_all".format(self.name), True)
|
||||||
|
|
||||||
def prebuild_arch(self, arch):
|
def prebuild_arch(self, arch):
|
||||||
if self.has_marker("patched"):
|
if self.has_marker("patched"):
|
||||||
return
|
return
|
||||||
|
|
31
toolchain.py
31
toolchain.py
|
@ -55,14 +55,12 @@ def cache_execution(f):
|
||||||
if args:
|
if args:
|
||||||
for arg in args:
|
for arg in args:
|
||||||
key += ".{}".format(arg)
|
key += ".{}".format(arg)
|
||||||
key_time = "{}.at".format(key)
|
|
||||||
if key in state and not force:
|
if key in state and not force:
|
||||||
print("# (ignored) {} {}".format(f.__name__.capitalize(), self.name))
|
print("# (ignored) {} {}".format(f.__name__.capitalize(), self.name))
|
||||||
return
|
return
|
||||||
print("{} {}".format(f.__name__.capitalize(), self.name))
|
print("{} {}".format(f.__name__.capitalize(), self.name))
|
||||||
f(self, *args, **kwargs)
|
f(self, *args, **kwargs)
|
||||||
state[key] = True
|
self.update_state(key, True)
|
||||||
state[key_time] = str(datetime.utcnow())
|
|
||||||
return _cache_execution
|
return _cache_execution
|
||||||
|
|
||||||
|
|
||||||
|
@ -779,6 +777,19 @@ class Recipe(object):
|
||||||
self.delete_marker("building")
|
self.delete_marker("building")
|
||||||
self.set_marker("build_done")
|
self.set_marker("build_done")
|
||||||
|
|
||||||
|
def update_state(self, key, value):
|
||||||
|
"""Update entry in state database
|
||||||
|
|
||||||
|
This is usually done in the @cache_execution decorator
|
||||||
|
to log an action and its time of occurrence,
|
||||||
|
but it needs to be done manually in recipes.
|
||||||
|
|
||||||
|
sets key = value, and key.at = current_datetime
|
||||||
|
"""
|
||||||
|
key_time = "{}.at".format(key)
|
||||||
|
self.ctx.state[key] = value
|
||||||
|
self.ctx.state[key_time] = str(datetime.utcnow())
|
||||||
|
|
||||||
@cache_execution
|
@cache_execution
|
||||||
def build_all(self):
|
def build_all(self):
|
||||||
filtered_archs = self.filtered_archs
|
filtered_archs = self.filtered_archs
|
||||||
|
@ -828,6 +839,15 @@ class Recipe(object):
|
||||||
if hasattr(self, postbuild):
|
if hasattr(self, postbuild):
|
||||||
getattr(self, postbuild)()
|
getattr(self, postbuild)()
|
||||||
|
|
||||||
|
def update_state(self, key, value):
|
||||||
|
"""Update entry in state database
|
||||||
|
|
||||||
|
Also adds the time of update
|
||||||
|
"""
|
||||||
|
key_time = "{}.at".format(key)
|
||||||
|
self.ctx.state[key] = value
|
||||||
|
self.ctx.state[key_time] = str(datetime.utcnow())
|
||||||
|
|
||||||
@cache_execution
|
@cache_execution
|
||||||
def make_lipo(self, filename, library=None):
|
def make_lipo(self, filename, library=None):
|
||||||
if library is None:
|
if library is None:
|
||||||
|
@ -916,11 +936,12 @@ class Recipe(object):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def list_recipes(cls):
|
def list_recipes(cls, **kwargs):
|
||||||
|
skip_list = kwargs.pop("skip_list", ['__pycache__'])
|
||||||
recipes_dir = join(dirname(__file__), "recipes")
|
recipes_dir = join(dirname(__file__), "recipes")
|
||||||
for name in sorted(listdir(recipes_dir)):
|
for name in sorted(listdir(recipes_dir)):
|
||||||
fn = join(recipes_dir, name)
|
fn = join(recipes_dir, name)
|
||||||
if isdir(fn):
|
if isdir(fn) and name not in skip_list:
|
||||||
yield name
|
yield name
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|
Loading…
Reference in a new issue