Merge pull request #125 from thaJeztah/a_nightly_to_remember
Merged with https://github.com/seemethere/unir Upstream-commit: a5aa7e5a5e7f418cf1bc399055c9700aab475315 Component: packaging
This commit is contained in:
@ -7,7 +7,7 @@ VERSION?=0.0.0-dev
|
||||
GO_VERSION:=1.10.3
|
||||
DEB_VERSION=$(shell ./gen-deb-ver $(ENGINE_DIR) "$(VERSION)")
|
||||
CHOWN:=docker run --rm -v $(CURDIR):/v -w /v alpine chown
|
||||
EPOCH?=1
|
||||
EPOCH?=2
|
||||
|
||||
BUILD=docker build --build-arg GO_VERSION=$(GO_VERSION) -t debbuild-$@/$(ARCH) -f $(CURDIR)/$@/Dockerfile.$(ARCH) .
|
||||
RUN=docker run --rm -i \
|
||||
|
||||
@ -53,20 +53,37 @@ GIT_COMMAND="git -C $ENGINE_DIR"
|
||||
debVersion="${debVersion//-/$tilde}" # using \~ or '~' here works in 4.3, but not 4.2; just ~ causes $HOME to be inserted, hence the $tilde
|
||||
# if we have a "-dev" suffix or have change in Git, let's make this package version more complex so it works better
|
||||
if [[ "$VERSION" == *-dev ]]; then
|
||||
gitUnix="$($GIT_COMMAND log -1 --pretty='%at')"
|
||||
gitDate="$($DATE_COMMAND --date "@$gitUnix" +'%Y%m%d.%H%M%S')"
|
||||
# based on golang's pseudo-version: https://groups.google.com/forum/#!topic/golang-dev/a5PqQuBljF4
|
||||
#
|
||||
# using a "pseudo-version" of the form v0.0.0-yyyymmddhhmmss-abcdefabcdef,
|
||||
# where the time is the commit time in UTC and the final suffix is the prefix
|
||||
# of the commit hash. The time portion ensures that two pseudo-versions can
|
||||
# be compared to determine which happened later, the commit hash identifes
|
||||
# the underlying commit, and the v0.0.0- prefix identifies the pseudo-version
|
||||
# as a pre-release before version v0.0.0, so that the go command prefers any
|
||||
# tagged release over any pseudo-version.
|
||||
gitUnix="$($GIT_COMMAND log -1 --pretty='%ct')"
|
||||
gitDate="$($DATE_COMMAND --utc --date "@$gitUnix" +'%Y%m%d%H%M%S')"
|
||||
gitCommit="$($GIT_COMMAND log -1 --pretty='%h')"
|
||||
debVersion="0.${gitDate}-${gitCommit}"
|
||||
debVersion="0.0.0-${gitDate}-${gitCommit}"
|
||||
origVersion=$debVersion
|
||||
|
||||
# verify that nightly builds are always < actual releases
|
||||
#
|
||||
# $ dpkg --compare-versions 1.5.0 gt 1.5.0~rc1 && echo true || echo false
|
||||
# true
|
||||
# $ dpkg --compare-versions 1.5.0~rc1 gt 1.5.0~git20150128.112847.17e840a && echo true || echo false
|
||||
# $ dpkg --compare-versions 1.5.0~rc1 gt 0.0.0-20180719213347-5daff5a && echo true || echo false
|
||||
# true
|
||||
# $ dpkg --compare-versions 1.5.0~git20150128.112847.17e840a gt 1.5.0~dev~git20150128.112847.17e840a && echo true || echo false
|
||||
# $ dpkg --compare-versions 18.06.0-ce-rc3 gt 18.06.0-ce-rc2 && echo true || echo false
|
||||
# true
|
||||
# $ dpkg --compare-versions 18.06.0-ce gt 18.06.0-ce-rc2 && echo true || echo false
|
||||
# false
|
||||
# $ dpkg --compare-versions 18.06.0-ce-rc3 gt 0.0.0-20180719213347-5daff5a && echo true || echo false
|
||||
# true
|
||||
# $ dpkg --compare-versions 18.06.0-ce gt 0.0.0-20180719213347-5daff5a && echo true || echo false
|
||||
# true
|
||||
# $ dpkg --compare-versions 0.0.0-20180719213702-cd5e2db gt 0.0.0-20180719213347-5daff5a && echo true || echo false
|
||||
# true
|
||||
|
||||
# ie, 1.5.0 > 1.5.0~rc1 > 1.5.0~git20150128.112847.17e840a > 1.5.0~dev~git20150128.112847.17e840a
|
||||
fi
|
||||
|
||||
echo "$debVersion" "$origVersion"
|
||||
|
||||
@ -5,7 +5,7 @@ GITCOMMIT=$(shell cd $(ENGINE_DIR) && git rev-parse --short HEAD)
|
||||
VERSION?=0.0.0-dev
|
||||
GO_VERSION:=1.10.3
|
||||
GEN_RPM_VER=$(shell ./gen-rpm-ver $(ENGINE_DIR) $(VERSION))
|
||||
EPOCH?=1
|
||||
EPOCH?=2
|
||||
CHOWN=docker run --rm -i -v $(CURDIR):/v -w /v alpine chown
|
||||
RPMBUILD=docker run --privileged --rm -i\
|
||||
-e EPOCH="$(EPOCH)" \
|
||||
|
||||
@ -45,13 +45,22 @@ fi
|
||||
|
||||
# if we have a "-dev" suffix or have change in Git, let's make this package version more complex so it works better
|
||||
if [[ "$rpmVersion" == *-dev ]] || [ -n "$($GIT_COMMAND status --porcelain)" ]; then
|
||||
gitUnix="$($GIT_COMMAND log -1 --pretty='%at')"
|
||||
gitDate="$($DATE_COMMAND --date "@$gitUnix" +'%Y%m%d.%H%M%S')"
|
||||
# based on golang's pseudo-version: https://groups.google.com/forum/#!topic/golang-dev/a5PqQuBljF4
|
||||
#
|
||||
# using a "pseudo-version" of the form v0.0.0-yyyymmddhhmmss-abcdefabcdef,
|
||||
# where the time is the commit time in UTC and the final suffix is the prefix
|
||||
# of the commit hash. The time portion ensures that two pseudo-versions can
|
||||
# be compared to determine which happened later, the commit hash identifes
|
||||
# the underlying commit, and the v0.0.0- prefix identifies the pseudo-version
|
||||
# as a pre-release before version v0.0.0, so that the go command prefers any
|
||||
# tagged release over any pseudo-version.
|
||||
gitUnix="$($GIT_COMMAND log -1 --pretty='%ct')"
|
||||
gitDate="$($DATE_COMMAND --utc --date "@$gitUnix" +'%Y%m%d%H%M%S')"
|
||||
gitCommit="$($GIT_COMMAND log -1 --pretty='%h')"
|
||||
# gitVersion is now something like '20150128.112847.17e840a'
|
||||
rpmVersion="0.${gitDate}-${gitCommit}"
|
||||
# rpmVersion is now something like '0.0.0-20180719213702-cd5e2db'
|
||||
rpmVersion="0.0.0-${gitDate}-${gitCommit}"
|
||||
rpmRelease="0"
|
||||
origVersion="0.${gitDate}-${gitCommit}"
|
||||
origVersion=$rpmVersion
|
||||
fi
|
||||
|
||||
# Replace any other dashes with periods
|
||||
|
||||
@ -16,10 +16,20 @@ GIT_COMMAND="git -C $ENGINE_DIR"
|
||||
|
||||
staticVersion="$VERSION"
|
||||
if [[ "$VERSION" == *-dev ]]; then
|
||||
gitUnix="$($GIT_COMMAND log -1 --pretty='%at')"
|
||||
gitDate="$($DATE_COMMAND --date "@$gitUnix" +'%Y%m%d.%H%M%S')"
|
||||
# based on golang's pseudo-version: https://groups.google.com/forum/#!topic/golang-dev/a5PqQuBljF4
|
||||
#
|
||||
# using a "pseudo-version" of the form v0.0.0-yyyymmddhhmmss-abcdefabcdef,
|
||||
# where the time is the commit time in UTC and the final suffix is the prefix
|
||||
# of the commit hash. The time portion ensures that two pseudo-versions can
|
||||
# be compared to determine which happened later, the commit hash identifes
|
||||
# the underlying commit, and the v0.0.0- prefix identifies the pseudo-version
|
||||
# as a pre-release before version v0.0.0, so that the go command prefers any
|
||||
# tagged release over any pseudo-version.
|
||||
gitUnix="$($GIT_COMMAND log -1 --pretty='%ct')"
|
||||
gitDate="$($DATE_COMMAND --utc --date "@$gitUnix" +'%Y%m%d%H%M%S')"
|
||||
gitCommit="$($GIT_COMMAND log -1 --pretty='%h')"
|
||||
staticVersion="0.${gitDate}-${gitCommit}"
|
||||
# staticVersion is now something like '0.0.0-20180719213702-cd5e2db'
|
||||
staticVersion="0.0.0-${gitDate}-${gitCommit}"
|
||||
fi
|
||||
|
||||
echo "$staticVersion"
|
||||
|
||||
Reference in New Issue
Block a user