tech-pkg archive

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

Basic replace support for DESTDIR



Hi all,
whoever cares enough about undo should finish the attached patch.
E.g. tarup the package before replace and run pkg_add -u with it for
undo. As Alistair objects the patch without that and I don't care enough
to waste more time on it, it won't get committed.

Joerg
Index: flavor/pkg/replace.mk
===================================================================
RCS file: /data/repo/netbsd/pkgsrc/mk/flavor/pkg/replace.mk,v
retrieving revision 1.23
diff -u -p -r1.23 replace.mk
--- flavor/pkg/replace.mk       2 Dec 2007 11:29:22 -0000       1.23
+++ flavor/pkg/replace.mk       16 Jan 2008 01:04:42 -0000
@@ -171,3 +171,23 @@ replace-clean: .PHONY
        ${RM} -f ${WRKDIR}/$$newname${PKG_SUFX};                        \
        ${RM} -f ${_REPLACE_OLDNAME_FILE} ${_REPLACE_NEWNAME_FILE}      \
                ${_COOKIE.replace}
+
+# Updates installed package using newly build.
+#
+.if !empty(USE_CROSS_COMPILE:M[yY][eE][sS])
+package-replace: su-package-replace
+.else
+package-replace: su-target
+.endif
+
+su-package-replace:
+       @${PHASE_MSG} "Updating using binary package of "${PKGNAME:Q}
+.if !empty(USE_CROSS_COMPILE:M[yY][eE][sS])
+       @${MKDIR} ${_CROSS_DESTDIR}${PREFIX}
+       ${PKG_ADD} -u -m ${MACHINE_ARCH} -I -p ${_CROSS_DESTDIR}${PREFIX} 
${PKGFILE}
+       @${ECHO} "Fixing recorded cwd..."
+       @${SED} -e 's|@cwd ${_CROSS_DESTDIR}|@cwd |' 
${_PKG_DBDIR}/${PKGNAME:Q}/+CONTENTS > ${_PKG_DBDIR}/${PKGNAME:Q}/+CONTENTS.tmp
+       @${MV} ${_PKG_DBDIR}/${PKGNAME:Q}/+CONTENTS.tmp 
${_PKG_DBDIR}/${PKGNAME:Q}/+CONTENTS
+.else
+       ${PKG_ADD} -u ${PKGFILE}
+.endif
Index: install/replace.mk
===================================================================
RCS file: /data/repo/netbsd/pkgsrc/mk/install/replace.mk,v
retrieving revision 1.10
diff -u -p -r1.10 replace.mk
--- install/replace.mk  9 Mar 2007 03:28:58 -0000       1.10
+++ install/replace.mk  16 Jan 2008 14:09:31 -0000
@@ -19,9 +19,15 @@
 # _flavor-undo-replace:
 #      Undoes a previous "make _flavor-replace".
 
+.if ${_USE_DESTDIR} == "no"
 _REPLACE_TARGETS+=     ${_PKGSRC_BUILD_TARGETS}
 _REPLACE_TARGETS+=     replace-message
 _REPLACE_TARGETS+=     unprivileged-install-hook
+.else
+_REPLACE_TARGETS+=     package
+_REPLACE_TARGETS+=     replace-message
+_REPLACE_TARGETS+=     package-replace
+.endif
 
 #
 # replace
@@ -29,7 +35,11 @@ _REPLACE_TARGETS+=   unprivileged-install-
 
 .PHONY: replace
 .if defined(_PKGSRC_BARRIER)
+.  if ${_USE_DESTDIR} == "no"
 replace: ${_REPLACE_TARGETS} su-target
+.  else
+replace: ${_REPLACE_TARGETS}
+.  endif
 .else
 replace: barrier
 .endif
Index: package/package.mk
===================================================================
RCS file: /data/repo/netbsd/pkgsrc/mk/package/package.mk,v
retrieving revision 1.19
diff -u -p -r1.19 package.mk
--- package/package.mk  8 Mar 2007 23:33:35 -0000       1.19
+++ package/package.mk  16 Jan 2008 01:07:31 -0000
@@ -13,7 +13,7 @@
 #
 
 _PACKAGE_TARGETS+=     check-vulnerable
-.if make(replace)
+.if make(replace) && ${_USE_DESTDIR} == "no"
 _PACKAGE_TARGETS+=     replace
 .else
 _PACKAGE_TARGETS+=     install


Home | Main Index | Thread Index | Old Index