Commit a17a35fa authored by Christian Dietrich's avatar Christian Dietrich
Browse files

experiments: fix modification of files

parent 3ff887b9
Pipeline #2994 passed with stage
in 0 seconds
JOBS := $(shell nproc)
CLANG_HASH=${HOME}/w/clang-hash
SAMBA = ${CLANG_HASH}/hash-projects/samba
BASH = ${CLANG_HASH}/hash-projects/bash
LUA = ${CLANG_HASH}/hash-projects/lua
MUSL = ${CLANG_HASH}/hash-projects/musl
POSTGRESQL = ${CLANG_HASH}/hash-projects/postgresql
CPYTHON = ${CLANG_HASH}/hash-projects/cpython
......@@ -12,13 +16,12 @@ define inc_template
inc_$(shell echo $1 | tr '[:upper:]' '[:lower:]' )_$2:
./incremental_rebuild.py -s \
-d ../versuchung-data --jobs $(JOBS) \
-v --clang_hash-clone-url ${CLANG_HASH} \
--project-clone-url ${$1} --mode $2
-vv --clang_hash-clone-url ${CLANG_HASH} \
--project-clone-url ${$1} --mode $2 --dummy
inc_$(shell echo $1 | tr '[:upper:]' '[:lower:]' ): inc_$(shell echo $1 | tr '[:upper:]' '[:lower:]' )_$2
endef
$(foreach project,MUSL POSTGRESQL CPYTHON MBEDTLS,\
$(foreach project,MUSL POSTGRESQL CPYTHON MBEDTLS LUA BASH SAMBA,\
$(foreach mode,normal ccache clang-hash,\
$(eval $(call inc_template,$(project),$(mode)))))
......@@ -48,10 +48,12 @@ class IncrementalCompilation(Experiment):
def call_configure(self, path):
if self.project_name() == "postgresql":
shell("cd %s; ./configure --enable-depend", path)
elif self.project_name() in ("musl", "cpython"):
elif self.project_name() in ("musl", "cpython", "bash", "waf"):
shell("cd %s; ./configure", path)
elif self.project_name() in ('mbedtls'):
shell("cd %s; cmake . -DCMAKE_C_COMPILER=$CC", path)
elif self.project_name() in ('lua',):
pass
else:
raise RuntimeError("Not a valid project")
......@@ -74,8 +76,14 @@ class IncrementalCompilation(Experiment):
if self.touch_only.value:
os.utime(path, None)
else:
with open(path, "a") as fd:
fd.write(";\n")
with open(path) as fd:
content = fd.read()
if ";\n" in content:
content = content.replace(";\n", ";;\n", 1)
with open(path, "w") as fd:
fd.write(content)
else:
os.utime(path, None)
def rebuild(self, path, cause):
info = {'filename': cause}
......@@ -103,7 +111,6 @@ class IncrementalCompilation(Experiment):
return ret
def run(self):
self.suspend_on_error = True
# Determine the mode
modes = ('normal', 'ccache', 'clang-hash')
if not self.mode.value in modes:
......@@ -148,8 +155,8 @@ class IncrementalCompilation(Experiment):
def variant_name(self):
mod = "append"
if self.touch_only.value:
mod = "newline"
if self.metadata['touch-only']:
mod = "touch"
return "%s-%s-%s"%(self.project_name(), mod, self.metadata['mode'])
def symlink_name(self):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment