YunoHost / issues

General issue tracker for the YunoHost project
72 stars 8 forks source link

PHP dependency madness: episode 7514482, fixing through automatic PR on apps... #1627

Closed alexAubin closed 3 years ago

alexAubin commented 4 years ago

Following this thread https://forum.yunohost.org/t/l-operation-installer-l-application-kanboard-a-echoue/11753

I went rampage because this is most probably another issue related to sury, though not yet 100% sure of the explanation ...

My guess is that because php-dom is a virtual package that can be provided by any php*-dom, apt wants you to choose one:

 > apt install php-dom
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package php-dom is a virtual package provided by:
  php7.4-xml 7.4.6-1+0~20200514.17+debian9~1.gbp0f509e
  php7.3-xml 7.3.18-1+0~20200515.59+debian9~1.gbp12fa4f
  php7.2-xml 7.2.31-1+0~20200514.41+debian9~1.gbpe2a56b
  php7.1-xml 7.1.33-16+0~20200514.38+debian9~1.gbp1e5820
  php7.0-xml 7.0.33-29+0~20200514.36+debian9~1.gbp126f6f
  php5.6-xml 5.6.40-29+0~20200514.35+debian9~1.gbpcc49a4
You should explicitly select one to install.

E: Package 'php-dom' has no installation candidate

Anyway, as recommended by taziden, we should avoid installing php-foo packages without explicit version. (So instead we should install php7.0-foo)

Here's a grep that shows apps level 4+ that have any php-foo as dep:

https://paste.yunohost.org/raw/webaronaga

So I'm proposing to create a PR on each of those apps to replace all the "trivial" PHP deps with their php7.0 equivalent. Note that I took time to investigate and find php deps that are "trivial" (typically only Depends on their php7.0 sibling... But that's not the case of all deps, such as php-auth-sasl or php-patchwork-utf8 which are way more complex.

PHP_DEPS="php-bcmath php-cli php-curl php-dev php-gd php-gmp php-imap php-intl php-json php-ldap php-mbstring php-mysql php-soap php-sqlite3 php-tidy php-xml php-xmlrpc php-zip php-dom php-opcache php-xsl php-apcu php-geoip php-imagick php-memcached php-redis php-ssh2 php-common"

APPS="agendav ampache baikal bozon emailpoubelle freshrss friendica horde hubzilla jeedom kanboard matomo opensondage osticket piwigo roundcube shaarli ttrss wallabag2 z-push zabbix zap"

for APP in $APPS
do
    for DEP in $PHP_DEPS
    do
        NEWDEP=$(echo $DEP | sed 's/php-/php7.0-/g')
        sed -i $APP/scripts/_common.sh "s/$DEP/$NEWDEP/g"
        sed -i $APP/scripts/install "s/$DEP/$NEWDEP/g"
    done
    # Here: create a PR with the changes using yunohost-bot...
done

Or we can also go for yet-another-stupid-hacky-patch in the core >_>

alexAubin commented 4 years ago

Follow-up: https://github.com/YunoHost/apps/pull/939

alexAubin commented 3 years ago

Mokay let's close this idk