diff -ru EinsteinToolkit/arrangements/CactusUtils/Formaline/src/make.code.deps Calpha/arrangements/AEIThorns/Formaline/src/make.code.deps --- EinsteinToolkit/arrangements/CactusUtils/Formaline/src/make.code.deps 2010-05-03 22:22:20.000000000 -0400 +++ Calpha/arrangements/AEIThorns/Formaline/src/make.code.deps 2010-04-08 21:33:22.000000000 -0400 @@ -6,10 +6,10 @@ # file make.configuration.deps because only here the location of the # source directory is known. -FORMALINE_BIN_DIR = $(SCRATCH_BUILD)/formaline-bin +FORMALINE_BIN_DIR = $(SCRATCH_BUILD)/Formaline/bin FORMALINE_TAR_FILES = gethostname.pl makeblob.pl makemetablob.pl -FORMALINE_GIT_FILES = git-add-thorn.pl git-commit-everything.pl git-gc-repo.pl git-init-master-repo.pl git-init-repo.pl git-lock.pl git-push-everything.pl git-rm-thorn.pl +FORMALINE_GIT_FILES = git-add-thorn.pl git-commit-everything.pl git-gc-repo.pl git-init-master-repo.pl git-init-repo.pl git-lock.pl git-push-everything.pl git-rm-unused-thorns.pl git-rm-thorn.pl $(CCTK_TARGET): $(FORMALINE_TAR_FILES:%=$(FORMALINE_BIN_DIR)/%) $(FORMALINE_GIT_FILES:%=$(FORMALINE_BIN_DIR)/%) diff -ru EinsteinToolkit/arrangements/CactusUtils/Formaline/src/make.configuration.deps Calpha/arrangements/AEIThorns/Formaline/src/make.configuration.deps --- EinsteinToolkit/arrangements/CactusUtils/Formaline/src/make.configuration.deps 2010-05-03 22:22:20.000000000 -0400 +++ Calpha/arrangements/AEIThorns/Formaline/src/make.configuration.deps 2010-04-08 21:40:02.000000000 -0400 @@ -19,8 +19,8 @@ # Create a tarball of the source code whenever this thorn is linked # into an executable -TARBALL_DIR = $(SCRATCH_BUILD) -FORMALINE_BIN_DIR = $(SCRATCH_BUILD)/formaline-bin +TARBALL_DIR = $(SCRATCH_BUILD)/Formaline +FORMALINE_BIN_DIR = $(SCRATCH_BUILD)/Formaline/bin @@ -77,7 +77,7 @@ .PRECIOUS: $(TARBALL_DIR)/build-id.o $(TARBALL_DIR)/build-id.o: $(TARBALL_DIR)/build-id.c - $(CC) $(CFLAGS) -c -o $@ $^ + cd $(TARBALL_DIR) && $(CC) $(CFLAGS) -c -o $@ $^ .PRECIOUS: $(TARBALL_DIR)/build-id.c $(TARBALL_DIR)/build-id.c: $(TOP)/BUILD-ID @@ -93,7 +93,7 @@ # Meta information $(TARBALL_DIR)/cactus-meta-source.o: $(TARBALL_DIR)/cactus-meta-source.c - $(CC) $(CFLAGS) -c -o $@ $^ + cd $(TARBALL_DIR) && $(CC) $(CFLAGS) -c -o $@ $^ $(TARBALL_DIR)/cactus-meta-source.c: $(TARBALL_DIR)/cactus-flesh-source.c $(patsubst %,$(TARBALL_DIR)/cactus-thorn-source-%.c,$(notdir $(THORNS))) $(FORMALINE_BIN_DIR)/makemetablob.pl Cactus $(notdir $(THORNS)) > $@ @@ -113,10 +113,11 @@ $(TARBALL_DIR)/cactus-flesh-source.o: $(TARBALL_DIR)/cactus-flesh-source.c @echo "Creating Formaline tarball for the flesh" - $(CC) $(CFLAGS) -c -o $@ $^ + cd $(TARBALL_DIR) && $(CC) $(CFLAGS) -c $^ $(^:%.c=%-????.c) -$(TARBALL_DIR)/cactus-flesh-source.c: $(TARBALL_DIR)/cactus-flesh-source.tar.gz $(CCTK_HOME)/arrangements/CactusUtils/Formaline/src/util/VERSION - $(FORMALINE_BIN_DIR)/makeblob.pl '' Cactus < $< > $@ +$(TARBALL_DIR)/cactus-flesh-source.c: $(TARBALL_DIR)/cactus-flesh-source.tar.gz $(CCTK_HOME)/arrangements/AEIThorns/Formaline/src/util/VERSION + $(RM) -f $(@:%.c=%-????.c) + $(FORMALINE_BIN_DIR)/makeblob.pl $(@:%.c=%) '' Cactus < $< $(TARBALL_DIR)/cactus-flesh-source.tar.gz: $(TARBALL_DIR)/cactus-flesh-source.files cd $(CCTK_HOME) && \ @@ -145,6 +146,7 @@ # Make aborts if these dependencies vanish. Therefore mention only files # here that cannot go away. $(TARBALL_DIR)/cactus-flesh-source.ccldeps: + mkdir -p $(TARBALL_DIR) { \ echo "$(@:%.ccldeps=%.files) \\"; \ echo "$@: \\"; \ @@ -163,10 +165,11 @@ $(TARBALL_DIR)/cactus-thorn-source-%.o: $(TARBALL_DIR)/cactus-thorn-source-%.c @echo "Creating Formaline tarball for thorn $*" - $(CC) $(CFLAGS) -c -o $@ $^ + cd $(TARBALL_DIR) && $(CC) $(CFLAGS) -c $^ $(^:%.c=%-????.c) -$(TARBALL_DIR)/cactus-thorn-source-%.c: $(TARBALL_DIR)/cactus-thorn-source-%.tar.gz $(CCTK_HOME)/arrangements/CactusUtils/Formaline/src/util/VERSION - $(FORMALINE_BIN_DIR)/makeblob.pl $(patsubst %/,%,$(dir $(filter %/$(@:$(TARBALL_DIR)/cactus-thorn-source-%.c=%),$(THORNS)))) $(@:$(TARBALL_DIR)/cactus-thorn-source-%.c=%) < $< > $@ +$(TARBALL_DIR)/cactus-thorn-source-%.c: $(TARBALL_DIR)/cactus-thorn-source-%.tar.gz $(CCTK_HOME)/arrangements/AEIThorns/Formaline/src/util/VERSION + $(RM) -f $(@:%.c=%-????.c) + $(FORMALINE_BIN_DIR)/makeblob.pl $(@:%.c=%) $(patsubst %/,%,$(dir $(filter %/$(@:$(TARBALL_DIR)/cactus-thorn-source-%.c=%),$(THORNS)))) $(@:$(TARBALL_DIR)/cactus-thorn-source-%.c=%) < $< $(TARBALL_DIR)/cactus-thorn-source-%.tar.gz: $(TARBALL_DIR)/cactus-thorn-source-%.files cd $(CCTK_HOME) && \ @@ -194,6 +197,7 @@ # Make aborts if these dependencies vanish. Therefore mention only files # here that cannot go away. $(TARBALL_DIR)/cactus-thorn-source-%.ccldeps: + mkdir -p $(TARBALL_DIR) { \ echo "$(@:%.ccldeps=%.files) \\"; \ echo "$@: \\"; \ @@ -284,6 +288,7 @@ echo "Formaline: If the build process seems to hang, some other command" echo "Formaline: is still running, e.g. the final link stage.)" +GIT-TAG-DIR = $(SCRATCH_BUILD)/Formaline GIT-BIN = $(FORMALINE_BIN_DIR) GIT-ROOT = $(CCTK_HOME) GIT-REPO = $(TOP)/configjar.git @@ -299,34 +304,44 @@ { \ '$(GIT-BIN)/git-init-master-repo.pl' '$(GIT)' '$(GIT-MASTER-REPO)' && \ if [ -e "$(CCTK_HOME)/cactus.config" ]; then \ - source "$(CCTK_HOME)/cactus.config" && \ - export CACTUS_CENTRAL_GIT_REPO; \ + source "$(CCTK_HOME)/cactus.config"; \ fi && \ + export CACTUS_CENTRAL_GIT_REPO && \ '$(GIT-BIN)/git-push-everything.pl' '$(GIT)' '$(GIT-REPO)' '$(GIT-MASTER-REPO)'; \ } || echo "Formaline: WARNING: Error while pushing to master repository" .PHONY: git-commit-everything -git-commit-everything: $(SCRATCH_BUILD)/cactus-flesh-source.git-tag $(GIT-THORNS:%=$(SCRATCH_BUILD)/cactus-thorn-%.git-tag) $(BUILD-ID-FILE) +git-commit-everything: $(GIT-TAG-DIR)/cactus-flesh-source.git-tag $(GIT-THORNS:%=$(GIT-TAG-DIR)/cactus-thorn-%.git-tag) $(BUILD-ID-FILE) git-rm-unused-thorns { \ '$(GIT-BIN)/git-commit-everything.pl' '$(GIT)' '$(GIT-REPO)' '$(GIT-ROOT)' "$$(cat $(BUILD-ID-FILE))" "$$(cat $(CONFIG-ID-FILE))"; \ } || echo "Formaline: WARNING: Error while committing to repository" -.PRECIOUS: $(SCRATCH_BUILD)/cactus-flesh-source.git-tag -$(SCRATCH_BUILD)/cactus-flesh-source.git-tag: $(TARBALL_DIR)/cactus-flesh-source.files +# Wait until after thorn Formaline has been built, so that its +# utilities are available +.PHONY: git-rm-unused-thorns +git-rm-unused-thorns: $(CCTK_LIBDIR)/$(LIBNAME_PREFIX)$(CCTK_LIBNAME_PREFIX)Formaline$(LIBNAME_SUFFIX) + { \ + '$(GIT-BIN)/git-rm-unused-thorns.pl' '$(GIT)' '$(GIT-REPO)' '$(GIT-ROOT)' $(THORNS); \ + } || echo "Formaline: WARNING: Error while removing unused thorns" + +.PRECIOUS: $(GIT-TAG-DIR)/cactus-flesh-source.git-tag +$(GIT-TAG-DIR)/cactus-flesh-source.git-tag: $(TARBALL_DIR)/cactus-flesh-source.files + mkdir -p $(GIT-TAG-DIR) { \ '$(GIT-BIN)/git-init-repo.pl' '$(GIT)' '$(GIT-REPO)' && \ echo "Formaline: Adding flesh to git repository..." && \ - '$(GIT-BIN)/git-rm-thorn.pl' '$(GIT)' '$(GIT-REPO)' '$(GIT-ROOT)' 'cactus' CONTRIBUTORS COPYRIGHT Makefile lib src configs && \ + '$(GIT-BIN)/git-rm-thorn.pl' '$(GIT)' '$(GIT-REPO)' '$(GIT-ROOT)' 'Cactus' CONTRIBUTORS COPYRIGHT Makefile lib src configs && \ : xargs ls < $(TARBALL_DIR)/cactus-flesh-source.files \ > $(TARBALL_DIR)/cactus-flesh-source.files2 2> /dev/null && \ - xargs '$(GIT-BIN)/git-add-thorn.pl' '$(GIT)' '$(GIT-REPO)' '$(GIT-ROOT)' 'cactus' \ + xargs '$(GIT-BIN)/git-add-thorn.pl' '$(GIT)' '$(GIT-REPO)' '$(GIT-ROOT)' 'Cactus' \ < $(TARBALL_DIR)/cactus-flesh-source.files && \ : rm $(TARBALL_DIR)/cactus-flesh-source.files2 && \ : > $@; \ } || echo "Formaline: WARNING: Error while adding flesh to git repository" -.PRECIOUS: $(SCRATCH_BUILD)/cactus-thorn-%.git-tag -$(SCRATCH_BUILD)/cactus-thorn-%.git-tag: $(TARBALL_DIR)/cactus-thorn-source-%.files +.PRECIOUS: $(GIT-TAG-DIR)/cactus-thorn-%.git-tag +$(GIT-TAG-DIR)/cactus-thorn-%.git-tag: $(TARBALL_DIR)/cactus-thorn-source-%.files + mkdir -p $(GIT-TAG-DIR) { \ '$(GIT-BIN)/git-init-repo.pl' '$(GIT)' '$(GIT-REPO)' && \ echo "Formaline: Adding thorn $* to git repository..." && \ diff -ru EinsteinToolkit/arrangements/CactusUtils/Formaline/src/output_source.c Calpha/arrangements/AEIThorns/Formaline/src/output_source.c --- EinsteinToolkit/arrangements/CactusUtils/Formaline/src/output_source.c 2010-05-03 22:22:20.000000000 -0400 +++ Calpha/arrangements/AEIThorns/Formaline/src/output_source.c 2010-03-25 12:32:13.000000000 -0400 @@ -51,7 +51,7 @@ CCTK_CreateDirectory (0755, filename); /* Output all thorns' tarballs */ - for (count = 0; count < cactus_source_length; ++ count) + for (count = 0; cactus_source[count]; ++ count) { snprintf (filename, sizeof filename, "%s/%s/Cactus-source-%s.tar.gz", diff -ru EinsteinToolkit/arrangements/CactusUtils/Formaline/src/util/git-commit-everything.pl Calpha/arrangements/AEIThorns/Formaline/src/util/git-commit-everything.pl --- EinsteinToolkit/arrangements/CactusUtils/Formaline/src/util/git-commit-everything.pl 2010-05-03 22:22:20.000000000 -0400 +++ Calpha/arrangements/AEIThorns/Formaline/src/util/git-commit-everything.pl 2010-03-25 13:03:42.000000000 -0400 @@ -12,7 +12,7 @@ my ($git_cmd, $git_repo, $git_root, $build_id, $config_id) = @ARGV; # Path where the git-*.pl commands are installed -my $bindir = $ENV{'SCRATCH_BUILD'} . '/formaline-bin'; +my $bindir = $ENV{'SCRATCH_BUILD'} . '/Formaline/bin'; my $silent = $ENV{'SILENT'}; $silent = 'yes' if ! defined $silent; diff -ru EinsteinToolkit/arrangements/CactusUtils/Formaline/src/util/git-push-everything.pl Calpha/arrangements/AEIThorns/Formaline/src/util/git-push-everything.pl --- EinsteinToolkit/arrangements/CactusUtils/Formaline/src/util/git-push-everything.pl 2010-05-03 22:22:20.000000000 -0400 +++ Calpha/arrangements/AEIThorns/Formaline/src/util/git-push-everything.pl 2010-03-25 13:03:45.000000000 -0400 @@ -15,7 +15,7 @@ my $git_central_repo = $ENV{'CACTUS_CENTRAL_GIT_REPO'}; # Path where the git-*.pl commands are installed -my $bindir = $ENV{'SCRATCH_BUILD'} . '/formaline-bin'; +my $bindir = $ENV{'SCRATCH_BUILD'} . '/Formaline/bin'; my $silent = $ENV{'SILENT'}; $silent = 'yes' if ! defined $silent; diff -ru EinsteinToolkit/arrangements/CactusUtils/Formaline/src/util/git-rm-thorn.pl Calpha/arrangements/AEIThorns/Formaline/src/util/git-rm-thorn.pl --- EinsteinToolkit/arrangements/CactusUtils/Formaline/src/util/git-rm-thorn.pl 2010-05-03 22:22:20.000000000 -0400 +++ Calpha/arrangements/AEIThorns/Formaline/src/util/git-rm-thorn.pl 2010-04-08 20:18:17.000000000 -0400 @@ -1,6 +1,6 @@ #! /usr/bin/perl -w -# Remote a Cactus thorn from the repository index, if and wherever it +# Remove a Cactus thorn from the repository index, if and wherever it # exists # 2010-01-29 Erik Schnetter @@ -9,7 +9,7 @@ -$#ARGV >= 3 or die; +$#ARGV >= 4 or die; my ($git_cmd, $git_repo, $git_root, $thorn, @files) = @ARGV; my $silent = $ENV{'SILENT'}; diff -Nru EinsteinToolkit/arrangements/CactusUtils/Formaline/src/util/git-rm-unused-thorns.pl Calpha/arrangements/AEIThorns/Formaline/src/util/git-rm-unused-thorns.pl --- EinsteinToolkit/arrangements/CactusUtils/Formaline/src/util/git-rm-unused-thorns.pl 1969-12-31 19:00:00.000000000 -0500 +++ Calpha/arrangements/AEIThorns/Formaline/src/util/git-rm-unused-thorns.pl 2010-04-08 21:21:49.000000000 -0400 @@ -0,0 +1,44 @@ +#! /usr/bin/perl -w + +# Remove all Cactus thorns from the repository index unless they are +# in the thorn list + +# 2010-04-08 Erik Schnetter + +use strict; + + + +$#ARGV >= 3 or die; +my ($git_cmd, $git_repo, $git_root, @thorns) = @ARGV; + +my $silent = $ENV{'SILENT'}; +$silent = 'yes' if ! defined $silent; +$silent = $silent !~ /^no$/i; +my $silencer = $silent ? '> /dev/null 2>&1' : ''; + + + +# Ensure that the repository exists +die unless -e "$git_repo/.git"; +$ENV{'GIT_DIR'} = "$git_repo/.git"; + + + +my @files = split m{\n}, `$git_cmd ls-files arrangements 2> /dev/null`; + +# Remove the files one by one because we want to ignore errors, but +# git aborts after the first error +file: for my $file (@files) { + for my $thorn (@thorns) { + next file if $file =~ m{^arrangements/$thorn/}; + } + + print "Executing: $git_cmd rm --cached -r $file 2> /dev/null\n" + unless $silent; + system "$git_cmd rm --cached -r $file > /dev/null 2>&1"; + # Ignore errors + #if ($?) { + # die "Could not remove file $file from git repository"; + #} +} diff -ru EinsteinToolkit/arrangements/CactusUtils/Formaline/src/util/makeblob.pl Calpha/arrangements/AEIThorns/Formaline/src/util/makeblob.pl --- EinsteinToolkit/arrangements/CactusUtils/Formaline/src/util/makeblob.pl 2010-05-03 22:22:20.000000000 -0400 +++ Calpha/arrangements/AEIThorns/Formaline/src/util/makeblob.pl 2010-03-25 12:40:09.000000000 -0400 @@ -1,20 +1,94 @@ #! /usr/bin/perl -w +use diagnostics; +use warnings; use strict; my $items_per_line = 16; my $items_per_file = 128 * 1024; -$#ARGV == 1 or die; +$#ARGV == 2 or die "ARGV=@ARGV"; -my $arrangement = $ARGV[0]; -my $thorn = $ARGV[1]; +my $basename = $ARGV[0]; +my $arrangement = $ARGV[1]; +my $thorn = $ARGV[2]; $thorn ne '' or die; -print < $basename-$fcount.c" or die; + print FILE < +\#include + +struct datainfo +{ + unsigned char const * data; + size_t length; + struct datainfo const * next; +}; + +EOF + + print FILE "static unsigned char const data_${fcount} [] = {"; + my $bytes; + for ($bytes = 0; $bytes < $items_per_file; ++ $bytes) { + my $ch = getc; + if (! defined $ch) { + $done = 1; + last; + } + if ($bytes != 0) { + printf FILE ","; + } + if ($bytes % $items_per_line == 0) { + printf FILE "\n"; + printf FILE " "; + } + printf FILE "%3d", ord $ch; + } + printf FILE "\n"; + printf FILE "};\n"; + + print FILE "\n"; + if (! $done) { + print FILE "struct datainfo const cactus_data_${fcount_next}_${thorn};\n"; + } + print FILE "struct datainfo const cactus_data_${fcount}_${thorn} =\n"; + print FILE "{\n"; + print FILE " data_${fcount},\n"; + print FILE " ${bytes}UL,\n"; + if (! $done) { + print FILE " & cactus_data_${fcount_next}_${thorn}\n"; + } + else { + print FILE " NULL\n"; + } + print FILE "};\n"; + + close FILE; +} + + + +# Write meta-file + +{ + open FILE, "> $basename.c" or die; + printf FILE < +\#include struct datainfo { @@ -38,50 +112,5 @@ \"$thorn\" }; EOF - -my $done = 0; -for (my $fcount = 0; ! $done; ++ $fcount) -{ - printf "\n"; - printf "static unsigned char const data_%04d [] = {", $fcount; - my $count; - for ($count = 0; $count < $items_per_file; ++ $count) - { - my $ch = getc; - if (! defined $ch) - { - $done = 1; - last; - } - if ($count != 0) - { - printf ","; - } - if ($count % $items_per_line == 0) - { - printf "\n"; - printf " "; - } - printf "%3d", ord $ch; - } - printf "\n"; - printf "};\n"; - printf "\n"; - if (! $done) - { - printf "struct datainfo const cactus_data_%04d_%s;\n", $fcount + 1, $thorn; - } - printf "struct datainfo const cactus_data_%04d_%s =\n", $fcount, $thorn; - printf "{\n"; - printf " data_%04d,\n", $fcount; - printf " %dUL,\n", $count; - if (! $done) - { - printf " & cactus_data_%04d_%s\n", $fcount + 1, $thorn; - } - else - { - printf " NULL\n"; - } - printf "};\n"; + close FILE; } diff -ru EinsteinToolkit/arrangements/CactusUtils/Formaline/src/util/makemetablob.pl Calpha/arrangements/AEIThorns/Formaline/src/util/makemetablob.pl --- EinsteinToolkit/arrangements/CactusUtils/Formaline/src/util/makemetablob.pl 2010-05-03 22:22:20.000000000 -0400 +++ Calpha/arrangements/AEIThorns/Formaline/src/util/makemetablob.pl 2010-03-25 12:31:45.000000000 -0400 @@ -1,11 +1,12 @@ #! /usr/bin/perl -w use strict; - + print < +\#include struct datainfo { @@ -23,21 +24,20 @@ EOF -for (my $count = 0; $count <= $#ARGV; ++ $count) -{ - printf "extern struct sourceinfo cactus_source_%s;\n", $ARGV[$count]; +foreach my $argv (@ARGV) { + print "extern struct sourceinfo const cactus_source_${argv};\n"; } -printf "\n"; -printf "struct sourceinfo const * const cactus_source [] = {"; -for (my $count = 0; $count <= $#ARGV; ++ $count) -{ - if ($count != 0) - { - printf ","; - } - printf "\n"; - printf " & cactus_source_%s", $ARGV[$count]; + +print <