helpers/apt: rely on simpler dpkg-deb --build rather than equivs to create .deb for app virtual dependencies

This commit is contained in:
Alexandre Aubin 2024-07-07 17:18:58 +02:00
parent 1bb81e8f69
commit f6fbd69c39
3 changed files with 16 additions and 19 deletions

2
debian/control vendored
View file

@ -28,7 +28,7 @@ Depends: ${python3:Depends}, ${misc:Depends}
, redis-server
, acl
, git, curl, wget, cron, unzip, jq, bc, at, procps, j2cli
, lsb-release, haveged, fake-hwclock, equivs, lsof, whois
, lsb-release, haveged, fake-hwclock, lsof, whois
Recommends: yunohost-admin
, ntp, inetutils-ping | iputils-ping
, bash-completion, rsyslog

View file

@ -186,21 +186,19 @@ ynh_package_install_from_equivs() {
# Build and install the package
local TMPDIR=$(mktemp --directory)
# Make sure to delete the legacy compat file
# It's now handle somewhat magically through the control file
rm -f /usr/share/equivs/template/debian/compat
mkdir -p ${TMPDIR}/${pkgname}/DEBIAN/
# Note that the cd executes into a sub shell
# Create a fake deb package with equivs-build and the given control file
# Install the fake package without its dependencies with dpkg
# Install missing dependencies with ynh_package_install
ynh_wait_dpkg_free
cp "$controlfile" "${TMPDIR}/control"
cp "$controlfile" "${TMPDIR}/${pkgname}/DEBIAN/control"
(
cd "$TMPDIR"
LC_ALL=C equivs-build ./control 2>&1
LC_ALL=C dpkg --force-depends --install "./${pkgname}_${pkgversion}_all.deb" 2>&1 | tee ./dpkg_log
# Install the fake package without its dependencies with dpkg --force-depends
LC_ALL=C dpkg-deb --build ${pkgname} ${pkgname}.deb > ./dpkg_log 2>&1 || { cat ./dpkg_log; false; }
LC_ALL=C dpkg --force-depends --install "./${pkgname}.deb" 2>&1 | tee ./dpkg_log
)
ynh_package_install --fix-broken \
@ -323,6 +321,7 @@ Package: ${dep_app}-ynh-deps
Version: ${version}
Depends: ${dependencies}
Architecture: all
Maintainer: root@localhost
Description: Fake package for ${app} (YunoHost app) dependencies
This meta-package is only responsible of installing its dependencies.
EOF

View file

@ -90,27 +90,25 @@ ynh_apt_install_dependencies() {
dependencies="$current_dependencies, $dependencies"
fi
# #############################
# Actual install using equivs #
# #############################
# ################
# Actual install #
# ################
# Prepare the virtual-dependency control file for equivs
# Prepare the virtual-dependency control file for dpkg-deb --build
local TMPDIR=$(mktemp --directory)
cat >${TMPDIR}/control <<EOF # Make a control file for equivs-build
mkdir -p ${TMPDIR}/${app_ynh_deps}/DEBIAN
cat >${TMPDIR}/${app_ynh_deps}/DEBIAN/control <<EOF
Section: misc
Priority: optional
Package: ${app_ynh_deps}
Version: ${version}
Depends: ${dependencies}
Architecture: all
Maintainer: root@localhost
Description: Fake package for ${app} (YunoHost app) dependencies
This meta-package is only responsible of installing its dependencies.
EOF
# Make sure to delete equivs' legacy compat file
# It's now handle somewhat magically through the control file
rm -f /usr/share/equivs/template/debian/compat
_ynh_apt update
_ynh_wait_dpkg_free
@ -119,8 +117,8 @@ EOF
# NB: this is in a subshell (though not sure why exactly not just use pushd/popd...)
cd "$TMPDIR"
# Install the fake package without its dependencies with dpkg --force-depends
LC_ALL=C equivs-build ./control > ./equivs_log 2>&1 || { cat ./equivs_log; false; }
LC_ALL=C dpkg --force-depends --install "./${app_ynh_deps}_${version}_all.deb" > ./dpkg_log 2>&1
LC_ALL=C dpkg-deb --build ${app_ynh_deps} ${app_ynh_deps}.deb > ./dpkg_log 2>&1 || { cat ./dpkg_log; false; }
LC_ALL=C dpkg --force-depends --install "./${app_ynh_deps}.deb" > ./dpkg_log 2>&1
)
# Then install the missing dependencies with apt install