aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorValerio Mariani <valerio.mariani@desy.de>2014-05-06 17:51:47 +0200
committerThomas White <taw@physics.org>2014-05-21 16:04:23 +0200
commit8c212e3abb7f4343affeb5e9e1092b59d3b74075 (patch)
treefd6629a34ebe77b2fc0ac9afc77eb5ffff77c9af
parent2658f7ca3fbdd0f037b9286812e6967b42517c0d (diff)
Added reporting of version number to all program and stream file
-rw-r--r--.gitignore1
-rw-r--r--Makefile.am12
-rw-r--r--libcrystfel/Makefile.am9
-rw-r--r--libcrystfel/src/stream.c3
-rw-r--r--src/ambigator.c8
-rw-r--r--src/cell_explorer.c9
-rw-r--r--src/check_hkl.c8
-rw-r--r--src/compare_hkl.c9
-rw-r--r--src/get_hkl.c8
-rw-r--r--src/hdfsee.c8
-rw-r--r--src/indexamajig.c8
-rw-r--r--src/partial_sim.c10
-rw-r--r--src/partialator.c8
-rw-r--r--src/pattern_sim.c8
-rw-r--r--src/process_hkl.c8
-rw-r--r--src/render_hkl.c8
-rw-r--r--version.h.in33
-rwxr-xr-xversion.sh25
18 files changed, 175 insertions, 8 deletions
diff --git a/.gitignore b/.gitignore
index 5091a898..6fd9164e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -51,3 +51,4 @@ lib/.libs/
lib/dummy.lo
lib/libgnu.la
libcrystfel/crystfel.pc
+version.h
diff --git a/Makefile.am b/Makefile.am
index a4efba1c..e9f427c7 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,5 +1,5 @@
docdir = ${datadir}/doc/${PACKAGE}
-EXTRA_DIST = configure m4/gnulib-cache.m4
+EXTRA_DIST = configure m4/gnulib-cache.m4 version.sh version.h.in
SUBDIRS = lib doc/reference/libcrystfel libcrystfel
ACLOCAL_AMFLAGS = -I m4
@@ -184,3 +184,13 @@ EXTRA_DIST += $(script_DATA)
DISTCHECK_CONFIGURE_FLAGS=--enable-gtk-doc
+
+mostlyclean-local: mostlyclean-version
+.PHONY: mostlyclean-version
+mostlyclean-version:
+ rm -f $(top_builddir)/version.h
+
+all: update_version_header
+.PHONY: version_header
+update_version_header:
+ $(top_srcdir)/version.sh $(top_srcdir)
diff --git a/libcrystfel/Makefile.am b/libcrystfel/Makefile.am
index 7d028b20..318dcd24 100644
--- a/libcrystfel/Makefile.am
+++ b/libcrystfel/Makefile.am
@@ -18,10 +18,11 @@ endif
libcrystfel_la_includedir=$(includedir)/crystfel/
-libcrystfel_la_include_HEADERS = src/beam-parameters.h src/hdf5-file.h \
- src/reflist.h src/symmetry.h src/cell.h \
- src/reflist-utils.h src/thread-pool.h \
- src/statistics.h src/utils.h src/detector.h \
+libcrystfel_la_include_HEADERS = ${top_srcdir}/version.h src/beam-parameters.h \
+ src/hdf5-file.h src/reflist.h src/symmetry.h \
+ src/cell.h src/reflist-utils.h \
+ src/thread-pool.h src/statistics.h \
+ src/utils.h src/detector.h \
src/geometry.h src/peaks.h src/stream.h \
src/render.h src/index.h src/image.h \
src/filters.h src/dirax.h src/mosflm.h \
diff --git a/libcrystfel/src/stream.c b/libcrystfel/src/stream.c
index 4470d098..34c14573 100644
--- a/libcrystfel/src/stream.c
+++ b/libcrystfel/src/stream.c
@@ -42,6 +42,7 @@
#include <sys/stat.h>
#include <fcntl.h>
+#include "version.h"
#include "cell.h"
#include "cell-utils.h"
#include "utils.h"
@@ -821,7 +822,7 @@ Stream *open_stream_fd_for_write(int fd)
fprintf(st->fh, "CrystFEL stream format %i.%i\n",
st->major_version, st->minor_version);
-
+ fprintf(st->fh, "Generated by CrystFEL "CRYSTFEL_VERSIONSTRING"\n");
return st;
}
diff --git a/src/ambigator.c b/src/ambigator.c
index bbc89c32..1c11578d 100644
--- a/src/ambigator.c
+++ b/src/ambigator.c
@@ -44,6 +44,7 @@
#include <gsl/gsl_permutation.h>
#include <gsl/gsl_randist.h>
+#include "version.h"
#include <image.h>
#include <utils.h>
#include <symmetry.h>
@@ -63,6 +64,7 @@ static void show_help(const char *s)
"\n"
" -h, --help Display this help message.\n"
"\n"
+" --version Print CrystFEL version number and exit.\n"
" -o, --output=<filename> Output stream.\n"
" -y, --symmetry=<sym> Actual (\"target\") symmetry.\n"
" -w <sym> Apparent (\"source\" or \"twinned\") symmetry.\n"
@@ -824,6 +826,7 @@ int main(int argc, char *argv[])
/* Long options */
const struct option longopts[] = {
{"help", 0, NULL, 'h'},
+ {"version", 0, NULL, 10 },
{"output", 1, NULL, 'o'},
{"symmetry", 1, NULL, 'y'},
{"iterations", 1, NULL, 'n'},
@@ -852,6 +855,11 @@ int main(int argc, char *argv[])
show_help(argv[0]);
return 0;
+ case 10 :
+ printf("CrystFEL: " CRYSTFEL_VERSIONSTRING "\n");
+ printf(CRYSTFEL_BOILERPLATE"\n");
+ return 0;
+
case 'o' :
outfile = strdup(optarg);
break;
diff --git a/src/cell_explorer.c b/src/cell_explorer.c
index 1087ce54..0df5032c 100644
--- a/src/cell_explorer.c
+++ b/src/cell_explorer.c
@@ -40,6 +40,7 @@
#include <gdk/gdkkeysyms.h>
#include <gsl/gsl_multifit_nlin.h>
+#include "version.h"
#include "stream.h"
#include "image.h"
#include "utils.h"
@@ -55,6 +56,8 @@ static void show_help(const char *s)
"Examine cell parameter histograms.\n"
"\n"
" -h, --help Display this help message.\n"
+" --version Print CrystFEL version number and exit.\n"
+
);
}
@@ -1214,6 +1217,7 @@ int main(int argc, char *argv[])
/* Long options */
const struct option longopts[] = {
{"help", 0, NULL, 'h'},
+ {"version", 0, NULL, 1 },
{0, 0, NULL, 0}
};
@@ -1227,6 +1231,11 @@ int main(int argc, char *argv[])
show_help(argv[0]);
return 0;
+ case 1 :
+ printf("CrystFEL: " CRYSTFEL_VERSIONSTRING "\n");
+ printf(CRYSTFEL_BOILERPLATE"\n");
+ return 0;
+
default :
return 1;
diff --git a/src/check_hkl.c b/src/check_hkl.c
index 1ba55313..dc376779 100644
--- a/src/check_hkl.c
+++ b/src/check_hkl.c
@@ -39,6 +39,7 @@
#include <getopt.h>
#include <gsl/gsl_fit.h>
+#include "version.h"
#include "utils.h"
#include "statistics.h"
#include "symmetry.h"
@@ -54,6 +55,7 @@ static void show_help(const char *s)
"Characterise an intensity list.\n"
"\n"
" -h, --help Display this help message.\n"
+" --version Print CrystFEL version number and exit.\n"
" -y, --symmetry=<sym> The symmetry of the input file.\n"
" -p, --pdb=<filename> PDB file to use.\n"
" --rmin=<res> Low resolution cutoff (1/d in m^-1).\n"
@@ -710,6 +712,7 @@ int main(int argc, char *argv[])
const struct option longopts[] = {
{"help", 0, NULL, 'h'},
+ {"version", 0, NULL, 9 },
{"symmetry", 1, NULL, 'y'},
{"pdb", 1, NULL, 'p'},
@@ -738,6 +741,11 @@ int main(int argc, char *argv[])
show_help(argv[0]);
return 0;
+ case 9 :
+ printf("CrystFEL: " CRYSTFEL_VERSIONSTRING "\n");
+ printf(CRYSTFEL_BOILERPLATE"\n");
+ return 0;
+
case 'y' :
sym_str = strdup(optarg);
break;
diff --git a/src/compare_hkl.c b/src/compare_hkl.c
index d2173aff..e10b93aa 100644
--- a/src/compare_hkl.c
+++ b/src/compare_hkl.c
@@ -42,13 +42,13 @@
#include <gsl/gsl_errno.h>
#include <gsl/gsl_statistics.h>
+#include "version.h"
#include "utils.h"
#include "statistics.h"
#include "symmetry.h"
#include "reflist-utils.h"
#include "cell-utils.h"
-
enum fom
{
FOM_R1I,
@@ -109,6 +109,7 @@ static void show_help(const char *s)
" --intensity-shells Use shells of intensity instead of resolution.\n"
"\n"
" -h, --help Display this help message.\n"
+" --version Print CrystFEL version number and exit.\n"
);
}
@@ -935,6 +936,7 @@ int main(int argc, char *argv[])
/* Long options */
const struct option longopts[] = {
{"help", 0, NULL, 'h'},
+ {"version", 0, NULL, 10 },
{"symmetry", 1, NULL, 'y'},
{"pdb", 1, NULL, 'p'},
{"rmin", 1, NULL, 2},
@@ -962,6 +964,11 @@ int main(int argc, char *argv[])
show_help(argv[0]);
return 0;
+ case 10 :
+ printf("CrystFEL: " CRYSTFEL_VERSIONSTRING "\n");
+ printf(CRYSTFEL_BOILERPLATE"\n");
+ return 0;
+
case 'y' :
sym_str = strdup(optarg);
break;
diff --git a/src/get_hkl.c b/src/get_hkl.c
index ae82858c..caeccd60 100644
--- a/src/get_hkl.c
+++ b/src/get_hkl.c
@@ -38,6 +38,7 @@
#include <unistd.h>
#include <getopt.h>
+#include "version.h"
#include "utils.h"
#include "reflist-utils.h"
#include "symmetry.h"
@@ -53,6 +54,7 @@ static void show_help(const char *s)
"Manipulate reflection lists.\n"
"\n"
" -h, --help Display this help message.\n"
+" --version Print CrystFEL version number and exit.\n"
"\n"
" -i, --input=<file> Read reflections from <file>.\n"
" -y, --symmetry=<sym> The symmetry of the input reflection list.\n"
@@ -418,6 +420,7 @@ int main(int argc, char *argv[])
/* Long options */
const struct option longopts[] = {
{"help", 0, NULL, 'h'},
+ {"version", 0, NULL, 5 },
{"template", 1, NULL, 't'},
{"poisson", 0, &config_poisson, 1},
{"noise", 0, &config_noise, 1},
@@ -446,6 +449,11 @@ int main(int argc, char *argv[])
show_help(argv[0]);
return 0;
+ case 5 :
+ printf("CrystFEL: " CRYSTFEL_VERSIONSTRING "\n");
+ printf(CRYSTFEL_BOILERPLATE"\n");
+ return 0;
+
case 't' :
template = strdup(optarg);
break;
diff --git a/src/hdfsee.c b/src/hdfsee.c
index ea6de2b2..fa10cfa6 100644
--- a/src/hdfsee.c
+++ b/src/hdfsee.c
@@ -37,6 +37,7 @@
#include <gtk/gtk.h>
#include <getopt.h>
+#include "version.h"
#include "dw-hdfsee.h"
#include "utils.h"
#include "render.h"
@@ -54,6 +55,7 @@ static void show_help(const char *s)
"Quick HDF5 image viewer.\n"
"\n"
" -h, --help Display this help message.\n"
+" --version Print CrystFEL version number and exit.\n"
"\n"
" -p, --peak-overlay=<filename> Draw circles in positions listed in file.\n"
" --ring-size=<n> Set the size for those circles.\n"
@@ -131,6 +133,7 @@ int main(int argc, char *argv[])
/* Long options */
const struct option longopts[] = {
{"help", 0, NULL, 'h'},
+ {"version", 0, NULL, 4 },
{"peak-overlay", 1, NULL, 'p'},
{"int-boost", 1, NULL, 'i'},
{"binning", 1, NULL, 'b'},
@@ -168,6 +171,11 @@ int main(int argc, char *argv[])
show_help(argv[0]);
return 0;
+ case 4 :
+ printf("CrystFEL: " CRYSTFEL_VERSIONSTRING "\n");
+ printf(CRYSTFEL_BOILERPLATE"\n");
+ return 0;
+
case 'p' :
peaks = strdup(optarg);
break;
diff --git a/src/indexamajig.c b/src/indexamajig.c
index c41b1487..143a0d82 100644
--- a/src/indexamajig.c
+++ b/src/indexamajig.c
@@ -54,6 +54,7 @@
#include <sys/time.h>
#endif
+#include "version.h"
#include "utils.h"
#include "hdf5-file.h"
#include "index.h"
@@ -78,6 +79,7 @@ static void show_help(const char *s)
"Process and index FEL diffraction images.\n"
"\n"
" -h, --help Display this help message.\n"
+" --version Print CrystFEL version number and exit.\n"
"\n"
" -i, --input=<filename> Specify file containing list of images to process.\n"
" '-' means stdin, which is the default.\n"
@@ -247,6 +249,7 @@ int main(int argc, char *argv[])
{"image", 1, NULL, 'e'},
/* Long-only options with no arguments */
+ {"version", 0, NULL, 20},
{"filter-noise", 0, &iargs.noisefilter, 1},
{"no-check-prefix", 0, &config_checkprefix, 0},
{"basename", 0, &config_basename, 1},
@@ -296,6 +299,11 @@ int main(int argc, char *argv[])
show_help(argv[0]);
return 0;
+ case 20 :
+ printf("CrystFEL: " CRYSTFEL_VERSIONSTRING "\n");
+ printf(CRYSTFEL_BOILERPLATE"\n");
+ return 0;
+
case 'i' :
filename = strdup(optarg);
break;
diff --git a/src/partial_sim.c b/src/partial_sim.c
index e1e0a4b4..17603d70 100644
--- a/src/partial_sim.c
+++ b/src/partial_sim.c
@@ -41,6 +41,7 @@
#include <pthread.h>
#include <gsl/gsl_rng.h>
+#include "version.h"
#include "image.h"
#include "utils.h"
#include "reflist-utils.h"
@@ -214,7 +215,8 @@ static void show_help(const char *s)
printf(
"Generate a stream containing partials from a reflection list.\n"
"\n"
-" -h, --help Display this help message.\n"
+" -h, --help Display this help message.\n"
+" --version Print CrystFEL version number and exit.\n"
"\n"
"You need to provide the following basic options:\n"
" -i, --input=<file> Read reflections from <file>.\n"
@@ -440,6 +442,7 @@ int main(int argc, char *argv[])
/* Long options */
const struct option longopts[] = {
{"help", 0, NULL, 'h'},
+ {"version", 0, NULL, 8 },
{"output", 1, NULL, 'o'},
{"input", 1, NULL, 'i'},
{"beam", 1, NULL, 'b'},
@@ -471,6 +474,11 @@ int main(int argc, char *argv[])
show_help(argv[0]);
return 0;
+ case 8 :
+ printf("CrystFEL: " CRYSTFEL_VERSIONSTRING "\n");
+ printf(CRYSTFEL_BOILERPLATE"\n");
+ return 0;
+
case 'i' :
input_file = strdup(optarg);
break;
diff --git a/src/partialator.c b/src/partialator.c
index c1dedad8..e6069057 100644
--- a/src/partialator.c
+++ b/src/partialator.c
@@ -51,6 +51,7 @@
#include <reflist.h>
#include <reflist-utils.h>
+#include "version.h"
#include "post-refinement.h"
#include "hrs-scaling.h"
#include "scaling-report.h"
@@ -63,6 +64,7 @@ static void show_help(const char *s)
"Scaling and post refinement for coherent nanocrystallography.\n"
"\n"
" -h, --help Display this help message.\n"
+" --version Print CrystFEL version number and exit.\n"
"\n"
" -i, --input=<filename> Specify the name of the input 'stream'.\n"
" -o, --output=<filename> Output filename. Default: partialator.hkl.\n"
@@ -353,6 +355,7 @@ int main(int argc, char *argv[])
const struct option longopts[] = {
{"help", 0, NULL, 'h'},
+ {"version", 0, NULL, 3 },
{"input", 1, NULL, 'i'},
{"output", 1, NULL, 'o'},
{"symmetry", 1, NULL, 'y'},
@@ -388,6 +391,11 @@ int main(int argc, char *argv[])
show_help(argv[0]);
return 0;
+ case 3 :
+ printf("CrystFEL: " CRYSTFEL_VERSIONSTRING "\n");
+ printf(CRYSTFEL_BOILERPLATE"\n");
+ return 0;
+
case 'i' :
infile = strdup(optarg);
break;
diff --git a/src/pattern_sim.c b/src/pattern_sim.c
index b8cc1c68..fca12bab 100644
--- a/src/pattern_sim.c
+++ b/src/pattern_sim.c
@@ -40,6 +40,7 @@
#include <unistd.h>
#include <getopt.h>
+#include "version.h"
#include "image.h"
#include "diffraction.h"
#include "diffraction-gpu.h"
@@ -65,6 +66,7 @@ static void show_help(const char *s)
"pulses of X-rays from a free electron laser.\n"
"\n"
" -h, --help Display this help message.\n"
+" --version Print CrystFEL version number and exit.\n"
"\n"
" -p, --pdb=<file> PDB file from which to get the unit cell.\n"
" (The actual Bragg intensities come from the\n"
@@ -261,6 +263,7 @@ int main(int argc, char *argv[])
/* Long options */
const struct option longopts[] = {
{"help", 0, NULL, 'h'},
+ {"version", 0, NULL, 7 },
{"gpu", 0, &config_gpu, 1},
{"random-orientation", 0, NULL, 'r'},
{"number", 1, NULL, 'n'},
@@ -297,6 +300,11 @@ int main(int argc, char *argv[])
show_help(argv[0]);
return 0;
+ case 7 :
+ printf("CrystFEL: " CRYSTFEL_VERSIONSTRING "\n");
+ printf(CRYSTFEL_BOILERPLATE"\n");
+ return 0;
+
case 'r' :
config_randomquat = 1;
break;
diff --git a/src/process_hkl.c b/src/process_hkl.c
index d5fba397..1916a1ae 100644
--- a/src/process_hkl.c
+++ b/src/process_hkl.c
@@ -41,6 +41,7 @@
#include <unistd.h>
#include <getopt.h>
+#include "version.h"
#include "utils.h"
#include "statistics.h"
#include "reflist-utils.h"
@@ -61,6 +62,7 @@ static void show_help(const char *s)
"Assemble and process FEL Bragg intensities.\n"
"\n"
" -h, --help Display this help message.\n"
+" --version Print CrystFEL version number and exit.\n"
" -i, --input=<filename> Specify input filename (\"-\" for stdin).\n"
" -o, --output=<filename> Specify output filename for merged intensities\n"
" Default: processed.hkl).\n"
@@ -452,6 +454,7 @@ int main(int argc, char *argv[])
{"min-res", 1, NULL, 5},
{"push-res", 1, NULL, 6},
{"res-push", 1, NULL, 6}, /* compat */
+ {"version", 0, NULL, 7},
{0, 0, NULL, 0}
};
@@ -554,6 +557,11 @@ int main(int argc, char *argv[])
push_res = push_res*1e9;
break;
+ case 7 :
+ printf("CrystFEL: " CRYSTFEL_VERSIONSTRING "\n");
+ printf(CRYSTFEL_BOILERPLATE"\n");
+ return 0;
+
case '?' :
break;
diff --git a/src/render_hkl.c b/src/render_hkl.c
index 2eb9ef9a..bdf1bbe6 100644
--- a/src/render_hkl.c
+++ b/src/render_hkl.c
@@ -45,6 +45,7 @@
#include <gsl/gsl_linalg.h>
#include <gsl/gsl_blas.h>
+#include "version.h"
#include "utils.h"
#include "symmetry.h"
#include "render.h"
@@ -96,6 +97,7 @@ static void show_help(const char *s)
" current directory.\n"
"\n"
" -h, --help Display this help message.\n"
+" --version Print CrystFEL version and exit.\n"
);
}
@@ -764,6 +766,7 @@ int main(int argc, char *argv[])
/* Long options */
const struct option longopts[] = {
{"help", 0, NULL, 'h'},
+ {"version", 0, NULL, 5 },
{"zone-axis", 0, &config_zawhinge, 1},
{"output", 1, NULL, 'o'},
{"pdb", 1, NULL, 'p'},
@@ -791,6 +794,11 @@ int main(int argc, char *argv[])
show_help(argv[0]);
return 0;
+ case 5 :
+ printf("CrystFEL: " CRYSTFEL_VERSIONSTRING "\n");
+ printf(CRYSTFEL_BOILERPLATE"\n");
+ return 0;
+
case 'p' :
pdb = strdup(optarg);
break;
diff --git a/version.h.in b/version.h.in
new file mode 100644
index 00000000..6451a0d9
--- /dev/null
+++ b/version.h.in
@@ -0,0 +1,33 @@
+/*
+ * CrystFEL version header
+ *
+ * Copyright © 2014 Deutsches Elektronen-Synchrotron DESY,
+ * a research centre of the Helmholtz Association.
+ *
+ * Author:
+ * 2014 Valerio Mariani <valerio.mariani@desy.de>
+ *
+ * This file is part of CrystFEL.
+ *
+ * CrystFEL is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * CrystFEL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with CrystFEL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#define CRYSTFEL_VERSIONSTRING "$u$$e$"
+#define CRYSTFEL_BOILERPLATE \
+"License GPLv3+: GNU GPL version 3 or later"\
+" <http://gnu.org/licenses/gpl.html>.\n"\
+"This is free software: you are free to change and redistribute it.\n"\
+"There is NO WARRANTY, to the extent permitted by law.\n\n"\
+"Written by Thomas White and others."
diff --git a/version.sh b/version.sh
new file mode 100755
index 00000000..1be14f69
--- /dev/null
+++ b/version.sh
@@ -0,0 +1,25 @@
+#!/bin/bash
+
+top_srcdir=$1
+
+CRYSTFEL_BASE_VERSION=$( cf=( `grep PACKAGE_VERSION config.h` ); echo ${cf[2]} | sed -n 's/"//gp' )
+sed 's/\$u\$/'${CRYSTFEL_BASE_VERSION}'/g' $top_srcdir/version.h.in > version1.tmp
+command -v git > /dev/null 2>&1
+if [ $? -eq 0 ]; then
+ if [ -d ".git" ]; then
+ git log -1 --pretty=%B | grep 'This is CrystFEL' > /dev/null
+ if [ $? -eq 0 ]; then
+ CRYSTFEL_GIT_COMMIT=""
+ else
+ CRYSTFEL_GIT_COMMIT="+"`git rev-parse HEAD`
+ fi
+ fi
+fi
+sed 's/\$e\$/'${CRYSTFEL_GIT_COMMIT}'/g' version1.tmp > version2.tmp
+diff version.h version2.tmp > /dev/null
+if [ $? -ne 0 ]; then
+ mv version2.tmp version.h
+ rm version1.tmp
+else
+ rm version1.tmp version2.tmp
+fi