Bug 182347

Summary: ports-mgmt/pkg: install target does nothing for pkgng + staging + NO_PKG_REGISTER case
Product: Ports & Packages Reporter: Dmitry Marakasov <amdmi3>
Component: Individual Port(s)Assignee: freebsd-pkg (Nobody) <pkg>
Status: Closed DUPLICATE    
Severity: Affects Only Me CC: bapt, miwi, w.schwarzenfeld
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   

Description Dmitry Marakasov freebsd_committer freebsd_triage 2013-09-24 14:40:00 UTC
When pkgng is used and the port supports staging, `make install` with NO_PKG_REGISTER set does nothing - no files are installed to the system.

This seeminlgy happens because the package installation and pkgdb registration are now done in the same time with pkg, and whole fake-pkg target which runs this pkg is wrapped in .if !defined(NO_PKG_REGISTER):

---
fake-pkg: create-manifest
.if !defined(NO_PKG_REGISTER)
.if defined(INSTALLS_DEPENDS)
    @${ECHO_MSG} "===>   Registering installation for ${PKGNAME} as automatic"
.else
    @${ECHO_MSG} "===>   Registering installation for ${PKGNAME}"
.endif
.if defined(INSTALLS_DEPENDS)
    @${SETENV} FORCE_POST="${_FORCE_POST_PATTERNS}" ${PKG_CMD} -d ${STAGE_ARGS} -m ${METADIR} -f ${TMPPLIST}
.else
    @${SETENV} FORCE_POST="${_FORCE_POST_PATTERNS}" ${PKG_CMD} ${STAGE_ARGS} -m ${METADIR} -f ${TMPPLIST}
.endif
    @${RM} -rf ${METADIR}
.else
    @${DO_NADA}
.endif
.endif
---

Fix: 

Likely a mode needs to be added to pkg which does installation but not registration, and it should be used in pkgng.mk

Also, this probably may be achieved with using -l argument of `pkg register` and fake PKG_DBDIR, but I haven't tested.
How-To-Repeat: Try `make install` any port with NO_PKG_REGISTER.
Comment 1 Alex Kozlov freebsd_committer freebsd_triage 2013-10-02 07:44:29 UTC
Responsible Changed
From-To: freebsd-ports-bugs->portmgr

Over to maintainer.
Comment 2 John Marino freebsd_committer freebsd_triage 2014-08-31 10:37:22 UTC
If this PR is no longer valid, it would be nice to get it closed.  It shows in a search for unstaged ports.
Comment 3 Dmitry Marakasov freebsd_committer freebsd_triage 2014-08-31 12:50:02 UTC
The PR is valid. Ports are still not installed.
Comment 4 Martin Wilke freebsd_committer freebsd_triage 2016-01-17 15:08:21 UTC
(In reply to Dmitry Marakasov from comment #3)
Hi,

Its 2016 still the same problem?
Comment 5 Dmitry Marakasov freebsd_committer freebsd_triage 2016-01-26 16:11:45 UTC
Yes. You can reproduce it with

WRKDIRPREFIX=/tmp/work PREFIX=/tmp/usr NO_PKG_REGISTER=1 INSTALL_AS_USER=1 make -C /usr/ports/archivers/zip clean install

After it there's no /tmp/usr.
Comment 6 Walter Schwarzenfeld freebsd_triage 2018-01-12 01:22:50 UTC
Any advance here?
Comment 7 Mark Linimon freebsd_committer freebsd_triage 2020-07-25 23:34:05 UTC
^Triage: this does not currently appear to be "in progress".
Comment 8 Baptiste Daroussin freebsd_committer freebsd_triage 2021-08-18 13:06:13 UTC
https://github.com/freebsd/pkg/commit/b7e41c16fe4f0ab71dbf7003bef08475ae039536

This commit adds pkg register -N which allows to reactivate the feature in the ports tree.
I will close that bug as a duplicate of another on in portmgr land as the work is not only to be done in bsd.port.mk (once I will issue a release)

*** This bug has been marked as a duplicate of bug 191461 ***