aboutsummaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
Diffstat (limited to 'src/util')
-rw-r--r--src/util/VERSION1
-rwxr-xr-xsrc/util/git-commit-everything.pl2
-rwxr-xr-xsrc/util/git-gc-repo.pl4
-rwxr-xr-xsrc/util/git-push-everything.pl2
-rwxr-xr-xsrc/util/git-rm-thorn.pl4
-rwxr-xr-xsrc/util/git-rm-unused-thorns.pl44
-rwxr-xr-xsrc/util/makeblob.pl129
-rwxr-xr-xsrc/util/makemetablob.pl34
8 files changed, 148 insertions, 72 deletions
diff --git a/src/util/VERSION b/src/util/VERSION
index 9945293..d23d03d 100644
--- a/src/util/VERSION
+++ b/src/util/VERSION
@@ -3,3 +3,4 @@ Each auto-generated file depends on this file.
Thus, whenever this file changes, all auto-generated files are recreated.
2005-08-22: Change layout of struct sourceinfo
+2010-06-23: Move thorn to a new arrangement
diff --git a/src/util/git-commit-everything.pl b/src/util/git-commit-everything.pl
index d972218..96a06f2 100755
--- a/src/util/git-commit-everything.pl
+++ b/src/util/git-commit-everything.pl
@@ -12,7 +12,7 @@ $#ARGV == 4 or die;
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 --git a/src/util/git-gc-repo.pl b/src/util/git-gc-repo.pl
index 21bb03f..b02d5a4 100755
--- a/src/util/git-gc-repo.pl
+++ b/src/util/git-gc-repo.pl
@@ -42,7 +42,9 @@ if (! defined $oldreposize) {
$oldreposize = 0;
}
-my $maxreposize = 10 * $oldreposize;
+# Collect garbage once the repository has grown by more than a factor
+# of two
+my $maxreposize = 2 * $oldreposize;
if ($reposize > $maxreposize) {
print "Formaline: Optimising git repository (slow only the first time)...\n";
diff --git a/src/util/git-push-everything.pl b/src/util/git-push-everything.pl
index ee39ab4..8f5f111 100755
--- a/src/util/git-push-everything.pl
+++ b/src/util/git-push-everything.pl
@@ -15,7 +15,7 @@ my ($git_cmd, $git_repo, $git_master_repo) = @ARGV;
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 --git a/src/util/git-rm-thorn.pl b/src/util/git-rm-thorn.pl
index 9d5342b..75769f1 100755
--- a/src/util/git-rm-thorn.pl
+++ b/src/util/git-rm-thorn.pl
@@ -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 <schnetter@cct.lsu.edu>
@@ -9,7 +9,7 @@ use strict;
-$#ARGV >= 3 or die;
+$#ARGV >= 4 or die;
my ($git_cmd, $git_repo, $git_root, $thorn, @files) = @ARGV;
my $silent = $ENV{'SILENT'};
diff --git a/src/util/git-rm-unused-thorns.pl b/src/util/git-rm-unused-thorns.pl
new file mode 100755
index 0000000..1c8b4c9
--- /dev/null
+++ b/src/util/git-rm-unused-thorns.pl
@@ -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 <schnetter@cct.lsu.edu>
+
+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\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 --git a/src/util/makeblob.pl b/src/util/makeblob.pl
index 14fd49c..55badce 100755
--- a/src/util/makeblob.pl
+++ b/src/util/makeblob.pl
@@ -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 <<EOF;
+
+
+# Write several files, each with a maximum length
+
+my $done = 0;
+for (my $count = 0; ! $done; ++ $count) {
+ my $fcount = sprintf "%04d", $count;
+ my $fcount_next = sprintf "%04d", $count + 1;
+
+ open FILE, "> $basename-$fcount.c" or die;
+ print FILE <<EOF;
/* This is an auto-generated file -- do not edit */
\#include <stddef.h>
+\#include <stdlib.h>
+
+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 <<EOF;
+/* This is an auto-generated file -- do not edit */
+
+\#include <stddef.h>
+\#include <stdlib.h>
struct datainfo
{
@@ -38,50 +112,5 @@ struct sourceinfo const cactus_source_$thorn =
\"$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 --git a/src/util/makemetablob.pl b/src/util/makemetablob.pl
index f1349b2..530e187 100755
--- a/src/util/makemetablob.pl
+++ b/src/util/makemetablob.pl
@@ -1,11 +1,12 @@
#! /usr/bin/perl -w
use strict;
-
+
print <<EOF;
/* This is an auto-generated file -- do not edit */
\#include <stddef.h>
+\#include <stdlib.h>
struct datainfo
{
@@ -23,21 +24,20 @@ struct sourceinfo
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 <<EOF;
+
+struct sourceinfo const * const cactus_source [] = {
+EOF
+
+foreach my $argv (@ARGV) {
+ print " & cactus_source_${argv},\n";
}
-printf "\n";
-printf "};\n";
-printf "size_t const cactus_source_length = %d;\n", $#ARGV + 1;
+
+print <<EOF;
+ NULL
+};
+EOF