Skip to content

Commit 29d4f6a

Browse files
committed
UBUNTU: [Packaging] resync update-dkms-versions helper
BugLink: https://bugs.launchpad.net/bugs/1786013 Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
1 parent bbe0dec commit 29d4f6a

1 file changed

Lines changed: 41 additions & 22 deletions

File tree

update-dkms-versions

Lines changed: 41 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -115,40 +115,59 @@ fi
115115

116116
# Determine our series and mainline version from our own changelog.
117117
our_series=$(LC_ALL=C dpkg-parsechangelog -l"$DEBIAN/changelog" -SDistribution)
118-
if [ "$series" = "UNRELEASED" ]; then
119-
our_series=$(LC_ALL=C dpkg-parsechangelog -l"$DEBIAN/changelog" -c1 -SDistribution)
118+
if [ "$our_series" = "UNRELEASED" ]; then
119+
our_series=$(LC_ALL=C dpkg-parsechangelog -l"$DEBIAN/changelog" -o1 -c1 -SDistribution)
120120
fi
121121
our_mainline=$(LC_ALL=C dpkg-parsechangelog -l"$DEBIAN/changelog" -SVersion | sed -e 's/-.*//')
122+
our_package=$(LC_ALL=C dpkg-parsechangelog -l"$DEBIAN/changelog" -SSource)
123+
our_source=$(echo "$our_package" | sed -e 's/-restricted-modules//')
124+
case "$our_package" in
125+
linux-restricted-modules*) our_type="lrm" ;;
126+
*) our_type="main" ;;
127+
esac
122128

123129
# Update rules are complex. We update development series kernels to the
124130
# versions in development. For stable series we update versions against
125131
# the series in which our prime kernel was built. This is expressed
126132
# via the map/dkms-versions namespace. Attempt to map via our series
127133
# and then our mainline-version.
128134

129-
# Attempt to map via our series, if that works assume we are development.
130-
versions_path=$(cat_file -p "$git_base:map/dkms-versions/$our_series" 2>/dev/null)
131-
132-
# If we do not yet have a mapping re-map using our mainline version.
133-
if [ -z "$versions_path" ]; then
134-
versions_path=$(cat_file -p "$git_base:map/dkms-versions/$our_mainline")
135-
fi
136-
137-
echo "git_base<$git_base> versions_path<$versions_path>"
138-
echo "II: grabbing dkms-versions from $sru_cycle $versions_path"
135+
# Try and find a package specific dkms-versions fragment. Try:
136+
# handle+type
137+
# series+type
138+
# mainline+type
139+
# series - backwards compatibility
140+
# mainline - backwards compatibility
141+
for versions_path_tail in \
142+
"$our_series:$our_source:$our_type" \
143+
"$our_series:$our_type" \
144+
"$our_mainline:$our_type" \
145+
"$our_series" \
146+
"$our_mainline"
147+
do
148+
echo "II: trying $versions_path_tail ..."
149+
versions_paths=$(echo $(cat_file -p "$git_base:map/dkms-versions/$versions_path_tail" 2>/dev/null))
150+
[ -n "$versions_paths" ] && break
151+
done
139152

140-
cat_file -p "$git_base:$versions_path" >"debian/dkms-versions.new"
141-
rc="$?"
142-
if [ "$rc" -ne 0 ]; then
143-
echo "$0: unable to download an updated dkms-versions file" 1>&2
153+
if [ -z "$versions_paths" ]; then
154+
echo "$0: unable to identify dkms-versions mapping" 1>&2
144155
exit 1
156+
fi
145157

146-
elif [ "$rc" -eq 0 ]; then
147-
mv "debian/dkms-versions.new" "debian/dkms-versions"
158+
echo "git_base<$git_base> versions_paths<$versions_paths>"
159+
echo "II: grabbing dkms-versions from $sru_cycle $versions_paths"
148160

149-
else
150-
rm -f "debian/dkms-versions.new"
151-
fi
161+
: ">debian/dkms-versions.new"
162+
for versions_path in $versions_paths
163+
do
164+
cat_file -p "$git_base:$versions_path" >>"debian/dkms-versions.new"
165+
if [ "$?" -ne 0 ]; then
166+
echo "$0: unable to download an updated dkms-versions file" 1>&2
167+
exit 1
168+
fi
169+
done
170+
mv "debian/dkms-versions.new" "debian/dkms-versions"
152171

153172
thing="debian/dkms-versions"
154173
if ! git diff --exit-code -- "$thing" >/dev/null; then
@@ -159,4 +178,4 @@ else
159178
echo "$thing: no changes from kernel-versions"
160179
fi
161180

162-
exit "$rc"
181+
exit 0

0 commit comments

Comments
 (0)