Subject: pkg/13661: bsd.pkg.mk's fake-pkg target BUILD_VERSION_FILE generation fix
To: None <gnats-bugs@gnats.netbsd.org>
From: Stoned Elipot <Stoned.Elipot@script.jussieu.fr>
List: netbsd-bugs
Date: 08/09/2001 01:57:44
>Number: 13661
>Category: pkg
>Synopsis: bsd.pkg.mk's fake-pkg target can leave full pathnames in +BUILD_VERSION
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: pkg-manager
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Aug 08 16:54:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator: Stoned Elipot
>Release: pkgsrc-current
>Organization:
SCRIPT, Paris VII University, France
>Environment:
System: NetBSD bandsept 1.5.1 NetBSD 1.5.1 (GENERIC) #0: Mon Jul 9 22:42:32 CST 2001 toor@proxima:/usr/src/sys/arch/sparc/compile/GENERIC sparc
>Description:
bsd.pkg.mk's fake-target strips leading ${PKGSRCDIR} from the pathnames included
in grep's output in BUILD_VERSION_FILE. But the prefix of these pathnames can
be different from PKGSRCDIR. If one set PKGSRCDIR in /etc/mk.conf - you should
do this if pkgsrc pathname is non-standard and you want to use pkg_chk - and
the value is a symlink or an automounter is involved in the path then
make's .CURDIR prefix can be different - in fact most of the time it is - of
PKGSRCDIR while running in a pkg directory. Unfortunately .CURDIR is what
gets "used" while generating the file list to grep ($files) in order to
generate the BUILD_VERSION_FILE. Hence The +BUILD_VERSION file ends up
with full pathnames which is not desirable IMHO.
>How-To-Repeat:
Make a symlink to your pkgsrc, sets PKGSRCDIR in /etc/mk.conf to the pathname
of the symlink, build and install a package "from the symlink path": the
generated/installed $PKG_DBDIR/$PKGNAME/+BUILD_VERSION file contains
full pathnames.
>Fix:
The following patch try to address this issue: sed "search" for
PKGPATH in the pathnames thrown in BUILD_VERSION_FILE to strip what is before
it.
Index: bsd.pkg.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/bsd.pkg.mk,v
retrieving revision 1.796
diff -u -r1.796 bsd.pkg.mk
--- bsd.pkg.mk 2001/08/08 07:24:57 1.796
+++ bsd.pkg.mk 2001/08/08 22:51:57
@@ -3221,7 +3221,7 @@
esac; \
done; \
fi; \
- ${GREP} '\$$NetBSD' $$files | ${SED} -e 's|^${PKGSRCDIR}/||' > ${BUILD_VERSION_FILE};
+ ${GREP} '\$$NetBSD' $$files | ${SED} -e 's|^.*/\(${PKGPATH}/.*\)|\1|' > ${BUILD_VERSION_FILE};
. for def in ${BUILD_DEFS}
@${ECHO} ${def}= ${${def}:Q} | ${SED} -e 's|^PATH=[^ ]*|PATH=...|' >> ${BUILD_INFO_FILE}
. endfor
>Release-Note:
>Audit-Trail:
>Unformatted: