Date: Fri, 31 Dec 2010 03:08:20 +0100 (CET) From: Olli Hauer <ohauer@FreeBSD.org> To: <FreeBSD-gnats-submit@FreeBSD.org> Subject: ports/153573: [patch] ports/Mk bsd.license.mk honor pkg_add -p/-P Message-ID: <20101231020820.478DF205CC@u18-124.dslaccess.de> Resent-Message-ID: <201012310210.oBV2AA2u024348@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 153573 >Category: ports >Synopsis: [patch] ports/Mk bsd.license.mk honor pkg_add -p/-P >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Fri Dec 31 02:10:10 UTC 2010 >Closed-Date: >Last-Modified: >Originator: Olli Hauer >Release: >Organization: >Environment: >Description: If a package is installed with pkg_add -p or -P there is an issue during deinstall of the package. You will notice a simmilar message during deinstall: # pkg_delete lic-test-1.0 pkg_delete: file '/usr/local/share/licenses/lic-test-1.0' doesn't exist pkg_delete: unable to completely remove directory '/usr/local/share/licenses/lic-test-1.0' pkg_delete: couldn't entirely delete package (perhaps the packing list is incorrectly specified?) This issue comes from a hard coded PREFIX injected to TMPPLIST during package generation. ( @\${ECHO_CMD} "@cwd \${PREFIX}" >> \${TMPPLIST} ) >How-To-Repeat: I've made some tests and found an interesting behavior of pkg_add which solves this issue. If "@cwd " without target is given it will be replaced during pkg_add with "@cwd $PKG_PREFIX". Important, there must be an whitespace behind "@cwd "! Testcase: 1) create package with test port 2) pkg_info -f lic-test-1.0 | grep CWD CWD to /usr/local CWD to /tmp CWD to /var/tmp CWD to /usr/local 3) pkg_delete lic-test-1.0 4) mtree -U -f /usr/ports/Templates/BSD.local.dist -d -e -p /tmp/lic-test >/dev/null 5) pkg_add -p /tmp/lic-test lic-test-1.0.tbz 6) pkg_info -f lic-test-1.0 | grep CWD CWD to /tmp/lic-test CWD to /tmp CWD to /var/tmp wrong --> CWD to /usr/local 7) pkg_delete lic-test-1.0 pkg_delete: file '/usr/local/share/licenses/lic-test-1.0' doesn't exist pkg_delete: unable to completely remove directory '/usr/local/share/licenses/lic-test-1.0' pkg_delete: couldn't entirely delete package (perhaps the packing list is incorrectly specified?) 8) Apply patch for bsd.license.mk and go back to 1) Now we have the follwing output for 2) and 6) 2) CWD to /usr/local CWD to /tmp CWD to /var/tmp CWD to /usr/local 6) CWD to /tmp/lic-test CWD to /tmp CWD to /var/tmp OK --> CWD to /tmp/lic-test Even in /var/db/pkg/lic-test-1.0/+CONTENTS we can find this lines @comment the following entries are added by the ports framework @cwd /tmp/lic-test @dirrm share/licenses/lic-test-1.0 >Fix: --- patch_ports-MK__bsd.license.mk.txt begins here --- Index: Mk/bsd.licenses.mk =================================================================== RCS file: /home/pcvs/ports/Mk/bsd.licenses.mk,v retrieving revision 1.4 diff -u -r1.4 bsd.licenses.mk --- Mk/bsd.licenses.mk +++ Mk/bsd.licenses.mk @@ -744,7 +744,8 @@ . endfor .endif # XXX @dirrmtry entry must be here (no way to do with PLIST_* vars) - @${ECHO_CMD} "@cwd ${PREFIX}" >> ${TMPPLIST} +# XXX Important, keep the whitespace behind "@cwd "! + @${ECHO_CMD} "@cwd " >> ${TMPPLIST} @${ECHO_CMD} "@dirrm ${_LICENSE_DIR_REL}" >> ${TMPPLIST} @${ECHO_CMD} "@unexec rmdir %D/share/licenses 2>/dev/null || true" >> ${TMPPLIST} --- patch_ports-MK__bsd.license.mk.txt ends here --- --- test-port-and-patch-for-bsd.license.mk begins here --- --- /dev/null +++ Makefile @@ -0,0 +1,19 @@ +# lic-test + +PORTNAME= lic-test +PORTVERSION= 1.0 +CATEGORIES= misc +MASTER_SITES= # none +DISTFILES= # none + +MAINTAINER= devnull@example.org +COMMENT= Lic test for pkg_add -p or -P + +LICENSE= BSD +NO_BUILD= yes + +do-install: + @${MKDIR} ${DATADIR} + @${INSTALL_DATA} ${WRKDIR}/.PLIST.mktmp ${DATADIR}/PLIST + +.include <bsd.port.mk> --- /dev/null +++ pkg-plist @@ -0,0 +1,7 @@ +%%DATADIR%%/PLIST +@dirrm %%DATADIR%% +@exec echo "PKG_PREFIX $PKG_PREFIX" +@comment do at last 2x cwd +@cwd /tmp +@cwd /var/tmp +@comment the following entries are added by the ports framework --- /dev/null +++ pkg-descr @@ -0,0 +1,5 @@ +license test if installed from package +with parameter -p or -P + +for example: +pkg_add -p /foo/bar dummy.pkg --- test-port-and-patch-for-bsd.license.mk ends here --- >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20101231020820.478DF205CC>