Skip to content

Commit 0941343

Browse files
committed
refact: improve debhelper installation logic
1 parent 0384cda commit 0941343

1 file changed

Lines changed: 21 additions & 19 deletions

File tree

install_deps.sh

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,19 @@ fi
4444

4545

4646
# install the latest debhelper from debian sid by adding debian sources
47-
_DEBIAN_SID_DEBHELPER() {
47+
_DEBIAN_DEBHELPER() {
48+
49+
local __coreutils_ver="$(dpkg-query -f '${Version}' -W coreutils || true)"
50+
[[ -z $__coreutils_ver ]] && __coreutils_ver="0.0.0"
51+
echo "DEBUG: __coreutils_ver:$__coreutils_ver"
52+
53+
# Note: latest debhelper calls `cp --update=none` which is unsupported with coreutils < 9.5
54+
# Install a fixed version of debhelper in our repo instead.
55+
if dpkg --compare-versions "$__coreutils_ver" le '9.5~'; then
56+
sudo apt install -y --allow-downgrades "$__dir"/builddep/*.deb
57+
return 0
58+
fi
59+
4860
DEBIAN_SOURCE="http://deb.debian.org/debian/"
4961
[[ -n "${APT_MIRROR:-}" ]] && \
5062
DEBIAN_SOURCE="http://${APT_MIRROR}/debian/"
@@ -60,38 +72,28 @@ _DEBIAN_SID_DEBHELPER() {
6072
rm /etc/apt/sources.list.d/debian-sid.list
6173
}
6274

63-
__coreutils_ver="$(dpkg-query -f '${Version}' -W coreutils || true)"
64-
[[ -z $__coreutils_ver ]] && __coreutils_ver="0.0.0"
65-
echo "DEBUG: __coreutils_ver:$__coreutils_ver"
66-
67-
# Note: latest debhelper calls `cp --update=none` which is unsupported in coreutils < 9.5
68-
# Install a fixed version of debhelper in our repo instead.
69-
if dpkg --compare-versions "$__coreutils_ver" le '9.5~'; then
70-
sudo apt install -y --allow-downgrades "$__dir"/builddep/*.deb
75+
__debhelper_ver="$(dpkg-query -f '${Version}' -W debhelper || true)"
76+
[[ -z $__debhelper_ver ]] && __debhelper_ver="0.0.0"
77+
echo "DEBUG: __debhelper_ver:$__debhelper_ver"
78+
if dpkg --compare-versions "$__debhelper_ver" le '13.1~'; then
79+
sudo apt install -y "$__dir"/builddep/*.deb
7180
fi
7281

73-
CODE_NAME=$(lsb_release -sc)
82+
#CODE_NAME=$(lsb_release -sc)
7483
# if [ "${CODE_NAME}" != "focal" ]; then
7584
# apt install -y dh-virtualenv
7685
# fi
7786
# case ${CODE_NAME} in
7887
# # dists with coreutils >= 9.5 can use the latest debhelper from debian sid
7988
# trixie)
80-
# _DEBIAN_SID_DEBHELPER
89+
# _DEBIAN_DEBHELPER
8190
# ;;
8291
# plucky|questing|resolute)
83-
# _DEBIAN_SID_DEBHELPER
92+
# _DEBIAN_DEBHELPER
8493
# ;;
8594
# *)
8695
# echo "$CODE_NAME does NOT NEED to add Debian sources."
8796
# ;;
8897
# esac
8998

90-
__debhelper_ver="$(dpkg-query -f '${Version}' -W debhelper || true)"
91-
[[ -z $__debhelper_ver ]] && __debhelper_ver="0.0.0"
92-
echo "DEBUG: __debhelper_ver:$__debhelper_ver"
93-
if dpkg --compare-versions "$__debhelper_ver" le '13.1~'; then
94-
sudo apt install -y "$__dir"/builddep/*.deb
95-
fi
96-
9799
exit 0

0 commit comments

Comments
 (0)