Port tree linter

From: Hubert Tournier <hubert.tournier_at_gmail.com>
Date: Tue, 27 Feb 2024 17:50:26 UTC
Hello there!

I made a small program that perhaps may be of interest to some port 
maintainers.

It's called portlint2 (https://github.com/HubTou/portlint2), and it 
checks the ports Index file and the port's makefiles, for the whole port 
tree, or for selected categories / maintainers / ports.

On a freshly updated port Index and port tree, it will produce a summary 
of findings like this:

Selected 34434 ports out of 34434 in the FreeBSD port tree, and found:
   4 ports with unusual installation-prefix (warning)
   339 ports with a comment string exceeding 70 characters (warning)
   286 ports with an uncapitalized comment
   11 ports comment ending with a dot
   108 ports with a comment different between the Index and Makefile
   2 ports with non existent description-file
   4 ports with a maintainer different between the Index and Makefile
   34 ports referring to unofficial categories (warning)
   262 ports with categories different between the Index and Makefile
   1251 ports with no www-site
   300 ports with an unresolvable www-site hostname
   658 ports with an unaccessible www-site
   2 ports with a www-site different betwwen the Index and makefile

There are other checks, but it only prints summary lines for those with 1+ occurrences.

Before this summary, it prints a list of affected ports per maintainer, for example like this:

   yuri@FreeBSD.org:
     Diverging comments:
       jamulus-server-3.10.0 RStudio-2022.12.0+353_6
       RStudio-server-2022.12.0+353_6 qbittorrent-nox-4.6.3
     Too long comments:
       py39-pytest4-flakes-4.0.1 py39-spectral-0.22.4_1
     Uncapitalized comments:
       shunit2-2.1.8.93 libmicrodns-0.2.0 py39-mmcif-0.84 hq-1.0.1_9
       ibus-m17n-1.4.28 jaq-1.3.0_1
     Diverging categories:
       obs-studio-30.0.2_1
     HTTP Error 404 (Not found) on www-site:
       eteroj-lv2-0.10.0_1 geonkick-lv2-2.10.0 lv2lint-0.16.2_2
       midi-matrix-lv2-0.28.0_1 moony-lv2-0.36.0_1 orbit-lv2-0.1.661
       py39-hsaudiotag3k-1.1.3.p1 sherlock-lv2-0.28.0_2 timely-lv2-g20190412_1
       vm-lv2-0.14.0_2 graphlan-1.1.3_1 GroopM-0.3.4_4 thrust-1.9.5_1
       py39-ta-lib-0.4.28 cmh-1.1.1_3 FlintQS-1.0
       coin-or-flopc++-1.2.5.20200527_1 moab-5.3.1_5 mpfrcx-0.6.3_1
       paritwine-0.1_3 vinci-1.0.5 ironscanner-1.1.0.20180828 sdformat-8.0.0_6
       clash-1.18.0_2 dftd3-3.2.0.3_1 dftd4-3.5.0_1 octopus-13.0_1
       openbabel-3.1.1.178 opsin-3.0.20190223_1 py39-dftd4-3.5.0
       py39-openbabel-3.1.1.1 py39-phono3py-1.22.3_2 py39-pyked-0.4.1.16_1
       xdrawchem-1.11.0.2_2 ntk-1.3.1001_1 redkite-1.3.1
     Unresolvable www-site:
       libpcl-1.12 geogram-1.7.9 daggy-2.1.3_1 silicon-0.1.124 ztoolkit-0.1.2_2

It also produces more detailed error logs on stderr.

I hope it will be useful to others.

I needed this because I have another program that mass checks Python ports for unreported vulnerabilities,
which needs an up-to-date and correct information in the ports Index to be relevant...

Best regards,

Hubert