tech-pkg archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: Making DESTDIR support mandatory
On Thu, 21 Apr 2011 11:02:00 +0900, OBATA Akio <obache%netbsd.org@localhost>
wrote:
On Thu, 21 Apr 2011 09:35:19 +0900, David Holland
<dholland-pkgtech%netbsd.org@localhost> wrote:
On Mon, Apr 18, 2011 at 06:51:46PM +0900, OBATA Akio wrote:
> >2. undo-replace does not work with USE_DESTDIR, which is a significant
> >regression.
>
> It's easy to implement it.
> But I don't want to be tarup package into ${WRKDIR} each time on replace.
That's what we've always done; I don't think making unrelated other
changes is a good reason to alter that behavior.
I never use `replace' target with USE_DESTDIR=no, so nothing had been changed
for me.
But It's also easy to kill tarup in my local tree, like killing "set
upsafe_depends=YES",
so no objection to implement it.
For me, behavior chnages should be fixed with USE_DESTDIR=yes are:
1. `make replace OLDNAME=foo' will not work.
2. `make install' always create binary package in ${PACKAGES}.
2. may be required for other developers, when trying build and install
with various PKG_OPTION combination or something else.
but want to keep the binary package built with default situation.
Following patch is uncompleted, but with USE_DESTDIR=yes
1. `make undo-replace' will work
2. `make install' will not create binary package in ${PACAKGES},
but with `make package' or `make package-install'.
Index: flavor/pkg/package.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/flavor/pkg/package.mk,v
retrieving revision 1.21
diff -u -r1.21 package.mk
--- flavor/pkg/package.mk 19 Mar 2011 09:45:24 -0000 1.21
+++ flavor/pkg/package.mk 4 May 2011 09:16:17 -0000
@@ -12,7 +12,12 @@
.endif
PKG_SUFX?= .tgz
FILEBASE?= ${PKGBASE}
-PKGFILE?= ${PKGREPOSITORY}/${FILEBASE}-${PKGVERSION}${PKG_SUFX}
+REAL_PKGFILE?= ${PKGREPOSITORY}/${FILEBASE}-${PKGVERSION}${PKG_SUFX}
+.if ${_USE_DESTDIR} == "no"
+PKGFILE?= ${REAL_PKGFILE}
+.else
+PKGFILE?= ${WRKDIR}/${FILEBASE}-${PKGVERSION}.new${PKG_SUFX}
+.endif
PKGREPOSITORY?= ${PACKAGES}/${PKGREPOSITORYSUBDIR}
PKGREPOSITORYSUBDIR?= All
@@ -33,7 +38,13 @@
### package-create creates the binary package.
###
.PHONY: package-create
-package-create: package-remove ${PKGFILE} package-links
+.if ${_USE_DESTDIR} == "no"
+package-create: real-package-create
+.else
+package-create: ${PKGFILE}
+.endif
+.PHONY: real-package-create
+real-package-create: package-remove ${REAL_PKGFILE} package-links
_PKG_ARGS_PACKAGE+= ${_PKG_CREATE_ARGS}
_PKG_ARGS_PACKAGE+= -F ${PKG_COMPRESSION}
@@ -59,6 +70,12 @@
exitcode=$$?; ${RM} -f "$$tmpname"; exit $$exitcode; \
fi
+.if ${_USE_DESTDIR} != "no"
+${REAL_PKGFILE}: ${PKGFILE}
+ ${LN} ${PKGFILE} ${REAL_PKGFILE} 2>/dev/null || \
+ ${CP} -p ${PKGFILE} ${REAL_PKGFILE}
+.endif
+
######################################################################
### package-remove (PRIVATE)
######################################################################
@@ -67,7 +84,7 @@
###
.PHONY: package-remove
package-remove:
- ${RUN} ${RM} -f ${PKGFILE}
+ ${RUN} ${RM} -f ${REAL_PKGFILE}
######################################################################
### package-links (PRIVATE)
@@ -80,8 +97,8 @@
${RUN} ${MKDIR} ${_dir_:Q}
${RUN} [ -d ${_dir_:Q} ] \
|| ${FAIL_MSG} "Can't create directory "${_dir_:Q}"."
- ${RUN} ${RM} -f ${_dir_:Q}/${PKGFILE:T}
- ${RUN} ${LN} -s ../${PKGREPOSITORYSUBDIR}/${PKGFILE:T} ${_dir_:Q}
+ ${RUN} ${RM} -f ${_dir_:Q}/${REAL_PKGFILE:T}
+ ${RUN} ${LN} -s ../${PKGREPOSITORYSUBDIR}/${REAL_PKGFILE:T} ${_dir_:Q}
.endfor
######################################################################
@@ -91,7 +108,7 @@
### the non-primary categories to which the package belongs.
###
delete-package-links:
- ${RUN} ${FIND} ${PACKAGES} -type l -name ${PKGFILE:T} -print \
+ ${RUN} ${FIND} ${PACKAGES} -type l -name ${REAL_PKGFILE:T} -print\
| ${XARGS} ${RM} -f
######################################################################
@@ -141,9 +158,11 @@
.else
real-package-install:
@${DO_NADA}
+real-package: package
+ @${DO_NADA}
.endif
-su-real-package-install:
+su-real-package-install: ${PKGFILE}
@${PHASE_MSG} "Install binary package of "${PKGNAME:Q}
.if !empty(USE_CROSS_COMPILE:M[yY][eE][sS])
@${MKDIR} ${_CROSS_DESTDIR}${PREFIX}
Index: flavor/pkg/replace.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/flavor/pkg/replace.mk,v
retrieving revision 1.31
diff -u -r1.31 replace.mk
--- flavor/pkg/replace.mk 14 Sep 2010 22:30:42 -0000 1.31
+++ flavor/pkg/replace.mk 4 May 2011 09:16:17 -0000
@@ -29,6 +29,7 @@
_flavor-destdir-replace: \
replace-names \
+ replace-tarup \
replace-destdir \
.PHONY
@@ -48,6 +49,12 @@
replace-clean \
.PHONY
+_flavor-destdir-undo-replace: \
+ undo-replace-check \
+ undo-destdir-replace-install \
+ replace-clean \
+ .PHONY
+
_INSTALLED_INFO_FILE= ${WRKDIR}/.replace-+INSTALLED_INFO
_REQUIRED_BY_FILE= ${WRKDIR}/.replace-+REQUIRED_BY
@@ -90,6 +97,12 @@
${ECHO} "Installing saved package ${WRKDIR}/$${oldname}${PKG_SUFX}"; \
${PKG_ADD} ${WRKDIR}/$${oldname}${PKG_SUFX}
+undo-destdir-replace-install: .PHONY
+ @${PHASE_MSG} "Re-adding ${PKGNAME} from saved tar-up package."
+ ${RUN} ${_REPLACE_OLDNAME_CMD}; \
+ ${ECHO} "Installing saved package ${WRKDIR}/$${oldname}${PKG_SUFX}"; \
+ ${PKG_ADD} -U -D ${WRKDIR}/$${oldname}${PKG_SUFX}
+
# Computes and saves the full names of the installed package to be replaced
# (oldname) and the package that will be installed (newname), so that these
# names are available later.
Index: install/bsd.install.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/install/bsd.install.mk,v
retrieving revision 1.13
diff -u -r1.13 bsd.install.mk
--- install/bsd.install.mk 24 Feb 2010 22:53:34 -0000 1.13
+++ install/bsd.install.mk 4 May 2011 09:16:17 -0000
@@ -25,7 +25,7 @@
.if ${_USE_DESTDIR} == "no"
install: stage-install
.else
-install: package-install
+install: real-package-install
.endif
######################################################################
Index: install/replace.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/install/replace.mk,v
retrieving revision 1.11
diff -u -r1.11 replace.mk
--- install/replace.mk 9 Jun 2009 08:40:28 -0000 1.11
+++ install/replace.mk 4 May 2011 09:16:17 -0000
@@ -22,6 +22,9 @@
# _flavor-undo-replace:
# Undoes a previous "make _flavor-replace".
+# _flavor-destdir-undo-replace:
+# Undoes a previous "make _flavor-destdir-replace".
+
.if ${_USE_DESTDIR} == "no"
_REPLACE_TARGETS+= ${_PKGSRC_BUILD_TARGETS}
.else
@@ -62,5 +65,9 @@
@${PHASE_MSG} "Undoing replacement for ${PKGNAME}"
@${WARNING_MSG} "experimental target - DATA LOSS MAY OCCUR."
+.if ${_USE_DESTDIR} == "no"
su-undo-replace: .PHONY _flavor-undo-replace
+.else
+su-undo-replace: .PHONY _flavor-destdir-undo-replace
+.endif
MAKEFLAGS.su-undo-replace= _UPDATE_RUNNING=yes
Index: package/package.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/package/package.mk,v
retrieving revision 1.22
diff -u -r1.22 package.mk
--- package/package.mk 24 Feb 2010 22:53:34 -0000 1.22
+++ package/package.mk 4 May 2011 09:16:17 -0000
@@ -86,7 +86,7 @@
.if ${_USE_DESTDIR} == "no"
_PACKAGE_ALL_TARGETS+= package-check-installed
.endif
-_PACKAGE_ALL_TARGETS+= package-create
+_PACKAGE_ALL_TARGETS+= real-package-create
_PACKAGE_ALL_TARGETS+= _package-warnings
_PACKAGE_ALL_TARGETS+= error-check
--
OBATA Akio / obache%NetBSD.org@localhost
Home |
Main Index |
Thread Index |
Old Index