Dev builds for debian packages previously had system time inserted into
their packaging names while both static and rpm builds instead had the
git commit time.
This commit remedies that by pushing the generation of the debian
package version into a separate script to mirror what is being done in
static and rpm builds.
To give you an idea of what it looks like take the following examples:
```
❯ ./gen-deb-ver ~/work/docker-ce/components/engine/ $(cat ~/work/docker-ce/VERSION)
18.03.0~ce~dev~git20180202.170651.0.e232737
```
```
❯ ./gen-rpm-ver ~/work/docker-ce/components/engine $(cat ~/work/docker-ce/VERSION)
18.03.0.ce 0.0.dev.git20180202.170651.0.e232737 e232737
```
```
❯ ./gen-static-ver ~/work/docker-ce/components/engine/ $(cat ~/work/docker-ce/VERSION)
18.03.0-ce-dev-20180202.170651-e232737
```
Signed-off-by: Eli Uriegas <eli.uriegas@docker.com>
Upstream-commit: 23e3e42df6cb4e5cafd8648344ad37de25002971
Component: packaging
44 lines
1.2 KiB
Bash
Executable File
44 lines
1.2 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -x
|
|
set -e
|
|
|
|
if [[ -z "$DEB_VERSION" ]]; then
|
|
echo "DEB_VERSION is required to build deb packages"
|
|
exit 1
|
|
fi
|
|
|
|
# I want to rip this install-binaries script out so badly
|
|
cd engine
|
|
TMP_GOPATH="/go" bash hack/dockerfile/install-binaries.sh runc-dynamic containerd-dynamic proxy-dynamic tini
|
|
if [[ $? -ne 0 ]]; then
|
|
echo "Binaries required for package building not installed correctly."
|
|
echo "Exiting..."
|
|
exit 1
|
|
fi
|
|
cd -
|
|
echo VERSION AAA $VERSION
|
|
|
|
VERSION=${VERSION:-$( cat engine/VERSION )}
|
|
|
|
echo VERSION bbb $VERSION
|
|
|
|
debSource="$(awk -F ': ' '$1 == "Source" { print $2; exit }' debian/control)"
|
|
debMaintainer="$(awk -F ': ' '$1 == "Maintainer" { print $2; exit }' debian/control)"
|
|
debDate="$(date --rfc-2822)"
|
|
|
|
cat > "debian/changelog" <<-EOF
|
|
$debSource (${DEB_VERSION}-0~${DISTRO}) $SUITE; urgency=low
|
|
* Version: $VERSION
|
|
-- $debMaintainer $debDate
|
|
EOF
|
|
# The space above at the start of the line for the debMaintainer is very important
|
|
|
|
# Give the script a git commit because it wants it
|
|
export DOCKER_GITCOMMIT=${DOCKER_GITCOMMIT-$($GIT_COMMAND rev-parse --short HEAD)}
|
|
|
|
echo VERSION BBB $VERSION
|
|
dpkg-buildpackage -uc -us -I.git
|
|
destination="/build"
|
|
mkdir -p "$destination"
|
|
mv -v /root/docker-ce* "$destination"
|