UBUNTU: [Packaging] resync update-dkms-versions helper

BugLink: https://bugs.launchpad.net/bugs/1786013
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
This commit is contained in:
Andrea Righi
2023-07-27 08:12:16 +02:00
committed by Paolo Pisati
parent 8e5f6e5fb4
commit 264f254a82
+15 -5
View File
@@ -77,7 +77,6 @@ esac
# https://git.launchpad.net/~canonical-kernel/+git/kernel-versions/plain/README
#
kv_repo="$HOME/.cache/kernel-versions-bare"
git_base="$remote_name/$sru_cycle"
# Now we know where our repo is and what it called update it.
# We maintain "persistent" remotes for main and security, but assume
@@ -100,13 +99,24 @@ cat_file()
(cd "$kv_repo" && git cat-file "$@") || exit 1
}
# Determine if this is merge format (main branch exists).
present=$(cat_file -t "$remote_name/main" 2>/dev/null)
if [ "$present" ]; then
git_base="$remote_name/main:$sru_cycle/"
git_base_devel="$remote_name/main:tip/"
else
git_base="$remote_name/$sru_cycle:"
git_base_devel="$remote_name/master:"
fi
git_human="$remote_name/$sru_cycle"
# Determine if we have this cycle.
present=$(cat_file -t "$git_base" 2>/dev/null)
if [ "$present" = "" ]; then
# If we don't have the cycle in the development cycle then
# fall back to master.
case "$sru_cycle" in
d*) git_base="$remote_name/master" ;;
d*) git_base="$git_base_devel" ;;
*) echo "$sru_cycle: cycle not found in $remote_repo" 2>&1
exit 1
;;
@@ -146,7 +156,7 @@ for versions_path_tail in \
"$our_mainline"
do
echo "II: trying $versions_path_tail ..."
versions_paths=$(echo $(cat_file -p "$git_base:map/dkms-versions/$versions_path_tail" 2>/dev/null))
versions_paths=$(echo $(cat_file -p "${git_base}map/dkms-versions/$versions_path_tail" 2>/dev/null))
[ -n "$versions_paths" ] && break
done
@@ -161,7 +171,7 @@ echo "II: grabbing dkms-versions from $sru_cycle $versions_paths"
: ">debian/dkms-versions.new"
for versions_path in $versions_paths
do
cat_file -p "$git_base:$versions_path" >>"debian/dkms-versions.new"
cat_file -p "$git_base$versions_path" >>"debian/dkms-versions.new"
if [ "$?" -ne 0 ]; then
echo "$0: unable to download an updated dkms-versions file" 1>&2
exit 1
@@ -171,7 +181,7 @@ mv "debian/dkms-versions.new" "debian/dkms-versions"
thing="debian/dkms-versions"
if ! git diff --exit-code -- "$thing" >/dev/null; then
git commit -m "UBUNTU: $thing -- update from kernel-versions ($git_base)" \
git commit -m "UBUNTU: $thing -- update from kernel-versions ($git_human)" \
-m "BugLink: https://bugs.launchpad.net/bugs/1786013" \
-s -- "$thing"
else