Skip to content

Commit c0acf09

Browse files
committed
The Easter Bug hunt is over, release NUT v2.8.3 finally
Signed-off-by: Jim Klimov <[email protected]>
2 parents a794c85 + 737f658 commit c0acf09

File tree

7 files changed

+287
-45
lines changed

7 files changed

+287
-45
lines changed

common/common.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,10 @@ const char *describe_NUT_VERSION_once(void)
623623
if (1 < snprintf(buf, sizeof(buf),
624624
"%s %s%s%s",
625625
NUT_VERSION_MACRO,
626-
NUT_VERSION_IS_RELEASE ? "release" : "(development iteration after ",
626+
NUT_VERSION_IS_RELEASE ? "release" :
627+
(NUT_VERSION_IS_PRERELEASE
628+
? "(pre-release iteration of "
629+
: "(development iteration after "),
627630
NUT_VERSION_IS_RELEASE ? "" : NUT_VERSION_SEMVER_MACRO,
628631
NUT_VERSION_IS_RELEASE ? "" : ")"
629632
)) {

configure.ac

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,20 @@ NUT_SOURCE_GITREV="`NUT_VERSION_QUERY=DESC50 "${srcdir}/tools/gitlog2version.sh"
5151

5252
dnl A true/false (literally) response that can be used for prettier messages
5353
dnl emitted by NUT code.
54-
NUT_SOURCE_GITREV_IS_RELEASE="`NUT_VERSION_QUERY=IS_RELEASE "${srcdir}/tools/gitlog2version.sh" 2>/dev/null`"
55-
AS_IF([$NUT_SOURCE_GITREV_IS_RELEASE], [NUT_SOURCE_GITREV_DEVREL="release"], [NUT_SOURCE_GITREV_DEVREL="development iteration"])
54+
NUT_SOURCE_GITREV_IS_RELEASE="`NUT_VERSION_QUERY=IS_RELEASE "${srcdir}/tools/gitlog2version.sh" 2>/dev/null || echo false`"
55+
NUT_SOURCE_GITREV_IS_PRERELEASE="`NUT_VERSION_QUERY=IS_PRERELEASE "${srcdir}/tools/gitlog2version.sh" 2>/dev/null || echo false`"
56+
57+
AS_IF([$NUT_SOURCE_GITREV_IS_RELEASE], [NUT_SOURCE_GITREV_DEVREL="release"], [
58+
AS_IF([$NUT_SOURCE_GITREV_IS_PRERELEASE], [NUT_SOURCE_GITREV_DEVREL="pre-release"],
59+
[NUT_SOURCE_GITREV_DEVREL="development iteration"])
60+
])
5661

5762
dnl Semantic version of most-recent NUT release this code is derived from.
5863
dnl It may equal the NUT_SOURCE_GITREV and NUT_SOURCE_GITREV_NUMERIC, but
59-
dnl this situation is only expected if NUT_SOURCE_GITREV_IS_RELEASE==true.
64+
dnl this situation is only expected if NUT_SOURCE_GITREV_IS_RELEASE==true;
65+
dnl for a pre-release it may differ from even the base NUT_VERSION numbers
66+
dnl (e.g. a commit tagged as 2.8.3-rc5 can have its own NUT_VERSION based
67+
dnl on 2.8.2-something, but is assumed as a pre-release for 2.8.3 SEMVER).
6068
NUT_SOURCE_GITREV_SEMVER="`NUT_VERSION_QUERY=SEMVER "${srcdir}/tools/gitlog2version.sh" 2>/dev/null`"
6169

6270
dnl Gitrev-based build identifier which can be used for e.g. PyPI uploads:
@@ -5513,6 +5521,7 @@ AC_SUBST(NUT_NETVERSION)
55135521
AC_SUBST(FORCE_NUT_VERSION)
55145522
AC_SUBST(NUT_SOURCE_GITREV)
55155523
AC_SUBST(NUT_SOURCE_GITREV_IS_RELEASE)
5524+
AC_SUBST(NUT_SOURCE_GITREV_IS_PRERELEASE)
55165525
AC_SUBST(NUT_SOURCE_GITREV_SEMVER)
55175526
AC_SUBST(NUT_SOURCE_GITREV_NUMERIC)
55185527
AC_SUBST(NUT_WEBSITE_BASE)

docs/maintainer-guide.txt

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,13 +170,46 @@ symbol names and API versions, similar to what `GNUC` or `SUNW` libraries do.
170170
file (DO NOT add them to git to avoid confusion later, or revert any such
171171
addition after the release -- still has a chance to confuse e.g. branches
172172
made from release tag later):
173+
*** Automation was introduced to help maintain these files, e.g.:
173174
+
174175
----
176+
# Current commit MUST be git-tagged for *-(rc|alpha|beta) for magic to work:
177+
:; git tag v2.8.3-rc7
178+
179+
:; NUT_VERSION_QUERY="UPDATE_FILE_GIT_RELEASE" ./tools/gitlog2version.sh
180+
SEMVER=2.8.3; TRUNK='upstream/master'; BASE='735451f1f21556f2a7b8443053e8962c2184239f';
181+
DESC='v2.8.2-2881+gbdade6241' => TAG='v2.8.2' + SUFFIX='-2881+gbdade6241+v2.8.3+rc7'
182+
=> VER5='2.8.2.2878.3' => DESC5='2.8.2.2878.3-2881+gbdade6241+v2.8.3+rc7'
183+
=> VER50='2.8.2.2878.3' => DESC50='2.8.2.2878.3-2881+gbdade6241+v2.8.3+rc7'
184+
185+
# Note it assigns SEMVER from the pre-release tag, but other git info from
186+
# real git-describe details
187+
188+
# You can verify current contents of these files with:
189+
:; grep . VER*
190+
VERSION_FORCED:NUT_VERSION_FORCED='2.8.2.2878.3-2881+gbdade6241+v2.8.3+rc7'
191+
VERSION_FORCED_SEMVER:NUT_VERSION_FORCED_SEMVER='2.8.3'
192+
----
193+
*** An older, possibly more reliable, way would go like this:
194+
+
195+
----
196+
# Do not let them be easily deleted by e.g. `git clean -fdX` while you
197+
# would inevitably iterate the release attempts - keep in a subdir, and
198+
# juggle hardlinks (so they are archived into the tarball as real files):
199+
:; rm -rf .relver
200+
:; mkdir -p .relver
201+
175202
# Generally may be the nuanced NUT SEMVER; is a triplet for releases
176-
:; echo 'NUT_VERSION_FORCED="2.8.3"' > VERSION_FORCED
203+
# or suffixed for release candidates
204+
:; echo 'NUT_VERSION_FORCED="2.8.3"' > .relver/VERSION_FORCED
205+
:; echo 'NUT_VERSION_FORCED="2.8.3-rc1"' > .relver/VERSION_FORCED
177206

178207
# Should always be a triplet
179-
:; echo 'NUT_VERSION_FORCED_SEMVER="2.8.3"' > VERSION_FORCED_SEMVER
208+
:; echo 'NUT_VERSION_FORCED_SEMVER="2.8.3"' > .relver/VERSION_FORCED_SEMVER
209+
210+
# Do not let them be easily lost; later you can just re-create these links
211+
# if file names in your top_srcdir are removed:
212+
:; ln .relver/* .
180213
----
181214
*** Note that since NUT v2.8.3 this script dictates the version propagated by
182215
the `configure` script, so direct changes of `AC_INIT` there are no longer

docs/nut-versioning.adoc

Lines changed: 64 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ Current NUT SEMVER definition
5454
Since NUT v2.8.3, the definition which goes into `AC_INIT` and further into
5555
the code was extended in a manner similar to what `git describe` produces,
5656
but with added numbers after the common triplet of semantically versioned
57-
numbers: `X.Y.Z(.T(.B(-C+gHASH)))`
57+
numbers: `X.Y.Z(.T(.B(-C+H(+R))))` or `X.Y.Z(.T(.B(-R)))`
5858

5959
* Standard semver (used in releases):
6060
+
@@ -76,7 +76,15 @@ The optional suffix (only for commits which are not git tags themselves)
7676
is provided by `git describe`:
7777

7878
* C: Commits on branch since previous release tag
79-
* H: Git hash (prefixed by `g` character) of the described commit
79+
* H: (Short) Git hash (prefixed by "g" character) of the described commit
80+
81+
The pre-release information (if provided/known) would either follow the
82+
optional suffix detailed above, or it would be the suffix itself:
83+
84+
* R: If this commit has a non-release tag, it can be optionally reported
85+
so we know that a commit some '1234' iterations after release 'N' is
86+
also a release candidate for 'N+1'. Note that any dash in that tag value
87+
will be replaced by a plus, e.g. `2.8.2.2878.1-2879+g882dd4b00+v2.8.3+rc6`
8088
8189
The numeric part of NUT SEMVER definition mostly follows https://semver.org/
8290
except that for development iterations the base version may have up to
@@ -118,7 +126,8 @@ implementations).
118126
may be just a triplet) to this value and enforce
119127
`NUT_VERSION_PREFER_GIT=false`. Usually sourced
120128
from `${abs_top_srcdir}/VERSION_FORCED` (if present)
121-
| `2.8.3.2379`
129+
| `2.8.2.2379` `2.8.3-rc3`
130+
`2.8.2.2878.3-2881+g45029249f+v2.8.3+rc6`
122131
|`NUT_VERSION_FORCED_SEMVER` | Set `SEMVER` (exactly a triplet) to this value
123132
regardless of `NUT_VERSION_PREFER_GIT` setting. Usually
124133
sourced from `${abs_top_srcdir}/VERSION_FORCED_SEMVER`
@@ -210,18 +219,27 @@ implementations).
210219
numeric components as needed or dropping extras, to have
211220
*exactly 3* of them
212221
| `2.8.0`
213-
|`VER5` and `DESC5` | Full 5-component version, `NUT_VERSION_DEFAULT5`
222+
|`SUFFIX` | Empty, unless `NUT_VERSION_DEFAULT` had a suffix
223+
for pre-release information roughly matching the
224+
`-(rc|alpha|beta)[0-9]*` regular expression
225+
| `""` `-rc6`
226+
|`VER5` | Full 5-component version, `NUT_VERSION_DEFAULT5`
214227
| `2.8.2.2379.2`
215-
|`VER50` and `DESC50` | `NUT_VERSION_DEFAULT` as provided by caller or
228+
|`DESC5` | Constructed as `${VER5}${SUFFIX}`
229+
| `2.8.2.2379.2` `2.8.3.0.0-rc6`
230+
|`VER50` | `NUT_VERSION_DEFAULT` as provided by caller or
216231
defaulted, may be with or without trailing `.0` in fifth or
217232
fourth components
218233
| `2.8.2.1`
219-
|`BASE` | Empty (no known common commits with no trunk) | `""`
220-
|`SEMVER` | Exactly three leading numeric components.
234+
|`DESC50` | Constructed as `${VER50}${SUFFIX}`
235+
| `2.8.2.1` `2.8.3-rc6`
236+
|`BASE` | Empty (no known common commits with no trunk) | `""`
237+
|`SEMVER` | Exactly three leading numeric components.
221238
Either `NUT_VERSION_FORCED_SEMVER` (if provided by caller or
222239
configuration files), or `NUT_VERSION_DEFAULT3` (see above)
223240
| `2.8.0`
224-
|`TAG` | Constructed as `v${NUT_VERSION_DEFAULT3}` | `v2.8.0`
241+
|`TAG` | Constructed as `v${NUT_VERSION_DEFAULT3}${SUFFIX}`
242+
| `v2.8.0` `v2.8.3-rc6`
225243
|=========================================================================
226244

227245
The majority of identified values can be reported for debugging to `stderr`,
@@ -260,16 +278,40 @@ DESC='v2.8.2-2381+g1faa9945d'
260278
|`IS_RELEASE` | `true` if `SEMVER`==`VER50`, `false` otherwise
261279
| * dev: `false`
262280
* rel: `true`
281+
|`IS_PRERELEASE` | `true` if `SUFFIX_PRERELEASE` is not empty, `false` otherwise
282+
| * dev: `false`
283+
* rel/RC: `true`
263284
|`TAG` | GIT: Nearest (annotated by default) tag preceding the `HEAD` in history.
264285
DEFAULT: Constructed from `SEMVER`
265286
| `v2.8.2`
287+
|`TAG_PRERELEASE` | GIT: if the `HEAD` itself has a tag matching
288+
the `-(rc|alpha|beta)[0-9]*` regular expression.
289+
DEFAULT: Constructed from `NUT_VERSION_DEFAULT3`
290+
and `SUFFIX_PRERELEASE`.
291+
Empty for not-pre-releases.
292+
| `v2.8.2-rc3` `""`
266293
|`TRUNK` | GIT: Branch name used for calculation of current codebase
267294
distance from main development.
268295
DEFAULT: empty.
269296
| `master`
270297
|`SUFFIX` | GIT: Commit count since the tag and hash of the `HEAD` commit
271-
DEFAULT: empty.
298+
DEFAULT: empty for non-prerelease `NUT_VERSION_DEFAULT`
299+
values, or either value of `SUFFIX_PRERELEASE` with a
300+
leading dash for `NUT_VERSION_DEFAULT` values without
301+
git offset info (e.g. `2.8.3.5-rc6` => `-rc6`), or the
302+
whole tail with git and pre-release tag info.
272303
| * dev: `-2381+g1faa9945d`
304+
* RC git: `-2381+g1faa9945d+v2.8.3+rc6`
305+
* RC default: `-rc6`
306+
|`SUFFIX_PRERELEASE` | GIT: Constructed from `TAG_PRERELEASE` replacing any
307+
dash with a plus character.
308+
DEFAULT: empty unless `NUT_VERSION_DEFAULT` has a
309+
suffix matching the `-(rc|alpha|beta)[0-9]*`
310+
regular expression, or git info followed by
311+
the pre-release tag.
312+
NOTE: No leading dash in this value (unlike `SUFFIX`).
313+
| * RC git: `v2.8.3+rc6`
314+
* RC default: `rc6`
273315
|`BASE` | GIT: Newest common commit of development `TRUNK` and the `HEAD`
274316
commit (their `git merge-base`).
275317
DEFAULT: empty.
@@ -282,6 +324,11 @@ DESC='v2.8.2-2381+g1faa9945d'
282324
update the `VERSION_DEFAULT` file that goes into "dist"
283325
tarballs; prints its contents
284326
| `NUT_VERSION_DEFAULT='2.8.2.2379.2-2381+g1faa9945d'`
327+
|`UPDATE_FILE_GIT_RELEASE` | Used in maintainer rituals (requires git) to
328+
update the `VERSION_FORCED` and `VERSION_FORCED_SEMVER`
329+
files that go into "dist" tarballs; prints their contents
330+
| `NUT_VERSION_FORCED='2.8.2.2878.3-2881+g45029249f+v2.8.3+rc6'`
331+
`NUT_VERSION_FORCED_SEMVER='2.8.3'`
285332
|default | Report `DESC50` | `v2.8.2-2381-g1faa9945d`
286333
|=========================================================================
287334

@@ -318,6 +365,9 @@ Variables propagated by configure.ac
318365
|`NUT_SOURCE_GITREV_IS_RELEASE`
319366
| Determined by `NUT_VERSION_QUERY=IS_RELEASE gitlog2version.sh`
320367
| `true` or `false`
368+
|`NUT_SOURCE_GITREV_IS_PRERELEASE`
369+
| Determined by `NUT_VERSION_QUERY=IS_PRERELEASE gitlog2version.sh`
370+
| `true` or `false`
321371
|`NUT_SOURCE_GITREV_DEVREL`
322372
| String determined by `NUT_SOURCE_GITREV_IS_RELEASE`
323373
| `"release"` or `"development iteration"`
@@ -345,6 +395,11 @@ Variables propagated by nut_version.h
345395
(falls back to `false` if that query fails)
346396
| * `1` if `$GITREV_IS_RELEASE`
347397
* `0` otherwise
398+
|`#define NUT_VERSION_IS_PRERELEASE <0-or-1>`
399+
| Determined by `NUT_VERSION_QUERY=IS_PRERELEASE gitlog2version.sh`
400+
(falls back to `false` if that query fails)
401+
| * `1` if `$GITREV_IS_PRERELEASE`
402+
* `0` otherwise
348403
|=========================================================================
349404

350405
Use in C code

docs/nut.dict

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
personal_ws-1.1 en 3457 utf-8
1+
personal_ws-1.1 en 3458 utf-8
22
AAC
33
AAS
44
ABI
@@ -846,6 +846,7 @@ OUTDIR
846846
OUTPUTV
847847
OUTVOLT
848848
OV
849+
OVERDURATION
849850
Oden
850851
OffTime
851852
Ohloh
@@ -2686,7 +2687,6 @@ other's
26862687
otheruser
26872688
ouGDQn
26882689
outliers
2689-
OVERDURATION
26902690
ovmf
26912691
pF
26922692
pacman

include/Makefile.am

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,15 @@ MAINTAINERCLEANFILES = Makefile.in .dirstamp
3636

3737
# magic to include Git version information in NUT version string
3838
# (for builds not made from the tagged commit in a Git workspace)
39-
39+
# NOTE: For pre-releases, SEMVER may differ from NUT_VERSION base
40+
# (e.g. a commit tagged as 2.8.3-rc5 can have its own NUT_VERSION based
41+
# on 2.8.2-something, but is assumed as a pre-release for 2.8.3 SEMVER)
4042
nut_version.h: @FORCE_NUT_VERSION@
4143
@echo " GENERATE-HEADER $@" ; \
4244
RES=0; \
4345
GITREV="`$(top_srcdir)/tools/gitlog2version.sh`" || GITREV=""; \
4446
GITREV_IS_RELEASE="`NUT_VERSION_QUERY=IS_RELEASE $(top_srcdir)/tools/gitlog2version.sh 2>/dev/null`" || GITREV_IS_RELEASE="false"; \
47+
GITREV_IS_PRERELEASE="`NUT_VERSION_QUERY=IS_PRERELEASE $(top_srcdir)/tools/gitlog2version.sh 2>/dev/null`" || GITREV_IS_PRERELEASE="false"; \
4548
GITREV_SEMVER="`NUT_VERSION_QUERY=SEMVER $(top_srcdir)/tools/gitlog2version.sh 2>/dev/null`" || GITREV_SEMVER=""; \
4649
{ echo '/* Autogenerated file. Do not change. */' ; \
4750
echo '/* This file was generated by "make". */' ; \
@@ -65,8 +68,13 @@ nut_version.h: @FORCE_NUT_VERSION@
6568
else \
6669
echo "#define NUT_VERSION_IS_RELEASE 0" ; \
6770
fi ; \
71+
if $$GITREV_IS_PRERELEASE ; then \
72+
echo "#define NUT_VERSION_IS_PRERELEASE 1" ; \
73+
else \
74+
echo "#define NUT_VERSION_IS_PRERELEASE 0" ; \
75+
fi ; \
6876
} > "$@.tmp.$$$$" && \
69-
echo "NUT_VERSION: \"$$NUT_VERSION\" NUT_VERSION_IS_RELEASE:$$GITREV_IS_RELEASE NUT_VERSION_SEMVER: \"$$GITREV_SEMVER\"" && \
77+
echo "NUT_VERSION: \"$$NUT_VERSION\" NUT_VERSION_IS_RELEASE:$$GITREV_IS_RELEASE NUT_VERSION_IS_PRERELEASE:$$GITREV_IS_PRERELEASE NUT_VERSION_SEMVER: \"$$GITREV_SEMVER\"" && \
7078
if test -f "$@" && test -s "$@" ; then \
7179
if cmp -s "$@.tmp.$$$$" "$@" ; then \
7280
echo " GENERATE-HEADER $@ did not change" ; \

0 commit comments

Comments
 (0)