Re: broken UCL in pkg-message

From: Dan Langille <dan_at_langille.org>
Date: Fri, 29 Oct 2021 17:20:56 UTC
Dan Langille wrote on 10/25/21 6:08 PM:
> Hello,
> 
> I've been working on displaying the pkg-message information on 
> FreshPorts. [1] Part of this involves parsing the file via ucl_tool 
> (textproc/libucl) - along the way I have been finding broken pkg-message 
> files and fixing them.
> 
> I have created a task[2] for myself to add a sanity check to FreshPorts 
> so committers get instant notification. [3]
> 
> It might also be useful to have a pre-commit hook cover this.
> 
> I could use help correctly the broken entries in the ports tree. I do 
> not have time to fix them myself.
> 
> I can provide starting points:
> 
> * use this search term on your search engine: site:freshports.org 
> "WARNING: The FreshPorts parser failed. ucl_tool failed. Please report 
> this"
> * write a small shell script to find broken UCL
> 
> I think the former is a short list, but will not find everything.
> 
> The shell script is sort of like this:
> 
> find /usr/ports -name pkg-message -exec another-script
> 
> Where that other script does this:
>   /usr/local/bin/ucl_tool --in FILE --format json
> If [ $? <> 0] ;then
>   #this one needs fixing
> fi
> 
> That should find most, but you also want to look for pkg-message.in
> 
> I started this search through the cache:
> 
> [aws-1-nginx01 dan ~] % sudo grep -rl 'The FreshPorts parser failed' 
> ~freshports/cache/ports/*
> devel/kf5-solid
> devel/kyua
> games/shockolate
> net/endlessh
> net/py-wsdd
> 
> The output has been modified to show just the category/port name.
> 
> [1] - 
> https://news.freshports.org/2021/10/14/pkg-message-ucl-type-gives-_pkgmessage_ucl-found-a-type-is-it-not-prepared-for-array/ 
> 
> 
> [2] - https://github.com/FreshPorts/freshports/issues/345
> 
> [3] - 
> https://docs.freebsd.org/en/books/porters-handbook/keeping-up/#freshports


I've created a script[4] which identifies about 35 ports[5] with invalid 
UCL.

My plan: if the fix is obvious, commit the fix. I will bump PORTREVISION 
if the port is not complex (i.e. part of KDE).

For complex ports, I will open a PR.

cheers.


[4] The script:

[pkg01 dan ~/ports/head] % cat ~/bin/validate-pkg-message
#!/bin/sh

cd ~/ports/head
FILES=`find -s . | grep pkg-message`
for file in ${FILES}
do
   /usr/local/bin/ucl_tool --format json --in ${file} > /dev/null 2>&1
   if [ $? != 0 ]
   then
     echo $file
   fi
done
[pkg01 dan ~/ports/head] %

[5] Which produces:

./audio/playumidi/pkg-message
./databases/ateam_mysql57_ldap_auth/files/pkg-message.in
./devel/awscli/files/pkg-message.in
./devel/schilybase/files/pkg-message.rscsi.in
./games/py-pychess/pkg-message
./games/shockolate/pkg-message
./graphics/appleseed/files/pkg-message.in
./lang/mecrisp-stellaris/pkg-message-aarch64
./lang/php74/pkg-message.mod
./lang/php80/pkg-message.mod
./lang/pocl/pkg-message
./mail/mailman3/pkg-message
./multimedia/makemkv/pkg-message
./net/endlessh/files/pkg-message.in
./net-im/biboumi/files/pkg-message.in
./net-im/conduit/files/pkg-message.in
./net-im/ejabberd/files/pkg-message.in
./net-im/sshout/pkg-message
./security/dsvpn/files/pkg-message.in
./security/secpanel/files/pkg-message.in
./security/sssd/files/pkg-message.in
./security/wazuh-agent/pkg-message
./sysutils/rtsx-kmod/pkg-message
./www/fusionpbx/files/pkg-message
./www/madsonic/pkg-message-jetty
./www/madsonic/pkg-message-spacer
./www/madsonic/pkg-message-tomcat
./www/subsonic-standalone/files/pkg-message.in
./www/writefreely/files/pkg-message.in
./x11/nvidia-hybrid-graphics/files/pkg-message.in
./x11-toolkits/termit/files/pkg-message.in
./x11-wm/hs-xmonad/pkg-message
./x11-wm/leftwm/pkg-message
./x11-wm/nscde/pkg-message



-- 
Dan Langille
dan@langille.org