ports/54174: clean spaces behind variables out of port Makefiles

Oliver Lehmann oliver at FreeBSD.org
Mon Jul 7 11:00:33 UTC 2003


>Number:         54174
>Category:       ports
>Synopsis:       clean spaces behind variables out of port Makefiles
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jul 07 04:00:27 PDT 2003
>Closed-Date:
>Last-Modified:
>Originator:     Oliver Lehmann
>Release:        FreeBSD 4.8-STABLE i386
>Organization:
>Environment:
System: FreeBSD kartoffel.salatschuessel.net 4.8-STABLE FreeBSD 4.8-STABLE #0: Tue Jun 24 07:22:19 CEST 2003 olivleh1 at kartoffel.salatschuessel.net:/usr/obj/i386-4.8/usr/src/sys/KARTOFFEL i386


>Description:
	There are some ports where the Makefile contains at least
	one line similar to the following lines:
MAN1 =	something.1
MAN1=     something.1
MAN1= 	something
MAN1=  	something
	Regarding to portlint and porters-handbook, each of those 
	constructs are "wrong" (bacause there are spaces between
	or in front of = and the assignment). Find the script
	which tries to repair this attached.

>How-To-Repeat:
>Fix:


--- clean.sh begins here ---
#!/bin/sh

ERROR() {
	echo $1
	exit $2
}

for file in `find ./ports/ -name Makefile` ; do
	awk '  	{
			a=gensub(/(^[A-Z_+\?0-9]+)[ ]+(=[ \t]+)/,"\\1\\2","g")
		}
		a~/^[A-Z_+\?0-9]+=[ ]+/ {
			gsub(/        /,"\t",a)
		} 
		a~/^[A-Z_+\?0-9]+=[ ]+[\t]+/ || a~/^[A-Z_+\?0-9]+=[\t]+[ ]+/ {
			if(length($1) < 8 ) {
				sub(/[ ]+/,"\t",a)
			} else {
				sub(/[ ]+/,"",a)
			}
		}
		a~/^[A-Z_+\?0-9]+=[ ]+/ {
			sub(/[ ]+/,"\t",a)
		}
		{
			print a
		}' $file > $file.$$ || ERROR "error on processing $file with awk" 1
	mv $file.$$ $file || ERROR "error moving $file.$$ to $file" 2
done
--- clean.sh ends here ---


>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list