Hi Vadim, thanks for the input.
Comments below.

On Mon, 24 May 2021, Vadim Zhukov wrote:

> вс, 23 мая 2021 г. в 17:43, Paco Esteban <p...@e1e0.net>:
> >
> > Hi ports@,
> >
> > This makes portcheck(1) not complain about modules.inc being an extra
> > file.  This file is now being included on some Go ports, and I guess it
> > can be used also on Rust ports.
> >
> > I was wondering if we should perform any other tests on this files, as
> > we do for Makefiles with the check_makefile function.  For now I only
> > included the basic test that modules.inc is actually a file.
> >
> > suggestions ? ok to commit ?
> 
> You definitely want to have '((++non_portmk))' line here as well.

Added

> Maybe it'll be good to check if '.include "./modules.inc"' line was
> not forgotten or mangled in port Makefile. Or maybe it isn't worth it.
> I can't say since I do not touch Go/Rust ports.

Yeah, that makes sense.  Added too.

> Also, we could count the number of MODGO_MODULES and MODCARGO_CRATES a
> bit later, during 'make show=...' analysis, and suggest creation of
> modules.inc when those numbers get too high. But what threshold should
> be? 10? 16? 42?

I'm not sure this is useful.  I would say we go the modules.inc route
for every Go or Rust port.  Even if they have a small number of modules
or crates is quite convenient to be able to redirect the output of
modcargo-gen-crates or modgo-gen-modules to override modules.inc without
worrying about substitute the old instances of the variables when
updating.  But I would not make it mandatory.

Anyway, here's the new version of the diff:

diff efc26b0628a018a694a05768ccbc773a0ed2e5ad /usr/ports
blob - bb8568b21b82fed260785c869a3cecfc4d4816cb
file + infrastructure/bin/portcheck
--- infrastructure/bin/portcheck
+++ infrastructure/bin/portcheck
@@ -612,6 +612,13 @@ check_port_dir() {
                        portmk_exists=true
                        ;;
 
+               modules.inc)
+                       test -f "$F" || err "$F is not a file"
+                       egrep -q '\.include "\./modules\.inc"' "$dir"/Makefile 
||
+                               err "$F not included in Makefile"
+                       ((++non_portmk))
+                       ;;
+
                files|patches)
                        if [[ -d $F ]]; then
                                check_${F##*/}_dir "$F"

-- 
Paco Esteban.
0x5818130B8A6DBC03

Reply via email to