Commit graph

316 commits

Author SHA1 Message Date
Yorhel
5cc77bc7f1 Fixes and updates for new FU version 2025-02-28 13:55:57 +01:00
Yorhel
c16fe86e7a FU: Use schema validation for query parameters
...much better.

(Also I remembered why I threw away groff stderr; it's pretty useless)
2025-02-25 15:54:01 +01:00
Yorhel
682321d1be ManUtils: Move, use ExtUtils::MakeMaker and get rid of AnyEvent
I mean, I like AnyEvent, but this can be done with core modules as well
(albeit somewhat more verbose and error-prone...)
2025-02-24 19:00:09 +01:00
Yorhel
2f33e7f4b5 FU: Initial transition from TUWF
Seems to be working alright, and it does clean up a few things. The
biggest missing thing right now is schema-based validation for some
query parameters. I'm also seeing opportunities for FU::Pg to act as a
hash/shorthash codec, simplifying some error-prone manual conversions.
2025-02-24 16:05:51 +01:00
Yorhel
97d15020f7 indexer: Turn error into warning 2025-02-23 16:23:21 +01:00
Yorhel
1f8bd0ef9a *BSD repo updates 2025-01-09 13:24:00 +01:00
Yorhel
147911b750 CentOS 10 & Ubuntu mirror switch 2025-01-04 10:32:58 +01:00
Yorhel
ea99fc71f9 Alpine 3.21 2024-12-06 08:24:55 +01:00
Yorhel
57de5699e8 Repo updates + some /about page wording 2024-10-30 09:58:09 +01:00
Yorhel
ffad28696e Unbreak groff single quotes and backticks character replacements 2024-07-30 13:10:58 +02:00
Yorhel
0c1b140638 FreeBSD 14.1 2024-06-07 07:19:12 +02:00
Yorhel
bb5f1adc1f Alpine 3.20 2024-05-22 15:27:15 +02:00
Yorhel
9ff6bfc93f indexer: Actually commit the transaction that resets the dead flag 2024-05-13 10:38:48 +02:00
Yorhel
c67091f096 indexer: Drop old package-dead-marking code for Arch
A much simpler approach to dead-marking is to do a periodic

  UPDATE packages SET dead = true WHERE system = $1;

before running the indexer. Not as efficient in terms of avoiding
database writes, but there's no need to run this very often anyway.
2024-05-13 08:57:35 +02:00
Yorhel
ca07b78610 www: Fix versions page for multichar sections + add section selector 2024-05-02 20:01:52 +02:00
Yorhel
3bf860f54e www: Don't throw an error on empty search query
(Not that the current page is much better)
2024-05-01 17:04:16 +02:00
Yorhel
cd5d2c6a20 Remove encodings from "locales" table + delete incorrect locales
The frontend always stripped off the encodings already, so no point in
keeping that in the DB indices. The full locale was extracted from the
filename, which we still keep, so no information is list.

SQL "migration" script:

  BEGIN;
  CREATE INDEX files_tmp_locale ON files (locale);

  INSERT INTO locales (locale) VALUES ('pl_PL'), ('is_IS'), ('ko_KR');

  WITH obs(id, locale, lang) AS (
    SELECT id, locale, regexp_replace(locale, '^([^.]+)\..+$', '\1') FROM locales WHERE locale LIKE '%.%'
     UNION ALL
    SELECT id, locale, '' FROM locales WHERE locale LIKE 'node%' OR locale = 'common'
  ), rep(old, new) AS (
    SELECT o.id, x.id FROM obs o LEFT JOIN locales x ON x.locale = o.lang
  ), upd AS (
    UPDATE files SET locale = new FROM rep WHERE locale = old
  ) DELETE FROM locales WHERE id IN(SELECT id FROM obs);

  DROP INDEX files_tmp_locale;

  COMMIT;
2024-05-01 17:04:09 +02:00
Yorhel
1ee5c9c2df SQL: Add packages.c_hasman cache to speed up package listings
Going from average ~100ms to ~10ms or so. The previous query had a
tendency to be much slower sometimes, let's see if this cache also takes
care of those outliers.

Migration script:

  ALTER TABLE packages ADD COLUMN c_hasman boolean NOT NULL DEFAULT FALSE;

  DROP INDEX packages_system_name_key;
  CREATE UNIQUE INDEX packages_system_name_key ON packages (system, name) INCLUDE (id, c_hasman, dead);

  UPDATE packages SET c_hasman = NOT c_hasman
   WHERE c_hasman <> EXISTS(SELECT 1 FROM package_versions pv WHERE pv.package = packages.id AND EXISTS(SELECT 1 FROM files f WHERE f.pkgver = pv.id));
2024-04-29 21:15:40 +02:00
Yorhel
5d56bded66 www: Include package date in versions listing 2024-04-29 16:30:59 +02:00
Yorhel
18b9666e32 www: Replace "versions" tab with separate page
This gets rid of the last remaining feature that only worked with
Javascript.
2024-04-29 16:24:23 +02:00
Yorhel
962a7c848a www: Fix search redirect if no section is specified
i.e. let the man_pref logic determine the most useful section, instead
of forcing the first relevant section in the redirect.
2024-04-29 11:31:28 +02:00
Yorhel
9a81147983 www: Drop search autocomplete, but make search itself a bit more useful 2024-04-29 11:26:05 +02:00
Yorhel
fc9a19e7c4 indexer: Disable broken dead-package checking for Arch
Which I broke in 83ab6c3671. Need to find
an alternative approach to detecting dead packages sometime. The 'dead'
flag isn't super important so it can wait.
2024-04-29 10:45:13 +02:00
Yorhel
105d0dd3e5 Add link to manpage.me
Surprised I've not heard about that one yet.
2024-04-28 16:43:26 +02:00
Yorhel
ccecb28835 Drop grog(1) in favor of 'groff -mandoc' + two regexes
This provides an almost 2x speedup in man page rendering time and
removes some heuristics to work around bad guesses by grog(1).

Funnily enough, this also fixes rendering of obscure man pages that
happen to use 'grap' macros; grog detected those correctly but my groff
installation doesn't actually support rendering that.

No doubt I broke rendering of other pages, will have to see.
2024-04-28 15:08:00 +02:00
Yorhel
83ab6c3671 Get rid of package categories
Whether or not the package name itself or the (category,name) tuple
uniquely identified a package within a system has been a source of
confusion for a long time. Back in
03d278e4ff I ended up playing playing it
"safe" by going for (category,name), but in practice this doesn't make a
whole lot of sense. While it's *possible* for the same package name to
refer to completely different packages in different "categories", in
reality distributions can't sanely support this anyway.

For distributions where the category referred to a repository, the only
cases where the same package name was used in different repos was when
the package has moved from one repo to another. Those should certainly
not be treated as different packages.

For distributions where the category really referred to a category,
there's the Debian approach where the category is purely a tag and
doesn't help identify the package in any way, and then there's FreeBSD
where the category technically ought to be part of the name.  There were
a few cases where FreeBSD used categories to separate out different
versions of the same package (e.g. ipv6 vs non-ipv6), but none were
relevant for man pages so I ended up merging those as well.

Getting rid of the categories simplifies and shortens URLs, unclutters
the UI a little bit and merges the packages in listings that should've
been merged all along.

Migration script:

  -- Merge packages that are in multiple categories.
  -- All versions are moved to the package with the lowest ID.
  -- If the same version already exists in a lower ID, the higher-ID version is deleted.
  BEGIN;
  WITH migrate(old, new, second) AS (
    SELECT q.id, MIN(p.id), MAX(p.id)
      FROM packages p
      JOIN packages q ON q.id > p.id AND p.system = q.system AND p.name = q.name
     GROUP BY q.id
  ), ded(n) AS (
    UPDATE packages SET dead = false
      FROM migrate m
      JOIN packages q ON q.id = m.old
     WHERE packages.id = m.new AND packages.dead AND NOT q.dead
    RETURNING 1
  ), mov(n) AS (
    UPDATE package_versions SET package = m.new
      FROM migrate m
     WHERE package_versions.package = m.old
       AND NOT EXISTS(
          SELECT 1
            FROM package_versions v
           WHERE v.package IN(m.new, m.second)
             AND v.version = package_versions.version)
    RETURNING 1
  ), del(n) AS (
    DELETE FROM packages WHERE id IN(SELECT old FROM migrate)
    RETURNING 1
  ) SELECT (SELECT count(*) FROM migrate) AS migrate,
           (SELECT count(*) FROM ded) AS ded,
           (SELECT count(*) FROM mov) AS mov,
           (SELECT count(*) FROM del) AS del;

  ALTER TABLE packages DROP CONSTRAINT packages_system_name_category_key;
  CREATE UNIQUE INDEX packages_system_name_key ON packages (system, name);
  ALTER TABLE packages DROP COLUMN category;
  COMMIT;
2024-04-28 10:37:04 +02:00
Yorhel
bc26633fc7 UI: Replace "locations" tab with separate page
Removing the JS requirement and (hopefully) providing a more useful
view into the same data.

This view now also lists other man pages that happen to have the same
contents.
2024-04-27 12:56:10 +02:00
Yorhel
9d650b00ec Add Ubuntu 24.04 2024-04-25 17:46:45 +02:00
Yorhel
97b88a989f Add Fedora 40 2024-04-23 17:26:35 +02:00
Yorhel
d8f452e47e Add OpenBSD 2024-04-23 13:40:10 +02:00
Yorhel
30a8353089 www: Fix link to schema.sql 2024-04-14 12:54:07 +02:00
Yorhel
bb28e17bbd www: Keep links to other man pages within the same system
The sidebar links should actually stay within the same system as well,
it's quite confusing this way. Meh.
2024-04-14 12:35:54 +02:00
Yorhel
a99b8aec89 Add FreeBSD 13.3 2024-04-14 12:22:11 +02:00
Yorhel
ab721c97b9 NetBSD: Remove 2.0.3; use HTTP
I forgot I had firewalled port 443 on prod system, heh.
Remaining NetBSD versions have now been indexed.
2024-04-14 12:14:21 +02:00
Yorhel
f92639d22c Cleanup SQL files 2024-04-14 11:35:39 +02:00
Yorhel
c9eef9e10a Index NetBSD 2024-04-14 11:35:04 +02:00
Yorhel
4356620d1f Fix URL to NetBSD man pages 2024-02-02 19:55:22 +01:00
Yorhel
f33081df11 Fix indexing of Debian architecture-independent packages + Alpine 3.19 2024-01-03 10:25:48 +01:00
Yorhel
c2a1dd6416 Some fixes and repo updates 2023-11-26 10:33:30 +01:00
Yorhel
580fa89520 Also update Ubuntu 2023-05-27 21:17:04 +02:00
Yorhel
e77775246c Repo updates 2023-05-27 06:48:19 +02:00
Yorhel
f5b35efdc3 www: Prefer <name>.<section> pages over <name> 2023-05-26 12:22:47 +02:00
Yorhel
7302a6408a indexer: Skip some more non-manpage files 2023-05-26 12:16:22 +02:00
Yorhel
962ded97f5 Fix a shorthash encoding confusion 2023-04-30 09:01:38 +02:00
Yorhel
81c9ec53ff Bunch of repo updates 2022-12-17 13:06:42 +01:00
Yorhel
47d86c06fd Add FreeBSD 12.3 & 13.1 2022-07-26 21:23:06 +02:00
Yorhel
ea1531fcc3 Fix recognizing the default (empty) locale as English
This fixes selecting the right man page for 'mount', which would
otherwise grab a version from an old distro that happened to have it
with an explicit 'en' locale.
2022-07-26 15:06:06 +02:00
Yorhel
33efd07715 Fix the "prefer lower sections" man page selection rule 2022-07-26 14:58:29 +02:00
Yorhel
775eabfb7e Some repo updates
Haven't done this in a while, was lagging behind quite a bit.
FreeBSD also has two new versions that need to be indexed, will add
those later.
2022-07-26 07:25:38 +02:00
Yorhel
fa8e084879 Bunch of fixes 2022-01-10 20:05:09 +01:00