pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/pkgtools/pkg_install Remove @exec from PLIST and put t...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/c36e7399c1e5
branches:  trunk
changeset: 502572:c36e7399c1e5
user:      jlam <jlam%pkgsrc.org@localhost>
date:      Sun Nov 06 22:15:44 2005 +0000

description:
Remove @exec from PLIST and put the action into an INSTALL script instead.
Also, simplify the package by making use of the PKGMANDIR-handling in
pkgsrc to remove the custom MANDIR code from the package Makefile and
the PLIST.

Technically, this type of a change would require a PKGREVISION bump,
but as this is the pkg_* tools package and there were no changes to the
binaries, we refrain from doing so.

diffstat:

 pkgtools/pkg_install/INSTALL  |  19 ++++++++++++++
 pkgtools/pkg_install/Makefile |  55 ++++++++++++++++++++++++------------------
 pkgtools/pkg_install/PLIST    |  31 +++++++++++------------
 3 files changed, 65 insertions(+), 40 deletions(-)

diffs (168 lines):

diff -r 41f7b264de1c -r c36e7399c1e5 pkgtools/pkg_install/INSTALL
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/pkgtools/pkg_install/INSTALL      Sun Nov 06 22:15:44 2005 +0000
@@ -0,0 +1,19 @@
+#!/bin/sh
+#
+# $NetBSD: INSTALL,v 1.1 2005/11/06 22:15:44 jlam Exp $
+
+PKGNAME="$1"
+STAGE="$2"
+
+PKG_DBDIR="@PKG_DBDIR@"
+MKDIR="@MKDIR@"
+
+case ${STAGE} in
+PRE-INSTALL)
+       [ -d ${PKG_DBDIR} ] || ${MKDIR} ${PKG_DBDIR}
+       ;;
+
+POST-INSTALL)
+       [ -f ${PKG_DBDIR}/pkgdb.byfile.db ] || ${PKG_PREFIX}/bin/pkg_admin rebuild
+       ;;
+esac
diff -r 41f7b264de1c -r c36e7399c1e5 pkgtools/pkg_install/Makefile
--- a/pkgtools/pkg_install/Makefile     Sun Nov 06 22:15:02 2005 +0000
+++ b/pkgtools/pkg_install/Makefile     Sun Nov 06 22:15:44 2005 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.116 2005/10/07 18:05:07 reed Exp $
+# $NetBSD: Makefile,v 1.117 2005/11/06 22:15:44 jlam Exp $
 
 # Notes to package maintainers:
 #
@@ -33,6 +33,7 @@
 NO_CHECKSUM=           yes
 NO_MTREE=              yes
 PKG_PRESERVE=          # defined
+INSTALL_FILE=          ${PKG_DB_TMPDIR}/+INSTALL
 
 # These are needed to solve a chicken-and-egg problem where pkgsrc uses
 # newer features of pkg_install, but older NetBSD installations won't
@@ -40,15 +41,13 @@
 # compiler to avoid problems with depending on pkgsrc GCC for building
 # pkg_install.  We also avoid building digest as that would involve
 # using the newer pkg_install tools.
-# We also use the newly built pkg_delete since upgrading from
-# an older pkg_install might required features of the new program.
+#
+# We also use the newly built pkg_delete since upgrading from an older
+# pkg_install might required features of the new program.
 #
 USE_NATIVE_GCC=                yes
 USE_DIGEST=            no
-PKG_DELETE=    ${WRKSRC}/delete/pkg_delete
-
-PLIST_SUBST+=          MANDIR=${MANDIR}
-PLIST_SUBST+=          PKG_TOOLS_BIN=${PKG_TOOLS_BIN}
+PKG_DELETE=            ${WRKSRC}/delete/pkg_delete
 
 CPPFLAGS+=             -DDEF_UMASK=${DEF_UMASK}
 
@@ -59,21 +58,37 @@
 PKG_INFO=              PKG_DBDIR=${PKG_DBDIR} ${PKG_INFO_CMD}
 PKG_ADMIN=             PKG_DBDIR=${PKG_DBDIR} ${PKG_ADMIN_CMD}
 
+PLIST_SUBST+=          PKG_DBDIR=${PKG_DBDIR}
+
 .include "../../mk/bsd.prefs.mk"
 
+PKG_TOOLS_PREFIX=      ${PKG_TOOLS_BIN:C|/[^/]?bin$||}
 VERSION!=              ${AWK} -F '"' '/PKGTOOLS_VERSION/ {print $$2}' \
                        ${FILESDIR}/lib/version.h
 
