aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil-cisco@xs4all.nl>2020-10-21 15:59:28 +0200
committerHans Verkuil <hverkuil-cisco@xs4all.nl>2020-10-21 15:59:28 +0200
commitfbf328f0b02eabe973a9c837bdbb507d803f9835 (patch)
tree16afc8eaacc40be6625dd6dc1b10599448dd465e
parent01bf31643024cfbfb0f47c8860b431305b9bf256 (diff)
cec utils and v4l2-compliance: improve version info
Various versioning changes: - GIT_SHA is now a SHA with length 12, the full SHA was a bit ridiculous. - the CEC/V4L2 compliance-related utilities now also report the last git commit date in UTC to make it easier to verify that the git repo is recent enough. - show the versioning as well for the cec-ctl power cycle tests. - don't show the git info if it wasn't build from a git repo. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
-rw-r--r--configure.ac5
-rw-r--r--utils/cec-compliance/Makefile.am2
-rw-r--r--utils/cec-compliance/cec-compliance.cpp11
-rw-r--r--utils/cec-ctl/Makefile.am2
-rw-r--r--utils/cec-ctl/cec-ctl.cpp7
-rw-r--r--utils/cec-follower/Makefile.am2
-rw-r--r--utils/cec-follower/cec-follower.cpp8
-rw-r--r--utils/v4l2-compliance/Makefile.am2
-rw-r--r--utils/v4l2-compliance/v4l2-compliance.cpp15
9 files changed, 35 insertions, 19 deletions
diff --git a/configure.ac b/configure.ac
index e6134d08..c59d247e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -579,11 +579,14 @@ fi
CPPFLAGS="-I\$(top_srcdir)/lib/include -Wall -Wpointer-arith -D_GNU_SOURCE $CPPFLAGS"
# Obtain git SHA of HEAD
-AC_SUBST(GIT_SHA, ["-DGIT_SHA=\$(shell if test -d \$(top_srcdir)/.git ; then git -C \$(top_srcdir) rev-parse HEAD ; else printf '\"not available\"'; fi)"])
+AC_SUBST(GIT_SHA, ["-DGIT_SHA=\$(shell if test -d \$(top_srcdir)/.git ; then git -C \$(top_srcdir) rev-parse --short=12 HEAD ; fi)"])
# Obtain git commit count of HEAD
AC_SUBST(GIT_COMMIT_CNT, ["-DGIT_COMMIT_CNT=\$(shell if test -d \$(top_srcdir)/.git ; then printf '-'; git -C \$(top_srcdir) rev-list --count HEAD ; fi)"])
+# Obtain git commit date of HEAD
+AC_SUBST(GIT_COMMIT_DATE, ["-DGIT_COMMIT_DATE=\$(shell if test -d \$(top_srcdir)/.git ; then printf '\"'; TZ=UTC git -C \$(top_srcdir) show --quiet --date='format-local:%F %T\"' --format=\"%cd\"; fi)"])
+
AM_COND_IF([WITH_LIBDVBV5], [USE_LIBDVBV5="yes"], [USE_LIBDVBV5="no"])
AM_COND_IF([WITH_DVBV5_REMOTE], [USE_DVBV5_REMOTE="yes"
AC_DEFINE([HAVE_DVBV5_REMOTE], [1], [Usage of DVBv5 remote enabled])],
diff --git a/utils/cec-compliance/Makefile.am b/utils/cec-compliance/Makefile.am
index a9c59ca6..93c1b568 100644
--- a/utils/cec-compliance/Makefile.am
+++ b/utils/cec-compliance/Makefile.am
@@ -2,7 +2,7 @@ bin_PROGRAMS = cec-compliance
man_MANS = cec-compliance.1
cec_compliance_SOURCES = cec-compliance.cpp cec-compliance.h cec-test.cpp cec-test-adapter.cpp cec-test-audio.cpp cec-test-power.cpp cec-test-fuzzing.cpp
-cec_compliance_CPPFLAGS = -I$(top_srcdir)/utils/libcecutil $(GIT_SHA) $(GIT_COMMIT_CNT)
+cec_compliance_CPPFLAGS = -I$(top_srcdir)/utils/libcecutil $(GIT_SHA) $(GIT_COMMIT_CNT) $(GIT_COMMIT_DATE)
cec_compliance_LDADD = -lrt ../libcecutil/libcecutil.la
EXTRA_DIST = cec-compliance.1
diff --git a/utils/cec-compliance/cec-compliance.cpp b/utils/cec-compliance/cec-compliance.cpp
index 33645319..282704f6 100644
--- a/utils/cec-compliance/cec-compliance.cpp
+++ b/utils/cec-compliance/cec-compliance.cpp
@@ -1257,8 +1257,11 @@ int main(int argc, char **argv)
show_info = true;
break;
case OptVersion:
- printf("cec-compliance %s%s\n", PACKAGE_VERSION, STRING(GIT_COMMIT_CNT));
- printf("cec-compliance SHA: %s\n", STRING(GIT_SHA));
+ printf("cec-compliance %s%s\n",
+ PACKAGE_VERSION, STRING(GIT_COMMIT_CNT));
+ if (strlen(STRING(GIT_SHA)))
+ printf("cec-compliance SHA: %s %s\n",
+ STRING(GIT_SHA), STRING(GIT_COMMIT_DATE));
std::exit(EXIT_SUCCESS);
case ':':
fprintf(stderr, "Option '%s' requires a value\n",
@@ -1394,7 +1397,9 @@ int main(int argc, char **argv)
if (options[OptInteractive])
test_tags |= TAG_INTERACTIVE;
- printf("cec-compliance SHA : %s\n", STRING(GIT_SHA));
+ if (strlen(STRING(GIT_SHA)))
+ printf("cec-compliance SHA : %s %s\n",
+ STRING(GIT_SHA), STRING(GIT_COMMIT_DATE));
node.phys_addr = CEC_PHYS_ADDR_INVALID;
doioctl(&node, CEC_ADAP_G_PHYS_ADDR, &node.phys_addr);
diff --git a/utils/cec-ctl/Makefile.am b/utils/cec-ctl/Makefile.am
index de04c4de..27e69494 100644
--- a/utils/cec-ctl/Makefile.am
+++ b/utils/cec-ctl/Makefile.am
@@ -2,7 +2,7 @@ bin_PROGRAMS = cec-ctl
man_MANS = cec-ctl.1
cec_ctl_SOURCES = cec-ctl.cpp cec-pin.cpp cec-ctl.h
-cec_ctl_CPPFLAGS = -I$(top_srcdir)/utils/libcecutil $(GIT_COMMIT_CNT)
+cec_ctl_CPPFLAGS = -I$(top_srcdir)/utils/libcecutil $(GIT_SHA) $(GIT_COMMIT_CNT) $(GIT_COMMIT_DATE)
cec_ctl_LDADD = -lrt -lpthread ../libcecutil/libcecutil.la
EXTRA_DIST = cec-ctl.1
diff --git a/utils/cec-ctl/cec-ctl.cpp b/utils/cec-ctl/cec-ctl.cpp
index 9213aec6..a7b35826 100644
--- a/utils/cec-ctl/cec-ctl.cpp
+++ b/utils/cec-ctl/cec-ctl.cpp
@@ -236,6 +236,8 @@ static void print_version()
#define STR(x) #x
#define STRING(x) STR(x)
printf("cec-ctl %s%s\n", PACKAGE_VERSION, STRING(GIT_COMMIT_CNT));
+ if (strlen(STRING(GIT_SHA)))
+ printf("cec-ctl SHA: %s %s\n", STRING(GIT_SHA), STRING(GIT_COMMIT_DATE));
}
static void usage()
@@ -2626,6 +2628,11 @@ int main(int argc, char **argv)
phys_addrs[la] = (phys_addr << 8) | la;
}
+ if (options[OptTestPowerCycle] || options[OptStressTestPowerCycle]) {
+ print_version();
+ printf("\n");
+ }
+
if (!options[OptSkipInfo]) {
struct cec_connector_info conn_info = {};
diff --git a/utils/cec-follower/Makefile.am b/utils/cec-follower/Makefile.am
index 1108708b..903d3715 100644
--- a/utils/cec-follower/Makefile.am
+++ b/utils/cec-follower/Makefile.am
@@ -2,7 +2,7 @@ bin_PROGRAMS = cec-follower
man_MANS = cec-follower.1
cec_follower_SOURCES = cec-follower.cpp cec-follower.h cec-processing.cpp cec-tuner.cpp
-cec_follower_CPPFLAGS = -I$(top_srcdir)/utils/libcecutil $(GIT_SHA) $(GIT_COMMIT_CNT)
+cec_follower_CPPFLAGS = -I$(top_srcdir)/utils/libcecutil $(GIT_SHA) $(GIT_COMMIT_CNT) $(GIT_COMMIT_DATE)
cec_follower_LDADD = -lrt ../libcecutil/libcecutil.la
EXTRA_DIST = cec-follower.1
diff --git a/utils/cec-follower/cec-follower.cpp b/utils/cec-follower/cec-follower.cpp
index 94173d73..81dac076 100644
--- a/utils/cec-follower/cec-follower.cpp
+++ b/utils/cec-follower/cec-follower.cpp
@@ -437,7 +437,9 @@ int main(int argc, char **argv)
break;
case OptVersion:
printf("cec-follower %s%s\n", PACKAGE_VERSION, STRING(GIT_COMMIT_CNT));
- printf("cec-follower SHA: %s\n", STRING(GIT_SHA));
+ if (strlen(STRING(GIT_SHA)))
+ printf("cec-follower SHA: %s %s\n",
+ STRING(GIT_SHA), STRING(GIT_COMMIT_DATE));
std::exit(EXIT_SUCCESS);
case ':':
fprintf(stderr, "Option '%s' requires a value\n",
@@ -488,7 +490,9 @@ int main(int argc, char **argv)
node.state.toggle_power_status = toggle_power_status;
state_init(node);
- printf("cec-follower SHA : %s\n", STRING(GIT_SHA));
+ if (strlen(STRING(GIT_SHA)))
+ printf("cec-follower SHA : %s %s\n",
+ STRING(GIT_SHA), STRING(GIT_COMMIT_DATE));
doioctl(&node, CEC_ADAP_G_PHYS_ADDR, &node.phys_addr);
diff --git a/utils/v4l2-compliance/Makefile.am b/utils/v4l2-compliance/Makefile.am
index 2f887735..e4dab9a7 100644
--- a/utils/v4l2-compliance/Makefile.am
+++ b/utils/v4l2-compliance/Makefile.am
@@ -14,7 +14,7 @@ v4l2_compliance_SOURCES = v4l2-compliance.cpp v4l2-compliance.h \
v4l2-test-controls.cpp v4l2-test-io-config.cpp v4l2-test-formats.cpp v4l2-test-buffers.cpp \
v4l2-test-codecs.cpp v4l2-test-subdevs.cpp v4l2-test-media.cpp v4l2-test-colors.cpp \
media-info.cpp v4l2-info.cpp
-v4l2_compliance_CPPFLAGS = -I$(top_srcdir)/utils/common $(GIT_SHA) $(GIT_COMMIT_CNT)
+v4l2_compliance_CPPFLAGS = -I$(top_srcdir)/utils/common $(GIT_SHA) $(GIT_COMMIT_CNT) $(GIT_COMMIT_DATE)
if WITH_V4L2_COMPLIANCE_LIBV4L
v4l2_compliance_LDADD = ../../lib/libv4l2/libv4l2.la ../../lib/libv4lconvert/libv4lconvert.la -lrt -lpthread
diff --git a/utils/v4l2-compliance/v4l2-compliance.cpp b/utils/v4l2-compliance/v4l2-compliance.cpp
index 4ff0a303..1fc9fd0c 100644
--- a/utils/v4l2-compliance/v4l2-compliance.cpp
+++ b/utils/v4l2-compliance/v4l2-compliance.cpp
@@ -150,14 +150,11 @@ static struct option long_options[] = {
static void print_sha()
{
- printf("v4l2-compliance SHA: %s", STRING(GIT_SHA));
- printf(", %zd bits, %zd-bit time_t\n", sizeof(void *) * 8, sizeof(time_t) * 8);
- printf("\n");
-}
-
-static void print_version()
-{
- printf("v4l2-compliance %s%s\n", PACKAGE_VERSION, STRING(GIT_COMMIT_CNT));
+ printf("v4l2-compliance %s%s, ", PACKAGE_VERSION, STRING(GIT_COMMIT_CNT));
+ printf("%zd bits, %zd-bit time_t\n", sizeof(void *) * 8, sizeof(time_t) * 8);
+ if (strlen(STRING(GIT_SHA)))
+ printf("v4l2-compliance SHA: %s %s\n",
+ STRING(GIT_SHA), STRING(GIT_COMMIT_DATE));
}
static void usage()
@@ -1659,7 +1656,6 @@ int main(int argc, char **argv)
no_progress = true;
break;
case OptVersion:
- print_version();
print_sha();
std::exit(EXIT_SUCCESS);
case ':':
@@ -1685,6 +1681,7 @@ int main(int argc, char **argv)
}
print_sha();
+ printf("\n");
bool direct = !options[OptUseWrapper];
int fd;

Privacy Policy