Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 22 Oct 2001 07:13:47 +0900
From:      "Akinori MUSHA" <knu@iDaemons.org>
To:        portmgr@FreeBSD.org, ports@FreeBSD.org
Subject:   A patch to fix "make describe"
Message-ID:  <86ofn0od44.wl@archon.local.idaemons.org>

next in thread | raw e-mail | index | archive | help
I happened to find a bug in bsd.port.mk's "make describe" routine.

Because it is not quoted properly, shell wildcards are unexpectedly
expanded.  To confirm this, try doing "make describe" in
/usr/ports/games/tkmoo.  You can see the short description:

	"Tk-based M** client with scripting support" 

get turned into:

	"Tk-based Makefile client with scripting support"

Also, series of spaces are suppressed for the same reason.

Attached is the patch which fixes the problem and makes the code more
short and efficient in the Perl way.  I've confirmed that the INDEX
file made with the patched bsd.port.mk is identical to the one made
with the current bsd.port.mk except for what is described above.

Please evaluate it, and I'll commit it if it's okay.


Regards,

-- 
                     /
                    /__  __            Akinori.org / MUSHA.org
                   / )  )  ) )  /     FreeBSD.org / Ruby-lang.org
Akinori MUSHA aka / (_ /  ( (__(  @ iDaemons.org / and.or.jp

"Freeze this moment a little bit longer, make each impression
  a little bit stronger..  Experience slips away -- Time stand still"

Index: bsd.port.mk
===================================================================
RCS file: /home/ncvs/ports/Mk/bsd.port.mk,v
retrieving revision 1.383
diff -u -r1.383 bsd.port.mk
--- bsd.port.mk	9 Oct 2001 07:37:34 -0000	1.383
+++ bsd.port.mk	21 Oct 2001 20:44:38 -0000
@@ -2747,77 +2747,55 @@
 
 .if !target(describe)
 describe:
-	@${ECHO} `perl -e ' \
-		print "${PKGNAME}|${.CURDIR}|${PREFIX}|"; \
-		if (open (COMMENT, "${COMMENT}")) { \
+	@${ECHO} "`perl -e ' \
+		print q{${PKGNAME}|${.CURDIR}|${PREFIX}|}; \
+		if (open(COMMENT, q{${COMMENT}})) { \
 			$$_ = <COMMENT>; \
 			chomp; \
 			print; \
 		} else { \
-			print "** No Description"; \
+			print q{** No Description}; \
 		} \
-		if ( -f "${DESCR}" ) { \
-			print "|${DESCR}"; \
+		if ( -f q{${DESCR}} ) { \
+			print q{|${DESCR}}; \
 		} else { \
-			print "|/dev/null"; \
+			print q{|/dev/null}; \
 		} \
-		print q#|${MAINTAINER}|${CATEGORIES}|#; \
-		for (split /\s+/, "${FETCH_DEPENDS} ${BUILD_DEPENDS} ${LIB_DEPENDS}") { \
-			next if /^$$/; \
-			s/^[^:]*\://; \
-			s/\:.*//; \
-			if ( ! -d $$_ ) { \
-				print STDERR "${PKGNAME}: \"$$_\" non-existent -- dependency list incomplete"; \
-			} else { \
-				push @bdirs, $$_; \
+		print q{|${MAINTAINER}|${CATEGORIES}|}; \
+		@bdirs = map((split /:/)[1], split(q{ }, q{${FETCH_DEPENDS} ${BUILD_DEPENDS}})); \
+		@rdirs = map((split /:/)[1], split(q{ }, q{${RUN_DEPENDS}})); \
+		@mdirs = ( \
+			map((split /:/)[0], split(q{ }, q{${DEPENDS}})), \
+			map((split /:/)[1], split(q{ }, q{${LIB_DEPENDS}})) \
+		); \
+		for my $$i (\@bdirs, \@rdirs, \@mdirs) { \
+			my @dirs = @$$i; \
+			@$$i = (); \
+			for (@dirs) { \
+				if (-d $$_) { \
+					push @$$i, $$_; \
+				} else { \
+					print STDERR qq{${PKGNAME}: \"$$_\" non-existent -- dependency list incomplete\n}; \
+				} \
+			} \
+		} \
+		for (@bdirs, @mdirs) { \
+			$$x{$$_} = 1; \
+		} \
+		print join(q{ }, sort keys %x), q{|}; \
+		for (@rdirs, @mdirs) { \
+			$$y{$$_} = 1; \
+		} \
+		print join(q{ }, sort keys %y), q{|}; \
+		if (open(DESCR, q{${DESCR}})) { \
+			while (<DESCR>) { \
+				if (/^WWW:\s+(\S+)/) { \
+					print $$1; \
+					last; \
+				} \
 			} \
 		} \
-		for (split /\s+/, "${LIB_DEPENDS} ${RUN_DEPENDS}") { \
-			next if /^$$/; \
-			s/^[^:]*\://; \
-			s/\:.*//; \
-			if ( ! -d $$_ ) { \
-				print STDERR "${PKGNAME}: \"$$_\" non-existent -- dependency list incomplete"; \
-			} else { \
-				push @rdirs, $$_; \
-			} \
-		} \
-		for (split /\s+/, "${DEPENDS}") { \
-			next if /^$$/; \
-			s/\:.*//; \
-			if ( ! -d $$_ ) { \
-				print STDERR "${PKGNAME}: \"$$_\" non-existent -- dependency list incomplete"; \
-			} else { \
-				push @mdirs, $$_; \
-			} \
-		} \
-		for (sort (@bdirs, @mdirs)) { \
-			if ($$_ ne $$l) { \
-				$$a .= $$_ . " "; \
-				$$l = $$_; \
-			} \
-		} \
-		chop $$a; \
-		print "$$a|"; \
-		for (sort (@rdirs, @mdirs)) { \
-			if ($$_ ne $$m) { \
-				$$b .= $$_ . " "; \
-				$$m = $$_; \
-			} \
-		} \
-		chop $$b; \
-		print "$$b|"; \
-		if (open (DESCR, "${DESCR}")) { \
-			until (/^WWW\:\s/ or eof DESCR) { \
-				$$_ = <DESCR>; \
-			} \
-			if (/^WWW\:\s/) { \
-				chomp; \
-				split /\s+/; \
-				print $$_[1]; \
-			} \
-		} \
-		print "\n";'`
+		print qq{\n};'`"
 .endif
 
 www-site:

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?86ofn0od44.wl>