+# XXX This breaks for those who set their own LOCALBASE to "/usr" and also
+# XXX set PKGMANDIR to be other than "share/man".
+# XXX
+.if !empty(PKG_TOOLS_PREFIX:M/usr)
+PKGMANDIR=             share/man
+.endif
+
 do-extract:
        @${CP} -R ${FILESDIR} ${WRKSRC}
 
-post-install:
-       if [ ! -f ${PKG_DBDIR}/pkgdb.byfile.db ]; then                  \
-               if [ ! -d ${PKG_DBDIR} ]; then                          \
-                       ${INSTALL_DATA_DIR} ${PKG_DBDIR};               \
-               fi;                                                     \
-               ${PKG_ADMIN} rebuild;                                   \
-       fi
+post-build:
+       ${SED}  -e "s|@PKG_DBDIR@|${PKG_DBDIR}|g"                       \
+               -e "s|@MKDIR@|${MKDIR}|g"                               \
+               ${PKGDIR}/INSTALL > ${INSTALL_FILE}
+       ${CHMOD} +x ${INSTALL_FILE}
+
+pre-install-script:
+       cd ${PKG_DB_TMPDIR} && ${SETENV} ${INSTALL_SCRIPTS_ENV}         \
+               ${INSTALL_FILE} ${PKGNAME} PRE-INSTALL
+
+post-install-script:
+       cd ${PKG_DB_TMPDIR} && ${SETENV} ${INSTALL_SCRIPTS_ENV}         \
+               ${INSTALL_FILE} ${PKGNAME} POST-INSTALL
 
 # XXX Reverse the order that update does things since
 # XXX we need pkg_delete built before we can deinstall.
@@ -81,18 +96,10 @@
 update:
        ${MAKE}
        ${MAKE} deinstall UPDATE_RUNNING=YES
-       ${MAKE} install
+       ${MAKE} update
        ${MAKE} clean
 
 .include "../../pkgtools/libnbcompat/inplace.mk"
 .include "../../mk/bsd.pkg.mk"
 
-PREFIX:=               ${PKG_TOOLS_BIN:C|/[^/]?bin$||}
-.if ${PREFIX} == "/usr"
-# XXX This breaks for those who set their own LOCALBASE to /usr
-# XXX and also define PKGMANDIR to different than share/man.
-CONFIGURE_ARGS+=       --mandir=${PREFIX}/share/man
-MANDIR=                        share/
-.else
-MANDIR=                        # empty
-.endif
+PREFIX:=       ${PKG_TOOLS_PREFIX}
diff -r 41f7b264de1c -r c36e7399c1e5 pkgtools/pkg_install/PLIST
--- a/pkgtools/pkg_install/PLIST        Sun Nov 06 22:15:02 2005 +0000
+++ b/pkgtools/pkg_install/PLIST        Sun Nov 06 22:15:44 2005 +0000
@@ -1,4 +1,4 @@
-@comment $NetBSD: PLIST,v 1.5 2003/10/11 07:29:29 grant Exp $
+@comment $NetBSD: PLIST,v 1.6 2005/11/06 22:15:44 jlam Exp $
 sbin/linkfarm
 sbin/pkg_add
 sbin/pkg_admin
@@ -6,18 +6,17 @@
 sbin/pkg_delete
 sbin/pkg_info
 sbin/pkg_view
-${MANDIR}man/cat1/linkfarm.0
-${MANDIR}man/cat1/pkg_add.0
-${MANDIR}man/cat1/pkg_admin.0
-${MANDIR}man/cat1/pkg_create.0
-${MANDIR}man/cat1/pkg_delete.0
-${MANDIR}man/cat1/pkg_info.0
-${MANDIR}man/cat1/pkg_view.0
-${MANDIR}man/man1/linkfarm.1
-${MANDIR}man/man1/pkg_add.1
-${MANDIR}man/man1/pkg_admin.1
-${MANDIR}man/man1/pkg_create.1
-${MANDIR}man/man1/pkg_delete.1
-${MANDIR}man/man1/pkg_info.1
-${MANDIR}man/man1/pkg_view.1
-@exec [ -f ${PKG_DBDIR:-/var/db/pkg}/pkgdb.byfile.db ] || ${PKG_TOOLS_BIN}/pkg_admin rebuild
+man/cat1/linkfarm.0
+man/cat1/pkg_add.0
+man/cat1/pkg_admin.0
+man/cat1/pkg_create.0
+man/cat1/pkg_delete.0
+man/cat1/pkg_info.0
+man/cat1/pkg_view.0
+man/man1/linkfarm.1
+man/man1/pkg_add.1
+man/man1/pkg_admin.1
+man/man1/pkg_create.1
+man/man1/pkg_delete.1
+man/man1/pkg_info.1
+man/man1/pkg_view.1



Home | Main Index | Thread Index | Old Index