Skip to content
Myr

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

4 files+14 added−7 removed

added:scripts/version+5 added
1#!/bin/sh2set -e3cd `dirname "$0"`4git rev-parse --verify -q jq-1.0 > /dev/null 2>&15git describe --always --match 'jq-*' --dirty | sed 's/^jq-//'
modified:.gitignore+1 added
24 unmodified lines
25jq-*.tar.gz26configure27aclocal.m428Makefile.in29version.h
modified:main.c+3 added-2 removed
7 unmodified lines
8#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"1314int jq_testsuite(int argc, char* argv[]);1516static const char* progname;1718static 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 lines
238 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 lines
modified:Makefile.am+5 added-5 removed
31 unmodified lines
323334### Building the jq binary3536main.c: config.h36version.h:37 @ { $(srcdir)/scripts/version || echo '$(VERSION)'; } | sed 's/.*/#define JQ_VERSION "&"/'> $@3839main.c: config.h version.h4041bin_PROGRAMS = jq42jq_SOURCES = ${JQ_SRC} main.c4344
52 unmodified lines
97# Still, as a matter of allowing patching, its not a bad idea to distribute 98# the developer setup script in the tarball.99EXTRA_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/version102103# 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.105docdir = ${datadir}/doc/${PACKAGE}106dist_doc_DATA = README.md COPYING AUTHORS README107105releasetag:106 git tag -s "jq-$$(cat VERSION)" -m "jq release $$(cat VERSION)"107108RELEASE ?= 1109rpm: jq110 @echo "Packaging jq as an RPM ..."111 mkdir -p rpm/SOURCES rpm/BUILD rpm/BUILDROOT rpm/RPMS rpm/SPECS
15 unmodified lines