aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschnetter <schnetter@83718e91-0e4f-0410-abf4-91180603181f>2005-05-29 14:03:38 +0000
committerschnetter <schnetter@83718e91-0e4f-0410-abf4-91180603181f>2005-05-29 14:03:38 +0000
commit08de25904f7d64a31d31ac8e70ca6df2d33ad004 (patch)
treebfc9f5bd664a0d3d8fc00e6898aafc8d85334f92
parent3996f4dec8488695fd5ab2a245b7b1ceec4651c5 (diff)
Create a unique ID for each build
git-svn-id: http://svn.cactuscode.org/arrangements/CactusUtils/Formaline/trunk@22 83718e91-0e4f-0410-abf4-91180603181f
-rw-r--r--README5
-rw-r--r--src/announce.cc10
-rw-r--r--src/make.configuration.deps25
3 files changed, 38 insertions, 2 deletions
diff --git a/README b/README
index 956768c..43f7792 100644
--- a/README
+++ b/README
@@ -16,7 +16,7 @@ number of iterations, an efficiency summary, etc.
TODO:
-unique IDs for all output files
+put unique job IDs into all output files
BSD tar: read files from file: -I filename
tar: don't use -z; use tar and gzip
@@ -33,3 +33,6 @@ announce: maybe use <array> for parameter arrays
maybe use <bool> for booleans
maybe use <dateTime.iso8601>20100302T00:00:00</dateTime.iso8601>
for dates and times
+
+put the output files into the build directory instead of the scratch
+directory
diff --git a/src/announce.cc b/src/announce.cc
index 1400012..46936b8 100644
--- a/src/announce.cc
+++ b/src/announce.cc
@@ -33,6 +33,10 @@ using namespace std;
+extern "C" char const * Formaline_BuildID ();
+
+
+
static char * jobid = 0;
@@ -45,6 +49,7 @@ create_jobid (CCTK_ARGUMENTS)
DECLARE_CCTK_PARAMETERS;
ostringstream jobidbuf;
+ jobidbuf << "job-";
char run_host [1000];
Util_GetHostName (run_host, sizeof run_host);
@@ -225,6 +230,11 @@ Formaline_AnnounceInitial (CCTK_ARGUMENTS)
// Compiling
+ {
+ char const * const build_id = Formaline_BuildID();
+ stores.store ("build id", build_id);
+ }
+
#if 0
{
char const * const compile_user = CCTK_CompileUser();
diff --git a/src/make.configuration.deps b/src/make.configuration.deps
index 2efcc08..5b694e6 100644
--- a/src/make.configuration.deps
+++ b/src/make.configuration.deps
@@ -14,7 +14,7 @@ CACTUSLIBLINKLINE += $(TARBALL_DIR)/cactus-source.a
$(EXEDIR)$(DIRSEP)$(EXE): $(TARBALL_DIR)/cactus-source.a
-$(TARBALL_DIR)/cactus-source.a: $(TARBALL_DIR)/cactus-meta-source.o $(TARBALL_DIR)/cactus-flesh-source.o $(patsubst %,$(TARBALL_DIR)/cactus-thorn-source-%.o,$(notdir $(THORNS)))
+$(TARBALL_DIR)/cactus-source.a: $(TARBALL_DIR)/cactus-meta-source.o $(TARBALL_DIR)/build-id.o $(TARBALL_DIR)/cactus-flesh-source.o $(patsubst %,$(TARBALL_DIR)/cactus-thorn-source-%.o,$(notdir $(THORNS)))
$(AR) $(ARFLAGS) $@ $^
@echo $(DIVIDER)
@@ -26,6 +26,29 @@ $(TARBALL_DIR)/cactus-source.a: $(TARBALL_DIR)/cactus-meta-source.o $(TARBALL_DI
+# Unique ID for the build
+$(TARBALL_DIR)/build-id.o: $(TARBALL_DIR)/build-id.c
+ $(CC) $(CFLAGS) -c -o $@ $^
+
+# (force a new to be created every time)
+.PHONY: $(TARBALL_DIR)/build-id.c
+$(TARBALL_DIR)/build-id.c:
+ { \
+ echo '/* This is an auto-generated file -- do not edit */'; \
+ hostname=`hostname`; \
+ user="$$USER"; \
+ timestamp=`date +%Y%m%d-%H%M%S`; \
+ pid="$$$$"; \
+ id="build-$$hostname-$$USER-$$timestamp-$$pid"; \
+ echo 'static char const build_id[] = "'$id'";'; \
+ echo 'char const * Formaline_BuildID (void)'; \
+ echo '{'; \
+ echo ' return build_id;'; \
+ echo '}'; \
+ } > $@
+
+
+
# Meta information
$(TARBALL_DIR)/cactus-meta-source.o: $(TARBALL_DIR)/cactus-meta-source.c
$(CC) $(CFLAGS) -c -o $@ $^