pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/mk/flavor/pkg Allow make replace to replace a package ...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/ca0ca75028e9
branches:  trunk
changeset: 535083:ca0ca75028e9
user:      gdt <gdt%pkgsrc.org@localhost>
date:      Wed Nov 07 13:50:09 2007 +0000

description:
Allow make replace to replace a package with a name other than the new
one, via "make replace OLDNAME=oldpkgname".

Enhance replace-names to use OLDNAME if present.  Move replace-names
target before replace-tarup, and change replace-tarup to use the
computed oldname. Make deinstall respect OLDNAME.

Tested on netbsd-current with standard make replace and with OLDNAME.

diffstat:

 mk/flavor/pkg/deinstall.mk |   8 ++++++--
 mk/flavor/pkg/replace.mk   |  23 +++++++++++++++--------
 2 files changed, 21 insertions(+), 10 deletions(-)

diffs (79 lines):

diff -r 10e52db78753 -r ca0ca75028e9 mk/flavor/pkg/deinstall.mk
--- a/mk/flavor/pkg/deinstall.mk        Wed Nov 07 12:43:21 2007 +0000
+++ b/mk/flavor/pkg/deinstall.mk        Wed Nov 07 13:50:09 2007 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: deinstall.mk,v 1.3 2007/03/09 00:39:55 rillig Exp $
+# $NetBSD: deinstall.mk,v 1.4 2007/11/07 13:50:09 gdt Exp $
 
 # Set the appropriate flags to pass to pkg_delete(1) based on the value
 # of DEINSTALLDEPENDS (see pkgsrc/mk/install/deinstall.mk).
@@ -31,7 +31,11 @@
 #
 _flavor-deinstall:
        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
-       found="`${PKG_INFO} -e \"${PKGNAME}\" || ${TRUE}`";             \
+       if [ x"$OLDNAME" = x ]; then                                    \
+               found="`${PKG_INFO} -e \"${PKGNAME}\" || ${TRUE}`";     \
+       else                                                            \
+               found=${OLDNAME};                                       \
+       fi;                                                             \
        case "$$found" in                                               \
        "") found="`${_PKG_BEST_EXISTS} ${PKGWILDCARD:Q} || ${TRUE}`" ;; \
        esac;                                                           \
diff -r 10e52db78753 -r ca0ca75028e9 mk/flavor/pkg/replace.mk
--- a/mk/flavor/pkg/replace.mk  Wed Nov 07 12:43:21 2007 +0000
+++ b/mk/flavor/pkg/replace.mk  Wed Nov 07 13:50:09 2007 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: replace.mk,v 1.20 2007/09/22 15:19:47 gdt Exp $
+# $NetBSD: replace.mk,v 1.21 2007/11/07 13:50:09 gdt Exp $
 #
 
 # _flavor-replace:
@@ -13,8 +13,8 @@
 # can be confused when a +REQUIRED_BY files suddenly disappears.
 #
 _flavor-replace: \
+       replace-names \
        replace-tarup \
-       replace-names \
        replace-preserve-installed-info \
        replace-preserve-required-by \
        deinstall \
@@ -76,9 +76,10 @@
 replace-tarup: .PHONY
        ${RUN} [ -x ${_PKG_TARUP_CMD:Q} ] \
        || ${FAIL_MSG} ${_PKG_TARUP_CMD:Q}" was not found.";
+       ${_REPLACE_OLDNAME_CMD};                                        \
        ${SETENV} PKG_DBDIR=${_PKG_DBDIR} PKG_SUFX=${PKG_SUFX}          \
                PKGREPOSITORY=${WRKDIR}                                 \
-               ${_PKG_TARUP_CMD} ${PKGBASE}
+               ${_PKG_TARUP_CMD} $${oldname}
 
 ######################################################################
 ### undo-replace-install (PRIVATE)
@@ -93,14 +94,20 @@
        ${PKG_ADD} ${WRKDIR}/$${oldname}${PKG_SUFX}
 
 ######################################################################
-### replace-names, undo-replace-names (PRIVATE)
+### replace-names (PRIVATE)
 ######################################################################
-### replace-names and undo-replace-names save the correct names of the
-### installed and replacement packages into files queried by other
-### targets.
+
+### replace-names computes and saves the full names of the installed
+### package to be replaced (oldname) and the package that will be
+### installed (newname) into files for later use.
 ###
 replace-names: .PHONY
-       ${RUN} ${_PKG_BEST_EXISTS} ${PKGWILDCARD:Q} > ${_REPLACE_OLDNAME_FILE}
+       ${RUN} if [ x"${OLDNAME}" = x ]; then                           \
+               wildcard=${PKGWILDCARD:Q};                              \
+       else                                                            \
+               wildcard="${OLDNAME}-[0-9]*";                           \
+       fi;                                                             \
+       ${_PKG_BEST_EXISTS} "$${wildcard}" > ${_REPLACE_OLDNAME_FILE}
        ${RUN} ${ECHO} ${PKGNAME} > ${_REPLACE_NEWNAME_FILE}
        ${RUN} ${CP} -f ${_REPLACE_NEWNAME_FILE} ${_COOKIE.replace}
 



Home | Main Index | Thread Index | Old Index