pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/mk/bulk Don't rely on the INDEXFILE having trailing wh...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/71461902f31d
branches:  trunk
changeset: 502871:71461902f31d
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Thu Nov 10 07:04:00 2005 +0000

description:
Don't rely on the INDEXFILE having trailing white-space in each line.
Whoever had written such unusual code should have left a note in the
printindex script that the trailing white-space was required. It is such
an uncommon assumption that I treated it as a typo and removed it. Now
it's fixed. I also replaced the use of grep|awk with a simple awk, as
grep would have interpreted regular expressions in the package name.

In general, please think more about _appropriate_ ways to handle data.
grep(1) is not a tool for searching strings. It's a tool for searching
regular expressions.

diffstat:

 mk/bulk/bsd.bulk-pkg.mk |  4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diffs (18 lines):

diff -r 29070bc76a43 -r 71461902f31d mk/bulk/bsd.bulk-pkg.mk
--- a/mk/bulk/bsd.bulk-pkg.mk   Thu Nov 10 06:32:38 2005 +0000
+++ b/mk/bulk/bsd.bulk-pkg.mk   Thu Nov 10 07:04:00 2005 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: bsd.bulk-pkg.mk,v 1.91 2005/11/07 18:22:22 tv Exp $
+#      $NetBSD: bsd.bulk-pkg.mk,v 1.92 2005/11/10 07:04:00 rillig Exp $
 
 #
 # Copyright (c) 1999, 2000 Hubert Feyrer <hubertf%NetBSD.org@localhost>
@@ -326,7 +326,7 @@
                        for pkgname in `${PKG_INFO} -e \*` ; \
                        do \
                                if [ "${USE_BULK_CACHE}" = "yes" ]; then \
-                                       pkgdir=`${GREP} " $$pkgname " ${INDEXFILE} | ${AWK} '{print $$1}'` ;\
+                                       pkgdir=`${AWK} '$$2 == "'"$$pkgname"'" {print $$1}' ${INDEXFILE}`; \
                                        if [ -z "$$pkgdir" ]; then \
                                            pkgdir=unknown ; \
                                        fi; \



Home | Main Index | Thread Index | Old Index