@@ -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
0 commit comments