25 lines
602 B
Python
25 lines
602 B
Python
|
from bundlewrap.utils.ui import io
|
||
|
from bundlewrap.utils.scm import get_rev
|
||
|
from bundlewrap.utils.text import red, bold
|
||
|
|
||
|
@node_attribute
|
||
|
def needs_apply(node):
|
||
|
if node.dummy:
|
||
|
return False
|
||
|
|
||
|
if node.os not in node.OS_FAMILY_UNIX:
|
||
|
return True
|
||
|
|
||
|
try:
|
||
|
applied = node.run(
|
||
|
'cat /var/lib/bundlewrap/last_apply_commit_id',
|
||
|
may_fail=True,
|
||
|
).stdout.decode().strip()
|
||
|
|
||
|
if not applied or applied != get_rev():
|
||
|
return True
|
||
|
except Exception as e:
|
||
|
io.stderr(f'{red("!!!")} {bold(node.name)} {e!r}')
|
||
|
|
||
|
return False
|