Open dstndstn opened 10 years ago
Hello Dustin,
I have some additional suggestions on issue: "solve-field: provide a --version option #10". Compiling and running the current pull request: https://github.com/dstndstn/astrometry.net/pull/12 gives:
>blind/solve-field
...
# This program is part of the Astrometry.net suite.
# For details, visit http://astrometry.net.
# Git URL https://github.com/dstndstn/astrometry.net
# Revision 0.50-87-gc069c8a, date Wed Oct 8 22:56:14 2014 +0200.
Usage: blind/solve-field [options] [<image-file-1> <image-file-2> ...] [<xyls-file-1> <xyls-file-2> ...]
...
How about defining besides the detailed revision (PRG_GIT_REVISION) also the release version (RELEASE_VER), that is:
PRG_GIT_REVISION := $(shell git describe)
PRG_GIT_DATE := $(shell git log -n 1 --format=\"%cd\")
PRG_GIT_URL := "https://github.com/dstndstn/astrometry.net"
RELEASE_VER := $(shell echo $(PRG_GIT_REVISION) | cut -f1 -d"-")
define VERSION_H
/* Generated file, do not edit. */
#define PRG_GIT_REVISION "$(PRG_GIT_REVISION)"
#define RELEASE_VER "$(RELEASE_VER)"
#define PRG_GIT_DATE $(PRG_GIT_DATE)
#define PRG_GIT_URL $(PRG_GIT_URL)
endef
export VERSION_H
version:
@echo "$$VERSION_H" > version.h
.PHONY: version
and replacing in macro PRG_GIT_REVISION by RELEASE_VER:
#define BOILERPLATE_HELP_HEADER(fid) \
do { \
fprintf(fid, "This program is part of the Astrometry.net suite.\n"); \
fprintf(fid, "For details, visit http://astrometry.net.\n"); \
fprintf(fid, "Git URL %s\n", PRG_GIT_URL); \
fprintf(fid, "Revision %s, date %s.\n", RELEASE_VER, PRG_GIT_DATE);\
} while (0)
so one would get:
# For details, visit http://astrometry.net.
# Git URL https://github.com/dstndstn/astrometry.net
# Revision 0.50, date Wed Oct 8 22:56:14 2014 +0200.
As written in issue #10 one could add the flag --version
...
static an_option_t options[] = {
{'h', "help", no_argument, NULL,
"print this help message" },
{'\x89', "version", no_argument, NULL,
...
where the --version output would show the detailed PRG_GIT_REVISION:
# Git URL https://github.com/dstndstn/astrometry.net
# Git Revision 0.50-87-gc069c8a, date Wed Oct 8 22:56:14 2014 +0200.
In terms of the other macro:
#define BOILERPLATE_ADD_FITS_HEADERS(hdr) \
do { \
fits_add_long_history(hdr, "Created by the Astrometry.net suite."); \
fits_add_long_history(hdr, "For more details, see http://astrometry.net.");\
fits_add_long_history(hdr, "Git URL %s", PRG_GIT_URL); \
fits_add_long_history(hdr, "Git revision %s", PRG_GIT_REVISION); \
fits_add_long_history(hdr, "Git date %s", PRG_GIT_DATE); \
} while (0)
One could either add the detailed Git revision information, or the (short) release version into the fits header.
Cheers Thomas
Just submitted a new pull request with patches for replacing deprecated SVN fields with GIT fields. The GIT fields (strings) are provided via CFLAGS in util/makefile.common:
AN_GIT_REVISION := $(shell git describe)
AN_GIT_DATE := $(shell git log -n 1 --format=\"%cd\")
AN_GIT_URL := "https://github.com/dstndstn/astrometry.net"
CFLAGS_DEF += -DAN_GIT_REVISION=\"$(AN_GIT_REVISION)\"
CFLAGS_DEF += -DAN_GIT_DATE=\"$(AN_GIT_DATE)\"
CFLAGS_DEF += -DAN_GIT_URL=\"$(AN_GIT_URL)\"
Cheers Thomas
The svn version info doesn't work any more...