From 212fc725ba74c4b458addb0303c1f69471a140b6 Mon Sep 17 00:00:00 2001 From: Yorhel Date: Mon, 19 Apr 2021 07:39:25 +0200 Subject: [PATCH] Update man page selection algortihm to bias Ubuntu Should really be Debian, but we only index Debian stable at the moment and it tends to lag behind Ubuntu a bit. This extra bias is intended to solve (part of) the issue with distro-specific tooling like 'ifup'. This really should be updated to have a generic preference order for all distros, but that's not as easy to implement. Fixes #1. --- www/index.pl | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/www/index.pl b/www/index.pl index 8997051..df7f3f0 100755 --- a/www/index.pl +++ b/www/index.pl @@ -1012,10 +1012,12 @@ sub dbManPref { # 3. stdloc: Prefer man pages in standard locations # 4. secmatch: Prefer an exact section match # 5. arch: Prefer Arch over other systems (because it tends to be the most up-to-date, and closest to upstreams) - # 6. sysrel: Prefer a later system release over an older release - # 7. secorder: Lower sections before higher sections (because man does it this way, for some reason) - # 8. pkgdate: Prefer more recent packages (cross-distro) - # 9. Fall back on hash comparison, to ensure the result is stable + # 6. ubuntu: If there's no Arch, prefer Ubuntu over other systems (again, tends to be more up-to-date) + # (also resolves distro-specific tooling disputes such as https://code.blicky.net/yorhel/manned/issues/1 ) + # 7. sysrel: Prefer a later system release over an older release + # 8. secorder: Lower sections before higher sections (because man does it this way, for some reason) + # 9. pkgdate: Prefer more recent packages (cross-distro) + # 10.Fall back on hash comparison, to ensure the result is stable $s->dbAll(q{ WITH unfiltered AS ( @@ -1035,8 +1037,10 @@ sub dbManPref { SELECT * FROM f_stdloc WHERE NOT EXISTS(SELECT 1 FROM f_stdloc WHERE (man).section = ?) OR (man).section = ? ), f_arch AS( SELECT * FROM f_secmatch WHERE NOT EXISTS(SELECT 1 FROM f_secmatch WHERE (sys).id = 1) OR (sys).id = 1 + ), f_ubuntu AS( + SELECT * FROM f_arch WHERE NOT EXISTS(SELECT 1 FROM f_arch WHERE (sys).name = 'Ubuntu') OR (sys).name = 'Ubuntu' ), f_sysrel AS( - SELECT * FROM f_arch a WHERE NOT EXISTS(SELECT 1 FROM f_arch b WHERE (a.sys).name = (b.sys).name AND (a.sys).relorder < (b.sys).relorder) + SELECT * FROM f_ubuntu a WHERE NOT EXISTS(SELECT 1 FROM f_ubuntu b WHERE (a.sys).name = (b.sys).name AND (a.sys).relorder < (b.sys).relorder) ), f_secorder AS( SELECT * FROM f_sysrel a WHERE NOT EXISTS(SELECT 1 FROM f_sysrel b WHERE (a.man).section > (b.man).section) ), f_pkgdate AS(