Date: Sun, 26 Aug 2001 13:17:27 +0200 (CEST) From: Jens Schweikhardt <schweikh@schweikhardt.net> To: FreeBSD-gnats-submit@freebsd.org Subject: ports/30099: [PATCH] Useless use of cat in /usr/ports/Makefile Message-ID: <200108261117.f7QBHRK05259@hal9000.schweikhardt.net>
next in thread | raw e-mail | index | archive | help
>Number: 30099 >Category: ports >Synopsis: [PATCH] Useless use of cat in /usr/ports/Makefile >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sun Aug 26 04:30:00 PDT 2001 >Closed-Date: >Last-Modified: >Originator: Jens Schweikhardt >Release: FreeBSD 5.0-CURRENT i386 >Organization: Digital Details >Environment: System: FreeBSD hal9000.schweikhardt.net 5.0-CURRENT FreeBSD 5.0-CURRENT #0: Mon Aug 6 23:23:45 CEST 2001 toor@hal9000.schweikhardt.net:/usr/obj/usr/src/sys/HAL9000 i386 >Description: /usr/ports/Makefile has a target, parallel: ${.CURDIR}/INDEX, which invokes @cat ${.CURDIR}/INDEX | awk -F '|' 'lots of commands' The cat is useless (and makes everyone on comp.unix.shell chuckle and suspect yet another shell newbie :-). Save a process today and make it @awk -F '|' 'lots of commands' < ${.CURDIR}/INDEX or if you prefer the filename at the beginning you can use @${.CURDIR}/INDEX < awk -F '|' 'lots of commands' because redirection can appear anywhere on a line, even between the options. Yup, shell grammar has been like this ever since. This is good to confuse the heck out of everybody else - nobody will ever touch your Makefile again... Help promote reasonable shell programming. >How-To-Repeat: N/A >Fix: Index: Makefile =================================================================== RCS file: /home/ncvs/ports/Makefile,v retrieving revision 1.64 diff -u -r1.64 Makefile --- Makefile 2001/04/22 16:47:52 1.64 +++ Makefile 2001/08/26 11:10:39 @@ -84,7 +84,7 @@ .for dir in ${SUBDIR} @echo "all: ${dir}-all" .endfor - @cat ${.CURDIR}/INDEX | awk -F '|' '{me=$$1; here=$$2; bdep=$$8; rdep=$$9; split(here, tmp, "/"); if (bdep != "") { gsub("$$", ".tgz", bdep); gsub(" ", ".tgz ", bdep); } if (rdep != "") { gsub("$$", ".tgz", rdep); gsub(" ", ".tgz ", rdep); } print tmp[4] "-all: " me ".tgz"; print me ": " me ".tgz"; print me ".tgz: " bdep " " rdep; printf("\t@/var/portbuild/scripts/pdispatch ${branch} /var/portbuild/scripts/portbuild %s.tgz %s", me, here); if (bdep != "") printf(" %s", bdep); if (rdep != "") printf(" %s", rdep); printf("\n")}' + @awk -F '|' '{me=$$1; here=$$2; bdep=$$8; rdep=$$9; split(here, tmp, "/"); if (bdep != "") { gsub("$$", ".tgz", bdep); gsub(" ", ".tgz ", bdep); } if (rdep != "") { gsub("$$", ".tgz", rdep); gsub(" ", ".tgz ", rdep); } print tmp[4] "-all: " me ".tgz"; print me ": " me ".tgz"; print me ".tgz: " bdep " " rdep; printf("\t@/var/portbuild/scripts/pdispatch ${branch} /var/portbuild/scripts/portbuild %s.tgz %s", me, here); if (bdep != "") printf(" %s", bdep); if (rdep != "") printf(" %s", rdep); printf("\n")}' < ${.CURDIR}/INDEX CVS?= cvs .if defined(SUPHOST) >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ports" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200108261117.f7QBHRK05259>