Date: Sun, 6 Jul 2003 19:43:22 -0600 (CST) From: Ryan Thompson <ryan@sasknow.com> To: Oliver Lehmann <oliver@freebsd.org> Cc: ports@freebsd.org Subject: Re: HEADS UP: fix Makefiles where portlint argues "FATAL [...] use a tab (not space) after a variable name" Message-ID: <20030706172233.Q21975-100000@ren.sasknow.com> In-Reply-To: <20030706150629.3b8fb9e4.oliver@FreeBSD.ORG>
next in thread | previous in thread | raw e-mail | index | archive | help
Oliver Lehmann wrote to ports@freebsd.org: > Hi, Hi Oliver, > I'm going to commit http://people.freebsd.org/~oliver/ports.diff (630kB). > I attached the Script which does the job. > > It will replace spaces after variable names in Makefiles with tabs or just > remove them if they are not needed (because there is allready a tab which > fits). Overall, the output looks correct in all the cases I looked at. However, you don't appear to be matching digits and modifiers with your regexp, so you'll miss variables like MAN1= and XARGS?=. Also, there are the modifiers like ?= and +=. I tried this two-stepper on a 4.7-RELEASE ports tree: $ rm Makefile.vars ; for dir in `ls`; do egrep -h \ '^[[:space:]]*[[:alnum:]_$][^[:space:]]+[:space:]*=' \ $dir/*/Makefile 2>/dev/null >> Makefile.vars ; done $ cut -d = -f 1 Makefile.vars | sort | uniq | \ egrep '[^_[:alnum:]]' > Makefile.vars.funny The above isn't meant to provide totally robust matching, but it should be very close, and, on my system, produces ~1700 lines of output. It should help you strengthen your search. Here's the output I collected: http://ry.ca/Makefile.vars.funny > Objections against it? No, but you made me think of something else that might be of interest. It would improve cosmetics if we could automatically format the column width to be as long as the longest variable in the block, with a reasonable upper bound. I'm thinking of cases like: +++ archivers/mscompress/Makefile 6 Jul 2003 12:38:24 -0000 @@ -9,7 +9,7 @@ PORTVERSION= 0.3 CATEGORIES= archivers MASTER_SITES= ${MASTER_SITE_SUNSITE} -MASTER_SITE_SUBDIR= utils/compress +MASTER_SITE_SUBDIR= utils/compress MAINTAINER= ports@FreeBSD.org COMMENT= Microsoft "compress.exe/expand.exe" compatible (de)compressor So, MASTER_SITE_SUBDIR= being the longest variable, expand other columns in the same block to align. Expected output for the above: PORTVERSION= 0.3 CATEGORIES= archivers MASTER_SITES= ${MASTER_SITE_SUNSITE} MASTER_SITE_SUBDIR= utils/compress MAINTAINER= ports@FreeBSD.org COMMENT= Microsoft "compress.exe/expand.exe" compatible (de)compressor More readable, IMO. One could do this Makefile-wide just as easily, but that could potentially generate a *huge* diff, and do little to improve readability. I'm just not sure if even the block-level approach be worth the CVS spam. I suppose if there was some interest (or at least morbid curiosity :-), I'd be willing to code this up and see how big the changes would be. And Oliver, I'd be willing to work with you to put our changes together to be done in a single pass. There are a bunch of things like this that could be fixed. Thoughts? - Ryan -- Ryan Thompson <ryan@sasknow.com> SaskNow Technologies - http://www.sasknow.com 901-1st Avenue North - Saskatoon, SK - S7K 1Y4 Tel: 306-664-3600 Fax: 306-244-7037 Saskatoon Toll-Free: 877-727-5669 (877-SASKNOW) North America
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030706172233.Q21975-100000>