DB cleanup: Remove some non-manpages & fix wrongly-detected locales

This commit is contained in:
Yorhel 2016-10-16 10:03:34 +02:00
parent 17fc298217
commit 8a0fac08b6
2 changed files with 35 additions and 2 deletions

19
sql/update-2016-10-16.sql Normal file
View file

@ -0,0 +1,19 @@
-- Various non-manpages
DELETE FROM man
WHERE filename ~ '/Makefile\.(in|am)$'
OR filename ~ '/\.cvsignore(\.gz)?$'
OR filename !~ '/[^/]*\.[^/]*$'
OR filename ~ '/man\.tmp$';
-- Wrong locales, found with:
-- SELECT DISTINCT Locale FROM man ORDER BY locale;
UPDATE man SET locale = NULL
WHERE locale = '5man'
OR locale = 'c'
OR locale ~ '^man.?$'
OR locale ~ '^Man-Part[12]$';
-- Man page containing only a '$1'. Likely a build failure in earlier FreeBSD releases.
DELETE FROM man WHERE hash = '\x5ea7b8101325c704551852f70b652e0a2b0d7c12';
DELETE FROM contents c WHERE NOT EXISTS(SELECT 1 FROM man m WHERE m.hash = c.hash);

View file

@ -154,9 +154,23 @@ find sub {
return warn "abs_path($File::Find::name): $!\n" if !$path;
return warn "$vpath ($path) points outside of the tar directory!\n" if $path !~ s/^\Q$dir\E//;
# Note: fltk also creates pre-formatted pages in /cat$sectre/, but those are ignored.
# TODO: Also ignore html and INDEX sections
return warn "Ignoring $vpath\n" if $vpath !~ m{man(?:/([^/]+))?/man[0-9n]/([^/]+)$};
addman $pkgid, $vpath, $2, $1;
my($locale, $fn) = ($1, $2);
return warn "Ignoring $vpath\n" if
$fn =~ /^Makefile\.(in|am)$/
|| $fn =~ /^\.cvsignore(\.gz)?$/
|| $fn !~ /\./ # Also excludes INDEX files
|| $fn eq 'man.tmp';
$locale = undef if $locale && (
$locale eq '5man'
|| $locale eq 'c'
|| $locale =~ /^man.?$/
|| $locale =~ /^Man-Part[12]/
);
addman $pkgid, $vpath, $fn, $locale;
$found++;
}, $dir;