NetBSD Problem Report #42789

From kre@munnari.OZ.AU  Thu Feb 11 10:45:26 2010
Return-Path: <kre@munnari.OZ.AU>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by www.NetBSD.org (Postfix) with ESMTP id 6E04863B896
	for <gnats-bugs@gnats.NetBSD.org>; Thu, 11 Feb 2010 10:45:26 +0000 (UTC)
Message-Id: <201002111045.o1BAjKsN017056@jade.coe.psu.ac.th>
Date: Thu, 11 Feb 2010 17:45:20 +0700 (ICT)
From: kre@munnari.OZ.AU
To: gnats-bugs@gnats.NetBSD.org
Subject: pkgtools/pkg_comp update to handle removal of stanalone-install from pkgtools/libkver
X-Send-Pr-Version: 3.95

>Number:         42789
>Category:       pkg
>Synopsis:       pkgtools/pkg_comp update to handle removal of stanalone-install from pkgtools/libkver
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    pkg-manager
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Thu Feb 11 10:50:00 +0000 2010
>Originator:     Robert Elz
>Release:        NetBSD *.*   pkgsrc current as of 2010-02-11
>Organization:
	Prince of Songkla University
>Environment:
System: NetBSD jade.coe.psu.ac.th 5.0.2 NetBSD 5.0.2 (JADE-$Revision: 1.12 $) #15: Thu Feb 11 12:42:36 ICT 2010 kre@jade.coe.psu.ac.th:/usr/obj/5/kernels/JADE i386
Architecture: i386
Machine: i386
>Description:
	pkg_comp attempts to use the standalone-install target of
	pkgtools/libkver to install libkver outside /usr/pkg

	That target broke some time ago (see PR pkg/38651).

	A companion PR submitted at the same time as this one
	(within a second or so anyway) provides an update to
	pkgtools/libkver that (among other things) removes the
	broken standalone-install target (which was most probably
	a poor idea, right from day 1).

	This change in this PR is useful even if that one isn't applied,
	as we don't have to remove the standalone-install target to
	simply avoid using it - this patch does that, avoids using the
	standalone-install target in pkgtools/libkver.

	That is, half of this patch is useful, you'd want to delete the
	part that installs libkverdummy.so as /emul/linux/libkver/lib/libkver.so
	if libkver isn't updated to actually build libkverdummy.so
	(that's independent of whether or not the standalone-install
	target is removed from libkver).

	If the patch in the other PR is applied, then this one becomes
	close to mandatory.

	If this patch is applied (with or without the other one), the
	PR 38651 can close.

>How-To-Repeat:
        Try running pkg_comp with NETBSD_RELEASE defined to be something
        other than "no" in pkg_comp's config file.

	If anyone cares, I have lots more mods to pkg_comp that I
	could supply, some of which already exist in other PR's...

>Fix:
	This patch, applied in pkgtools/pkg_comp changes the way
	pkg_comp installs libkver - it now installs it normally,
	and then copies the files from where pkg_add (or make install)
	placed them (inside /usr/pkg) to where pkg_comp would prefer
	them to be.

Index: pkg_comp.sh
===================================================================
RCS file: /cvsroot/NetBSD/pkgsrc/pkgtools/pkg_comp/files/pkg_comp.sh,v
retrieving revision 1.35
diff -u -r1.35 pkg_comp.sh
--- pkg_comp.sh	13 May 2009 10:40:24 -0000	1.35
+++ pkg_comp.sh	11 Feb 2010 09:56:34 -0000
@@ -624,11 +624,32 @@
     local prefix script statfile

     if [ "$NETBSD_RELEASE" != "no" ]; then
-        _BUILD_TARGET="$BUILD_TARGET"
-        BUILD_TARGET="standalone-install"
-        pkg_build pkgtools/libkver
-        BUILD_TARGET="$_BUILD_TARGET"
-        echo "LD_PRELOAD=${LIBKVER_STANDALONE_PREFIX}/lib/libkver.so; export LD_PRELOAD" >> $DESTDIR/etc/shrc
+        pkg_build pkgtools/libkver || {
+		warn "PKG_COMP *** pkgtools/libkver build failed"
+		return
+	}
+	(
+		echo "PKG_COMP ==> Copying libkver from ${LOCALBASE}/lib to ${LIBKVER_STANDALONE_PREFIX}/lib"
+		cd "${DESTDIR}${LOCALBASE}/lib" || exit 1
+		mkdir -p "${DESTDIR}${LIBKVER_STANDALONE_PREFIX}/lib" || exit 1
+		pax -rw -pe libkver.so libkver.so.*.* \
+		    "${DESTDIR}${LIBKVER_STANDALONE_PREFIX}/lib/." || {
+			warn "PKG_COMP *** Unable to install standalone libkver"
+			exit 1
+		}
+		mkdir -p
+		    "${DESTDIR}/emul/linux/${LIBKVER_STANDALONE_PREFIX}/lib" ||
+			exit 1
+		pax -rw -pe -s '/dummy//' libkverdummy.so libkverdummy.so.*.* \
+		 "${DESTDIR}/emul/linux/${LIBKVER_STANDALONE_PREFIX}/lib/." || {
+			warn "PKG_COMP *** Unable to install dummy libkver for linux emulation"
+			exit 1
+		}
+		exit 0
+	) || return
+	echo 'if [ -f "'"${LIBKVER_STANDALONE_PREFIX}/lib/libkver.so"'" ]; then' >> $DESTDIR/etc/shrc
+        echo "	LD_PRELOAD=${LIBKVER_STANDALONE_PREFIX}/lib/libkver.so; export LD_PRELOAD" >> $DESTDIR/etc/shrc
+	echo 'fi' >> $DESTDIR/etc/shrc
         echo "setenv LD_PRELOAD ${LIBKVER_STANDALONE_PREFIX}/lib/libkver.so" >> $DESTDIR/etc/csh.login
         echo "setenv LD_PRELOAD ${LIBKVER_STANDALONE_PREFIX}/lib/libkver.so" >> $DESTDIR/etc/csh.cshrc
         ln -s "$NETBSD_RELEASE" $DESTDIR/libkver_osrelease

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.