Subject: Re: bsd.pkg.mk
To: None <tech-pkg@NetBSD.ORG>
From: Frederick Bruckman <fb@enteract.com>
List: tech-pkg
Date: 07/24/2000 14:00:14
On Mon, 24 Jul 2000, Matthias Scheler wrote:

> revision 1.516
> date: 2000/07/23 18:42:48;  author: fredb;  state: Exp;  lines: +3 -3
> Add 'RESTRICTED' to ${BUILD_DEFS}, so that any restrictions are recorded
> in the binary package.
> 
> This causes strange effect on e.g. the "racoon" package:
> 
> ===> Compressing manual pages for racoon-20000719a
> RESTRICTED=     Crypto
> export-controlled: not found
> 
> Obviously isn't "RESTRICTED" escaped correct.

The problem is that "RESTRICTED" is _already_ escaped with
double-quotes in the package Makefile, leading to the following
(viewed with "make -n fake-pkg")...

echo "RESTRICTED=       "Crypto; export-controlled"" | ${SED}...


which exposes the semi-colon. It doesn't seem necessary to ever escape
"RESTRICTED" in the package Makefile, but it seems like a lot of work
to change all those, besides adding a non-intuitive requirement to pkgsrc
(namely, no quotes in anything in BUILD_DEFS).

Un-escaping the ${ECHO} for BUILD_DEFS in bsd.pkg.mk also seems to
work fine, here, but the general problem of arbritary characters in
the "RESTRICTED" string, or any of the BUILD_DEFS variables, remains.
Bracketing the args to ${ECHO} with a single-quote doesn't quite work,
either, because many of the restriced clauses contain single-quotes.

We can use "make" to strip the quotes before quoting (as below). I'm
concerned that this uses a feature of "make" that is not present on
older systems. It's OK for 1.4.3 and 1.5, though. Can anyone verify that
this works/doesn't work on 1.4.2? Opinions?



Frederick

Index: bsd.pkg.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/bsd.pkg.mk,v
retrieving revision 1.516
diff -c -r1.516 bsd.pkg.mk
*** bsd.pkg.mk	2000/07/23 18:42:48	1.516
--- bsd.pkg.mk	2000/07/24 18:56:12
***************
*** 2930,2936 ****
  	fi;								\
  	${GREP} '\$$NetBSD' $$files | ${SED} -e 's|^${PKGSRCDIR}/||' > ${BUILD_VERSION_FILE};
  .for def in ${BUILD_DEFS}
! 	@${ECHO} "${def}=	${${def}}" | ${SED} -e 's|PATH=[^ 	]*|PATH=...|' >> ${BUILD_INFO_FILE}
  .endfor
  	@${ECHO} "CC=	${CC}-`${CC} --version`" >> ${BUILD_INFO_FILE}
  .ifdef USE_PERL5
--- 2930,2936 ----
  	fi;								\
  	${GREP} '\$$NetBSD' $$files | ${SED} -e 's|^${PKGSRCDIR}/||' > ${BUILD_VERSION_FILE};
  .for def in ${BUILD_DEFS}
! 	@${ECHO} "${def}=	${${def}:S/"//g}" | ${SED} -e 's|PATH=[^ 	]*|PATH=...|' >> ${BUILD_INFO_FILE}
  .endfor
  	@${ECHO} "CC=	${CC}-`${CC} --version`" >> ${BUILD_INFO_FILE}
  .ifdef USE_PERL5