Skip to content

Commit 0c80c44

Browse files
committed
Merge remote-tracking branch 'origin/6.0/release' into 6.0/patch
2 parents 019a1e6 + 262dd13 commit 0c80c44

12 files changed

Lines changed: 350 additions & 113 deletions

File tree

default-package-config.sh

Lines changed: 43 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ function kernel_build() {
6161
# debian/rules command, the rightmost declaration
6262
# is the one that is actually used.
6363
#
64-
local debian_rules_extra_args="$2"
64+
shift
65+
local debian_rules_extra_args=("$@")
6566

6667
logmust cd "$WORKDIR/repo"
6768

@@ -91,7 +92,7 @@ function kernel_build() {
9192
#
9293
local canonical_abinum delphix_abinum kernel_release kernel_version
9394
canonical_abinum=$(fakeroot debian/rules printenv | grep -E '^abinum ' | cut -d= -f2 | tr -d '[:space:]')
94-
delphix_abinum="dlpx-$(date -u +"%Y%m%dt%H%M%S")-$(git rev-parse --short HEAD)-${canonical_abinum}"
95+
delphix_abinum="${canonical_abinum}-$(date -u +"dx%Y%m%d%H")-$(git rev-parse --short HEAD)"
9596
kernel_release=$(fakeroot debian/rules printenv | grep -E '^release ' | cut -d= -f2 | tr -d '[:space:]')
9697

9798
#
@@ -113,20 +114,35 @@ function kernel_build() {
113114
# disable_d_i=true
114115
# This prevents udeb packages from being built as they are
115116
# not consumed by the Delphix Appliance.
116-
#
117-
local debian_rules_args="skipdbg=false uefi_signed=false disable_d_i=true flavours=$platform abinum=${delphix_abinum} ${debian_rules_extra_args}"
117+
# do_dkms_*=false
118+
# This disables the build of various out-of-tree kernel modules
119+
# that we do not use in our product or that we provide separately.
120+
#
121+
local debian_rules_args=(
122+
"skipdbg=false"
123+
"uefi_signed=false"
124+
"disable_d_i=true"
125+
"do_zfs=false"
126+
"do_dkms_nvidia=false"
127+
"do_dkms_nvidia_server=false"
128+
"do_dkms_vbox=false"
129+
"do_dkms_wireguard=false"
130+
"flavours=$platform"
131+
"abinum=${delphix_abinum}"
132+
)
133+
debian_rules_args+=("${debian_rules_extra_args[@]}")
118134

119135
#
120136
# Clean up everything generated so far and recreate the
121137
# final control file with the arguments that we want.
122138
#
123-
logmust fakeroot debian/rules clean ${debian_rules_args}
139+
logmust fakeroot debian/rules clean "${debian_rules_args[@]}"
124140

125141
#
126142
# Print the environment configuration solely for
127143
# debugging purposes.
128144
#
129-
logmust fakeroot debian/rules printenv ${debian_rules_args}
145+
logmust fakeroot debian/rules printenv "${debian_rules_args[@]}"
130146

131147
#
132148
# The default value of the tool argument for mk-build-deps
@@ -139,7 +155,7 @@ function kernel_build() {
139155
local build_deps_tool="apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends --yes"
140156
logmust sudo mk-build-deps --install debian/control --tool "${build_deps_tool}"
141157

142-
logmust fakeroot debian/rules "binary" ${debian_rules_args}
158+
logmust fakeroot debian/rules "binary" "${debian_rules_args[@]}"
143159

144160
logmust cd "$WORKDIR"
145161
logmust mv ./*deb "artifacts/"
@@ -220,24 +236,24 @@ function kernel_update_upstream() {
220236
# Note that "generic" (used mainly ESX) is a special
221237
# case as we are currently using the HWE kernel image.
222238
#
223-
local tag_prefix
239+
local tag_prefix_flavour
224240
if [[ "${platform}" == generic ]] &&
225241
[[ "$UBUNTU_DISTRIBUTION" == bionic ]]; then
226-
tag_prefix="Ubuntu-hwe-${kernel_version}-${abinum}"
242+
tag_prefix_flavour="Ubuntu-hwe"
227243
elif [[ "${platform}" == aws ]] ||
228244
[[ "${platform}" == azure ]] ||
229245
[[ "${platform}" == gcp ]] ||
230246
[[ "${platform}" == oracle ]]; then
231-
232-
local kvers_major kvers_minor short_kvers
233-
kvers_major=$(echo "${kernel_version}" | cut -d '.' -f 1)
234-
kvers_minor=$(echo "${kernel_version}" | cut -d '.' -f 2)
235-
short_kvers="${kvers_major}.${kvers_minor}"
236-
237-
tag_prefix="Ubuntu-${platform}-${short_kvers}-${kernel_version}-${abinum}"
247+
tag_prefix_flavour="Ubuntu-${platform}"
238248
else
239249
die "assertion: unexpected platform: ${platform}"
240250
fi
251+
252+
local tag_prefix kvers_major kvers_minor short_kvers
253+
kvers_major=$(echo "${kernel_version}" | cut -d '.' -f 1)
254+
kvers_minor=$(echo "${kernel_version}" | cut -d '.' -f 2)
255+
short_kvers="${kvers_major}.${kvers_minor}"
256+
tag_prefix="${tag_prefix_flavour}-${short_kvers}-${kernel_version}-${abinum}"
241257
echo "note: upstream tag prefix used: ${tag_prefix}"
242258

243259
#
@@ -274,8 +290,18 @@ function kernel_update_upstream() {
274290

275291
logmust git fetch upstream "+refs/tags/${upstream_tag}:refs/tags/${upstream_tag}"
276292

293+
#
294+
# Note that we add '^{}' at the end to dereference the tag recursively
295+
# until it arrives to an actual commit. This is needed in case the
296+
# tag points to an anotated tag object which contains extra information
297+
# such as a PGP signature. That annoted tag will in turn reference the
298+
# actual commit, which will be returned when appending ^{}.
299+
# upstream-HEAD will be pointing to the commit directly rather than the
300+
# annoted tag object, so if we want to compare the two we need to query
301+
# for the dereferenced commit. See 'git help gitrevisions' for more info.
302+
#
277303
local upstream_tag_commit
278-
upstream_tag_commit="$(git rev-parse "refs/tags/${upstream_tag}")" ||
304+
upstream_tag_commit="$(git rev-parse "refs/tags/${upstream_tag}^{}")" ||
279305
die "couldn't get commit of tag ${upstream_tag}"
280306
echo "note: upstream tag: ${upstream_tag}, commit ${upstream_tag_commit}"
281307

lib/common.sh

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export UBUNTU_DISTRIBUTION="bionic"
3535
# 2. "archive": dowloading from apt
3636
# 3. "prebuilt": pre-built kernel stored in artifactory
3737
#
38-
export DEFAULT_LINUX_KERNEL_PACKAGE_SOURCE="prebuilt"
38+
export DEFAULT_LINUX_KERNEL_PACKAGE_SOURCE="delphix"
3939

4040
# shellcheck disable=SC2086
4141
function enable_colors() {
@@ -89,7 +89,7 @@ function die() {
8989
}
9090

9191
function logmust() {
92-
echo Running: "$@"
92+
[[ "$LOGGING" == "false" ]] || echo Running: "$@" >&2
9393
"$@" || die "failed command '$*'"
9494
}
9595

@@ -470,7 +470,7 @@ function install_pkgs() {
470470
echo "Running: sudo env DEBIAN_FRONTEND=noninteractive " \
471471
"apt-get install -y $*"
472472
sudo env DEBIAN_FRONTEND=noninteractive apt-get install \
473-
-y "$@" && return
473+
-y --allow-downgrades "$@" && return
474474
echo "apt-get install failed, retrying."
475475
sleep 10
476476
done
@@ -1116,7 +1116,26 @@ function fetch_kernel_from_artifactory() {
11161116
url="$url/linux-pkg/linux-prebuilt/${artifactory_deb}"
11171117

11181118
logmust cd "$WORKDIR/artifacts"
1119-
logmust wget -nv "$url"
1119+
fetch_file_from_artifactory "$url"
1120+
}
1121+
1122+
function fetch_file_from_artifactory() {
1123+
local url="$1"
1124+
local sha256_expected="$2"
1125+
local file sha256_actual
1126+
1127+
[[ -n "$url" ]] || die "url argument is missing."
1128+
file="$(basename "$url")"
1129+
1130+
logmust wget -nv "$url" -O "$file"
1131+
1132+
if [[ -n "$sha256_expected" ]]; then
1133+
sha256_actual="$(sha256sum "$file" | awk '{print $1}')"
1134+
if [[ "$sha256_expected" != "$sha256_actual" ]]; then
1135+
die "SHA256 mismatch. Expected: $sha256_expected," \
1136+
"Actual: $sha256_actual"
1137+
fi
1138+
fi
11201139
}
11211140

11221141
#

package-lists/build/main.pkgs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ grub2
1818
libkdumpfile
1919
make-jpkg
2020
makedumpfile
21+
masking
22+
misc-debs
2123
nfs-utils
2224
performance-diagnostics
2325
ptools
@@ -26,4 +28,4 @@ recovery-environment
2628
savedump
2729
sdb
2830
targetcli-fb
29-
td-agent-prebuilt
31+
virtualization

package-lists/update/main.pkgs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ crash
1717
drgn
1818
grub2
1919
libkdumpfile
20+
linux-kernel-aws
21+
linux-kernel-azure
22+
linux-kernel-gcp
23+
linux-kernel-generic
24+
linux-kernel-oracle
2025
makedumpfile
2126
nfs-utils
2227
python-rtslib-fb

packages/adoptopenjdk/config.sh

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@
1919
DEFAULT_PACKAGE_GIT_URL=none
2020
PACKAGE_DEPENDENCIES="make-jpkg"
2121

22-
tarfile="OpenJDK8U-jdk_x64_linux_hotspot_8u262b10.tar.gz"
23-
jdk_path="/usr/lib/jvm/adoptopenjdk-java8-jdk-amd64"
22+
_tarfile="OpenJDK8U-jdk_x64_linux_hotspot_8u262b10.tar.gz"
23+
_tarfile_sha256="733755fd649fad6ae91fc083f7e5a5a0b56410fb6ac1815cff29f744b128b1b1"
24+
_jdk_path="/usr/lib/jvm/adoptopenjdk-java8-jdk-amd64"
2425

2526
function prepare() {
2627
logmust install_pkgs "$DEPDIR"/make-jpkg/*.deb
@@ -29,15 +30,15 @@ function prepare() {
2930
function fetch() {
3031
logmust cd "$WORKDIR/"
3132

32-
local url="http://artifactory.delphix.com/artifactory"
33+
local url="http://artifactory.delphix.com/artifactory/java-binaries/linux/jdk/8/$_tarfile"
3334

34-
logmust wget -nv "$url/java-binaries/linux/jdk/8/$tarfile" -O "$tarfile"
35+
logmust fetch_file_from_artifactory "$url" "$_tarfile_sha256"
3536
}
3637

3738
function build() {
3839
logmust cd "$WORKDIR/"
3940

40-
logmust env DEB_BUILD_OPTIONS=nostrip fakeroot make-jpkg "$tarfile" <<<y
41+
logmust env DEB_BUILD_OPTIONS=nostrip fakeroot make-jpkg "$_tarfile" <<<y
4142

4243
logmust mv ./*deb "$WORKDIR/artifacts/"
4344
#
@@ -49,7 +50,7 @@ function build() {
4950
# packages, such as the app-gate, decide to fetch and install Java from
5051
# the Linux-pkg bundle.
5152
#
52-
logmust bash -c "echo $jdk_path >'$WORKDIR/artifacts/JDK_PATH'"
53+
logmust bash -c "echo $_jdk_path >'$WORKDIR/artifacts/JDK_PATH'"
5354

54-
echo "Tar file: $tarfile" >"$WORKDIR/artifacts/BUILD_INFO"
55+
echo "Tar file: $_tarfile" >"$WORKDIR/artifacts/BUILD_INFO"
5556
}

packages/java8/config.sh

Lines changed: 0 additions & 50 deletions
This file was deleted.

packages/masking/config.sh

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#!/bin/bash
2+
#
3+
# Copyright 2021 Delphix
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
# shellcheck disable=SC2034
18+
19+
DEFAULT_PACKAGE_GIT_URL="https://gitlab.delphix.com/masking/dms-core-gate.git"
20+
PACKAGE_DEPENDENCIES="adoptopenjdk"
21+
22+
function prepare() {
23+
logmust install_pkgs "$DEPDIR"/adoptopenjdk/*.deb
24+
}
25+
26+
function build() {
27+
export JAVA_HOME
28+
JAVA_HOME=$(cat "$DEPDIR/adoptopenjdk/JDK_PATH") ||
29+
die "Failed to read $DEPDIR/adoptopenjdk/JDK_PATH"
30+
31+
logmust cd "$WORKDIR/repo"
32+
33+
#
34+
# The "appliance-build-stage0" Jenkins job consumes this file,
35+
# along with various other files (e.g. licensing metadata).
36+
# Thus, if we don't generate it here, the Jenkins job that
37+
# builds the appliance will fail.
38+
#
39+
# shellcheck disable=SC2016
40+
logmust jq -n \
41+
--arg h "$(git rev-parse HEAD)" \
42+
--arg d "$(date --utc --iso-8601=seconds)" \
43+
'{ "dms-core-gate" : { "git-hash" : $h, "date": $d }}' \
44+
>"$WORKDIR/artifacts/metadata.json"
45+
46+
logmust ./gradlew --no-daemon --stacktrace \
47+
-Porg.gradle.configureondemand=false \
48+
-PenvironmentName=linuxappliance \
49+
clean \
50+
generateLicenseReport \
51+
:dist:distDeb \
52+
:dist:distLicenseReport
53+
54+
logmust rsync -av dist/build/distributions/ "$WORKDIR/artifacts/"
55+
logmust cp -v \
56+
dist/build/reports/dependency-license/* "$WORKDIR/artifacts/"
57+
}

0 commit comments

Comments
 (0)