Page MenuHomeFreeBSD

Deal with multiple WWW URLs in Makefile
ClosedPublic

Authored by se on Sep 14 2022, 8:19 AM.
Tags
None
Referenced Files
Unknown Object (File)
Dec 28 2023, 4:18 AM
Unknown Object (File)
Dec 28 2023, 4:18 AM
Unknown Object (File)
Dec 28 2023, 4:18 AM
Unknown Object (File)
Dec 28 2023, 4:18 AM
Unknown Object (File)
Dec 28 2023, 4:18 AM
Unknown Object (File)
Dec 28 2023, 4:18 AM
Unknown Object (File)
Dec 25 2023, 9:29 AM
Unknown Object (File)
Dec 20 2023, 7:05 AM
Subscribers

Details

Summary

The WWW variable has been introduced into port Makefiles to make it more visible, easier to check and maintain, and simplify access to this value from scripts.
This variable was meant to only contain a single URL (typically the one most relevant for a user who installs the software and needs help configuring or using it).
Some maintainers have started adding multiple URLs to this variable, and thus broken the assumption in existing tools and scripts (including bsd.port.mk) that only one URL is provided.
E.g. the command "make pretty-print-www-site" generates an invalid HTML anchor for such ports (e.g. devel/osc).

Since it is harder to pervent this (mis-)use than to work around it, changes to bsd.port.mk and create-manifest.sh are suggested in this patch-set, which ignore all but the first value in places where only one value is expected/accepted.
This change would also allow setting WWW for some files in Uses/*.mk, e.g. to add an URL for X.org ports (that currently do not have WWW values since none were in their pkg-descr files).

Test Plan

Apply patch and build devel/osc or any other port with multiple URLs in its WWW variable.
Verify the manifest in the package created from this port: It should have a single URL in its "www" element, but multiple lines with URLs prefixed with "WWW: " at the end of the "desc" element.
Verify that "make pretty-print-www-site" generates a well-formed HTML anchor pointing at the first URL in${WWW}.

Diff Detail

Repository
R11 FreeBSD ports repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

se requested review of this revision.Sep 14 2022, 8:19 AM
se created this revision.
bapt added inline comments.
Mk/bsd.port.mk
4355–4356

what happen if WWW is empty ?

In addition to the previous patch provide default WWW values for the USE_GITHUB or USE_GITLAB cases.
Many ports just point at the repository, and in case of GitHub or GitLab we have all required parameters to construct the URL.
Ports can still override this value by defining WWW.

Mk/bsd.port.mk
4355–4356

An empty WWW has the same effect as no WWW: line in a pkg-descr file used to have before the introduction of the WWW variable in the Makefile:
The "www" element will be omitted from the manifest, the INDEX file will have an empty WWW column.
The change proposed in this review does only affect the case of multiple URLs assigned to the WWW variable - other aspects are unchanged from the latest committed state of bsd.port.mk.
(BTW: I have moved the assignment to _WWW up to before its first use in bsd.port.mk and out of this conditional block. This is not a functional change, since the "describe" target is not defined in any other place, but I think it is clearer that way.)

> awk -F '|' '{print $1, $10}' INDEX-14  | grep -e 'http.*://.*http.*://.*'                                                                                                                  
tclgeomap-2.11.6 https://web.archive.org/web/20130807000308/http://www.tkgeomap.org/
tkgeomap-2.11.6 https://web.archive.org/web/20130807000308/http://www.tkgeomap.org/
cvschk-1.12 http://web.archive.org/web/20121006163548/http://cvs.sslug.dk/cvs2html/
cvsgraph-1.7.0_8 https://web.archive.org/web/20181111235708/http://www.akhphd.au.dk/~bertho/cvsgraph/
xxl-1.0.1_3 https://web.archive.org/web/20120106082715/http://www.zork.org/xxl/
vba-1.7.2_13 https://web.archive.org/web/20110718045837/http://vba.ngemu.com/
xsystem35-1.7.3.p5_4 https://web.archive.org/web/20121222144009/http://8ne.sakura.ne.jp:20008/chika/unitbase/xsys35/
xzx-4.6_5 https://web.archive.org/web/20150211123250/http://erik-kunze.de/xzx/
wmget-0.6.0_8 https://web.archive.org/web/20160322141200/http://amtrickey.net/wmget/
yafc-1.3.7 https://web.archive.org/web/20180422134425/http://www.yafc-ftp.com/
agame-1577_13 https://web.archive.org/web/20190410210052/http://zevv.nl/play/code/game/
allacrost-1.0.2_32 https://web.archive.org/web/20201126135328/http://allacrost.org/
billardgl-1.75_2 https://web.archive.org/web/20180527220530/http://www.billardgl.de/index-en.html
blackshadeselite-0.0.1_11 https://web.archive.org/web/20170521213338/http://home.gna.org/blackshadeselite/
brainparty-0.61_3 https://web.archive.org/web/20170722185419/http://www.tuxradar.com/brainparty
holotz-castle-1.3.14_8 https://web.archive.org/web/20130606213511/http://mainreactor.net/
jigzo-0.6.1_12 https://web.archive.org/web/20110102231249/http://www.resorama.com/jigzo
openbubbles-1.2_5 https://web.archive.org/web/20101126190910/http://www.freewebs.com/lasindi/openbubbles/
rocksndiamonds-data-20131106_2 https://web.archive.org/web/20140110211740/http://www.bd-fans.com/RnD.html
trimines-1.3.0_7 https://web.archive.org/web/20120308223312/https://www.freewebs.com/trimines/
warmux-11.04.1_10 https://web.archive.org/web/20170513192248/http://gna.org/projects/warmux/
wop-0.4.3_15 https://web.archive.org/web/20141218154118/http://wormsofprey.org/
Hermes-1.3.3_5 http://web.archive.org/web/20061005045333/http://www.clanlib.org/hermes/
ja-less-382.262.03.01 http://web.archive.org/web/20070220213232/http://www25.big.or.jp/~jam/less
sqlitejdbc-056_2 http://web.archive.org/web/20120721075310/http://www.zentus.com/sqlitejdbc/
biblical-curse-0.02 https://web.archive.org/web/20071226004947/http://shipoffools.com/curses/index.html
granulate-0.2 https://web.archive.org/web/20021208171222/http://exe2bin.com/granulate/
bsdbktr_tvtune-0.02 https://web.archive.org/web/20050207003754/http://topfx.com/dist/bsdbktr_tvtune/
ldapbrowser-2.8.2_4 https://web.archive.org/web/20081218031210/http://www.mcs.anl.gov/~gawor/ldap/
tcpwatch-1.3_4 https://web.archive.org/web/20111102010334/http://hathawaymix.org/Software/TCPWatch/
tcpwatch-py310-1.3_4 https://web.archive.org/web/20111102010334/http://hathawaymix.org/Software/TCPWatch/
tcpwatch-py311-1.3_4 https://web.archive.org/web/20111102010334/http://hathawaymix.org/Software/TCPWatch/
tcpwatch-py37-1.3_4 https://web.archive.org/web/20111102010334/http://hathawaymix.org/Software/TCPWatch/
tcpwatch-py38-1.3_4 https://web.archive.org/web/20111102010334/http://hathawaymix.org/Software/TCPWatch/
enteruser-1.0 https://web.archive.org/web/20041211013021/http://www.daemonnews.org/199908/enteruser.html
smb_auth-0.05_10 http://web.archive.org/web/20050320094310/http://www.hacom.nl/~richard/software/smb_auth.html
piewm-1.04_4 https://web.archive.org/web/20160409071502if_/http://www.crynwr.com/piewm/index.html~

There still seem to be some issues with the index after the change.

WWW=            https://web.archive.org/web/20110102231249/http://www.resorama.com/jigzo

ok...

Macro surewhynot:

so, ignore that, as it's all wayback-machine stuff, it's fine :)

Move definition of default values for ports fetched from GitHub or GitLab into bsd.sites.mk.
Defaults for CPAN, PEAR, and Python are also provided.
Default values are only used if there is no definition in the port or any included USES makefile etc.

> awk -F '|' '{print $1, $10}' INDEX-14  | grep -e 'http.*://.*http.*://.*'                                                                                                                  
tclgeomap-2.11.6 https://web.archive.org/web/20130807000308/http://www.tkgeomap.org/

[...]

smb_auth-0.05_10 http://web.archive.org/web/20050320094310/http://www.hacom.nl/~richard/software/smb_auth.html
piewm-1.04_4 https://web.archive.org/web/20160409071502if_/http://www.crynwr.com/piewm/index.html~

There still seem to be some issues with the index after the change.

As you have already noticed, this is a way to access backups of documentation that was hosted on discontinued hosts ...
Even source files can often be found in the archived of the Wayback machine.

These URLs should probably be rewritten to use the HTTPS protocol where HTTP is currently used, though.

Mk/bsd.sites.mk
453 ↗(On Diff #110751)

instead of the if, maybe WWW?=

Use WWW?= to set the default values instead of wrapping the definition into !defined(WWW).

se marked an inline comment as done.Sep 20 2022, 10:09 PM
This revision is now accepted and ready to land.Sep 21 2022, 4:29 AM