pkgbase: differentiate package versions for ALPHA/BETA/PRERELEASE/RC phases

The current postfix conversions are:

  CURRENT / STABLE / PRERELEASE, 12.x-CURRENT becomes 12.snapYYYYMMDDhhmmss
  ALPHAx -> .ax, so 11.3-ALPHA1 becomes 11.3.a1.YYYYMMDDhhmmss
  BETAx -> .bx, so 12.1-BETA2 becomes 12.1.b2.YYYYMMDDhhmmss
  RCx -> .rcx, so 13.0-RC3 becomes 13.0.rc3.YYYYMMDDhhmmss
  RELEASE -> (nothing), so 12.1-RELEASE becomes 12.1
  RELEASE-pX -> pX, so 12.1-RELEASE-p1 becomes 12.1p1

Note that for development branches we will start to drop the minor version
component entirely, which more closely matches how these branches are
physically named (stable/NN).

snap is a new prefix that was added to pkg in [0], which is simply a more
verbose version of the current ".s" used.

As noted, build timestamps are also added to ALPHA/BETA/RC versions.  This
is largely irrelevant for re@ snapshots because they will only produce one
set of snapshots for each alpha/beta/rc, but external folks may produce
multiple in that timeframe -- at least for alpha.  For them, it is
imperative that the builds have a differentiating characteristic like this
rather than multiple builds across multiple revisions being versioned
identically.

[0] https://github.com/freebsd/pkg/pull/1929

Reviewed by:	gjb, manu
Submitted by:	rene (original, original version)
Differential Revision:	https://reviews.freebsd.org/D28167
This commit is contained in:
Emmanuel Vadot 2021-01-14 13:56:38 +01:00 committed by Kyle Evans
parent effad35ed1
commit 613fe5321f

View File

@ -557,19 +557,21 @@ VERSION= FreeBSD ${_REVISION}-${_BRANCH:C/-p[0-9]+$//} ${TARGET_ARCH} ${SRCRELDA
.endif .endif
.if !defined(PKG_VERSION) .if !defined(PKG_VERSION)
.if ${_BRANCH:MSTABLE*} || ${_BRANCH:MCURRENT*} || ${_BRANCH:MPRERELEASE*} _STRTIMENOW= %Y%m%d%H%M%S
TIMENOW= %Y%m%d%H%M%S _TIMENOW= ${_STRTIMENOW:gmtime}
EXTRA_REVISION= .s${TIMENOW:gmtime} .if ${_BRANCH:MCURRENT*} || ${_BRANCH:MSTABLE*} || ${_BRANCH:MPRERELEASE*}
_REVISION:= ${_REVISION:R}
EXTRA_REVISION= .snap${_TIMENOW}
.elif ${_BRANCH:MALPHA*} .elif ${_BRANCH:MALPHA*}
EXTRA_REVISION= _${_BRANCH:C/-ALPHA/.a/} EXTRA_REVISION= .a${_BRANCH:C/ALPHA([0-9]+).*/\1/}.${_TIMENOW}
.elif ${_BRANCH:MBETA*} .elif ${_BRANCH:MBETA*}
EXTRA_REVISION= _${_BRANCH:C/-BETA/.b/} EXTRA_REVISION= .b${_BRANCH:C/BETA([0-9]+).*/\1/}.${_TIMENOW}
.elif ${_BRANCH:MRC*} .elif ${_BRANCH:MRC*}
EXTRA_REVISION= _${_BRANCH:C/-RC/.r/} EXTRA_REVISION= .rc${_BRANCH:C/RC([0-9]+).*/\1/}.${_TIMENOW}
.elif ${_BRANCH:M*-p*} .elif ${_BRANCH:M*-p*}
EXTRA_REVISION= _${_BRANCH:C/.*-p([0-9]+$)/\1/} EXTRA_REVISION= p${_BRANCH:C/.*-p([0-9]+$)/\1/}
.endif .endif
PKG_VERSION:= ${_REVISION}${EXTRA_REVISION} PKG_VERSION:= ${_REVISION}${EXTRA_REVISION:C/[[:space:]]//g}
.endif .endif
.endif # !defined(PKG_VERSION) .endif # !defined(PKG_VERSION)