Skip to content

Commit 8657267

Browse files
committed
NHC: Clean up packaging & versioning for release
I came up with a handy little set of RPM macros that use `git` commands to embed multiple bits of useful information into the RPM's `RELEASE` field (e.g., commit hash, commit count since last tag) while still guaranteeing to preserve correct version sorting for RPM upgrades. The release handling in the specfile has been updated accordingly. I also set up the `.in` version of the specfile along with `configure.ac` to both query the above Git metadata if available, so hopefully the right stuff will be there no matter which source tarball or Git repo users build from. And finally, I updating some specfile wording and such. Getting ready to release (at last)!
1 parent 5d9a8d7 commit 8657267

File tree

2 files changed

+35
-20
lines changed

2 files changed

+35
-20
lines changed

configure.ac

+11-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1+
m4_define([nhc_pkgname], [lbnl-nhc])
2+
m4_define([nhc_version], [1.4.3])
3+
m4_define([nhc_address], [[email protected]])
4+
15
AC_PREREQ(2.59)
2-
AC_INIT([lbnl-nhc], [1.4.3], [[email protected]])
6+
AC_INIT(defn([nhc_pkgname]), defn([nhc_version]), defn([nhc_address]))
37
AC_CONFIG_SRCDIR([.])
48

59
AC_PROG_INSTALL
@@ -18,16 +22,16 @@ dnl# "autoconf" time, when we're sure to have a Git repo, rather than configure
1822
dnl# time. We have to change the m4 quote characters due to the regex we use.
1923
AC_MSG_CHECKING([for Git version description])
2024
changequote(<<, >>)dnl
21-
GITVERSION=m4_esyscmd(<<git describe --long --dirty | tr -d '\012' | sed -e 's/^[^-]*-//;s/-/./g;s/dirty/1/'>>)
25+
GITRELEASE=m4_esyscmd(<<git describe --tags HEAD | grep -Eq "^>>nhc_version<<" >&/dev/null && echo -n 1. || echo -n 0. ; git describe --abbrev=4 --always --tags --long --match '[[:digit:]][[:alnum:].]*[[:alnum:]]' --dirty=.1 | cut -d- -f 2- | tr '-' '.'>>)
2226
changequote([, ])dnl
2327

24-
if test -n "$GITVERSION" ; then
25-
AC_MSG_RESULT([$GITVERSION])
28+
if test -n "$GITRELEASE" ; then
29+
AC_MSG_RESULT([$GITRELEASE])
2630
else
27-
GITVERSION=0.g0000000
28-
AC_MSG_RESULT([unknown, using default $GITVERSION])
31+
GITRELEASE=0.g0000
32+
AC_MSG_RESULT([unknown, using default $GITRELEASE])
2933
fi
30-
AC_SUBST([GITVERSION])
34+
AC_SUBST([GITRELEASE])
3135

3236
AC_OUTPUT([
3337
Makefile

lbnl-nhc.spec.in

+24-13
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,25 @@
1-
%{!?_rel:%{expand:%%global _rel 0.@GITVERSION@}}
1+
%global name @PACKAGE@
2+
%global version @VERSION@
3+
%global release %{rel}%{?dist}
4+
5+
%global gitrelease @GITRELEASE@
6+
%{expand:%%global gd_rel_delta %(git describe --abbrev=4 --always --tags --long --match '[[:digit:]][[:alnum:].]*[[:alnum:]]' --dirty=.1 | cut -d- -f 2- | tr '-' '.')}
7+
%{expand:%%global rel_pre_post %(git describe --tags HEAD | grep -Eq '^%{version}' >&/dev/null && echo 1. || echo 0.)}
8+
%{expand:%%global spec_rel %{rel_pre_post}%{gd_rel_delta}}
9+
%{!?rel:%{expand:%%global rel %(if test -z "%{spec_rel}" ; then echo "%{gitrelease}" ; else echo "%{spec_rel}" ; fi)}}
210

311
%{!?sname:%global sname nhc}
412
%{!?nhc_script_dir:%global nhc_script_dir %{_sysconfdir}/%{sname}/scripts}
513
%{!?nhc_helper_dir:%global nhc_helper_dir %{_libexecdir}/%{sname}}
614

15+
716
Summary: LBNL Node Health Check
8-
Name: @PACKAGE@
9-
Version: @VERSION@
10-
Release: %{_rel}%{?dist}
17+
Name: %{name}
18+
Version: %{version}
19+
Release: %{release}
1120
#Release: 1%{?dist}
12-
License: BSD-3-Clause-LBNL (https://opensource.org/BSD-3-Clause-LBNL)
21+
# LBNL Open Source License: https://opensource.org/BSD-3-Clause-LBNL
22+
License: BSD-3-Clause-LBNL
1323
Group: Applications/System
1424
URL: https://github.com/mej/nhc/
1525
Source: https://github.com/mej/nhc/archive/%{name}-%{version}.tar.gz
@@ -21,14 +31,15 @@ BuildArch: noarch
2131
BuildRoot: %{?_tmppath}%{!?_tmppath:/var/tmp}/%{name}-%{version}-%{release}-root
2232

2333
%description
24-
This package contains the LBNL Node Health Check system.
25-
26-
TORQUE (and other resource managers) allow for the execution of a
27-
script to determine if a node is "healthy" or "unhealthy" and
28-
potentially mark unhealthy nodes as unavailable. The scripts
29-
contained in this package provide a flexible, extensible mechanism for
30-
collecting health checks to be run on your cluster and specifying
31-
which checks should be run on which nodes.
34+
This package contains the LBNL Node Health Check (NHC) system.
35+
Originally written to serve a very specific niche in validating
36+
compute nodes of High-Performance Computing (HPC) clusters, its unique
37+
combination of extensibility, portability, simplicity, and efficiency
38+
have made it a popular general-purpose system health monitoring and
39+
management tool.
40+
41+
Complete documentation and example use cases are available on the
42+
project home page at https://github.com/mej/nhc
3243

3344

3445
%prep

0 commit comments

Comments
 (0)