On Fri, Aug 13, 2021 at 10:35:13AM +0200, Sebastien Marie wrote:
> On Thu, Aug 12, 2021 at 04:48:13PM +0200, Theo Buehler wrote:
> > Now that a few Rust ports use crates.inc, I think we should teach
> > portcheck about it. I didn't use @(|) for the pattern since the result
> > seemed less readable.
> > 
> > Two things:
> > 
> > A few Rust ports use '.include <crates.inc>' I'll switch those to using
> > '.include "crates.inc"' so the current directory is searched first.
> 
> I agree that "x" is better than <x>.
> 
> > For some reason, it was decided to do '.include "./modules.inc"' for Go
> > ports. I doubt there is actually a benefit in adding ./ here, but I may
> > be wrong. If there is none, I think we should leave it out since it's
> > just noise.
> 
> Re-reading make(1) man page about .include :
> 
>     If double quotes are used, the including makefile's directory and
>     any directories specified using the -I option are searched before
>     the system makefile directory.

Thanks. This explains why "x" is btter than <x>. I was unsure whether
make(1) has some magic for paths starting with ./, but I can't find any.

> From openbsd source trees (excepting modules.inc or crates.inc), "./x"
> is never used. Only "${.CURDIR}/x" could be seen, but it should only
> makes sense with obj/ usage (and so not with ports).

Agreed.

> 
> > Regardless of whether ./ is included or not, I think Go and
> > Rust ports should use the same idiom. I kept the ./ in the check for
> > now.
> 
> I agree with the fact to have the same idiom.

So I suggest that we go with the diff below that removes requiring ./
unless someone explains why it should be kept. I'll then strip the
./ from the Go ports and switch from <x> to "x" in a few Rust ports.

Index: portcheck
===================================================================
RCS file: /cvs/ports/infrastructure/bin/portcheck,v
retrieving revision 1.138
diff -u -p -r1.138 portcheck
--- portcheck   2 Jun 2021 13:07:23 -0000       1.138
+++ portcheck   13 Aug 2021 16:08:26 -0000
@@ -612,9 +612,9 @@ check_port_dir() {
                        portmk_exists=true
                        ;;
 
-               modules.inc)
+               crates.inc|modules.inc)
                        test -f "$F" || err "$F is not a file"
-                       fgrep -qx '.include "./modules.inc"' "$dir"/Makefile ||
+                       fgrep -qx ".include \"$F\"" "$dir"/Makefile ||
                                err "$F not included in Makefile"
                        ((++non_portmk))
                        ;;


Reply via email to