Make jq --version report an actual git revision.
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Closes #129.
authored by Stephen Dolan · committed by Stephen Dolan · parent cbd422d · Browse files · 4 files·+14 added−7 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
4 files+14 added−7 removed
- other:+14 added−7 removed
Provenance
- Commit
f0b9827- Tree
7d23609- Author
Stephen Dolan <mu@netsoc.tcd.ie>- Committer
Stephen Dolan <mu@netsoc.tcd.ie>- Parent
cbd422d
4 files changed+14 added−7 removed
added:scripts/version+5 added
1+#!/bin/sh2+set -e3+cd `dirname "$0"`4+git rev-parse --verify -q jq-1.0 > /dev/null 2>&15+git describe --always --match 'jq-*' --dirty | sed 's/^jq-//'modified:.gitignore+1 added
24 unmodified lines25 jq-*.tar.gz26 configure27 aclocal.m428 Makefile.in29+version.hmodified:main.c+3 added-2 removed
7 unmodified lines8 #include "jv_parse.h"9 #include "execute.h"10 #include "config.h" /* Autoconf generated header file */11 #include "jv_alloc.h"12+#include "version.h"13 14 int jq_testsuite(int argc, char* argv[]);15 16 static const char* progname;17 18 static void usage() {18- fprintf(stderr, "\njq - commandline JSON processor [version %s]\n", PACKAGE_VERSION);19+ fprintf(stderr, "\njq - commandline JSON processor [version %s]\n", JQ_VERSION);20 fprintf(stderr, "Usage: %s [options] <jq filter> [file...]\n\n", progname);21 fprintf(stderr, "For a description of the command line options and\n");22 fprintf(stderr, "how to write jq filters (and why you might want to)\n");23 fprintf(stderr, "see the jq manpage, or the online documentation at\n");214 unmodified lines238 jq_flags |= JQ_DEBUG_TRACE;239 } else if (isoption(argv[i], 'h', "help")) {240 usage();241 } else if (isoption(argv[i], 'V', "version")) {241- fprintf(stderr, "jq version %s\n", PACKAGE_VERSION);242+ fprintf(stderr, "jq-%s\n", JQ_VERSION);243 return 0;244 } else {245 fprintf(stderr, "%s: Unknown option %s\n", progname, argv[i]);246 die();88 unmodified linesmodified:Makefile.am+5 added-5 removed
31 unmodified lines32 33 34 ### Building the jq binary35 36-main.c: config.h36+version.h:37+ @ { $(srcdir)/scripts/version || echo '$(VERSION)'; } | sed 's/.*/#define JQ_VERSION "&"/'> $@38 39+main.c: config.h version.h40+41 bin_PROGRAMS = jq42 jq_SOURCES = ${JQ_SRC} main.c43 44 52 unmodified lines97 # Still, as a matter of allowing patching, its not a bad idea to distribute 98 # the developer setup script in the tarball.99 EXTRA_DIST = config.h.in $(BUILT_SOURCES) $(man_MANS) $(TESTS) \100 $(TEST_LOG_COMPILER) gen_utf8_tables.py jq.spec \98- $(DOC_FILES)101+ $(DOC_FILES) scripts/version102 103 # README.md is expected in Github projects, good stuff in it, so we'll 104 # distribute it and install it with the package in the doc directory.105 docdir = ${datadir}/doc/${PACKAGE}106 dist_doc_DATA = README.md COPYING AUTHORS README107 105-releasetag:106- git tag -s "jq-$$(cat VERSION)" -m "jq release $$(cat VERSION)"107-108 RELEASE ?= 1109 rpm: jq110 @echo "Packaging jq as an RPM ..."111 mkdir -p rpm/SOURCES rpm/BUILD rpm/BUILDROOT rpm/RPMS rpm/SPECS15 unmodified lines