On a number of FreeBSD boxes where I build ports, I have always had the PACKAGES setting point to a shared NFS directory where the packages should end up. For example, in /etc/make.conf on a amd64-freebsd12 box: PACKAGES?=/share/dim/dist/FreeBSD:12:amd64/latest On an i386-freebsd10 box: PACKAGES?=/share/dim/dist/FreeBSD:10:i386/latest and so on. I use the same version:arch convention as pkg, so I can easily specify a common url in pkg.conf files, e.g.: url: "file:///share/dim/dist/${ABI}/latest" However, since r438058 and its follow-up r438901, this no longer works, and every invocation of make inside the ports tree gives a number of warnings about duplicate targets: $ make foo make[1]: "/share/dim/ports/Mk/bsd.port.mk" line 5130: warning: duplicate script for target "/share/dim/dist/FreeBSD" ignored make[1]: "/share/dim/ports/Mk/bsd.port.mk" line 3294: warning: using previous script for "/share/dim/dist/FreeBSD" defined here make[1]: "/share/dim/ports/Mk/bsd.port.mk" line 5130: warning: duplicate script for target "/share/dim/dist/FreeBSD" ignored make[1]: "/share/dim/ports/Mk/bsd.port.mk" line 3294: warning: using previous script for "/share/dim/dist/FreeBSD" defined here make[1]: "/share/dim/ports/Mk/bsd.port.mk" line 5130: warning: duplicate script for target "/share/dim/dist/FreeBSD" ignored make[1]: "/share/dim/ports/Mk/bsd.port.mk" line 3294: warning: using previous script for "/share/dim/dist/FreeBSD" defined here make[1]: "/share/dim/ports/Mk/bsd.port.mk" line 5130: warning: duplicate script for target "/share/dim/dist/FreeBSD" ignored make[1]: "/share/dim/ports/Mk/bsd.port.mk" line 3294: warning: using previous script for "/share/dim/dist/FreeBSD" defined here make: don't know how to make foo. Stop This is because line 3292 of bsd.port.mk now specifies: ${PKGFILE}: ${WRKDIR_PKGFILE} ${PKGREPOSITORY} while before that, PKGFILE has been defined as: PKGREPOSITORY?= ${PACKAGES}/${PKGREPOSITORYSUBDIR} .if exists(${PACKAGES}) _HAVE_PACKAGES= yes PKGFILE?= ${PKGREPOSITORY}/${PKGNAME}${PKG_SUFX} E.g. the PACKAGES setting, complete with colons, ends up in PKGFILE. Afterwards, actually trying to build any port errors out with messages similar to: $ make -C devel/gmake make: "/share/dim/ports/Mk/bsd.port.mk" line 5130: warning: duplicate script for target "/share/dim/dist/FreeBSD" ignored make: "/share/dim/ports/Mk/bsd.port.mk" line 3294: warning: using previous script for "/share/dim/dist/FreeBSD" defined here make[1]: "/share/dim/ports/Mk/bsd.port.mk" line 5130: warning: duplicate script for target "/share/dim/dist/FreeBSD" ignored make[1]: "/share/dim/ports/Mk/bsd.port.mk" line 3294: warning: using previous script for "/share/dim/dist/FreeBSD" defined here ===> License GPLv3 accepted by the user ===> gmake-4.2.1_1 depends on file: /usr/local/sbin/pkg - found ===> Fetching all distfiles required by gmake-4.2.1_1 for building ===> Extracting for gmake-4.2.1_1 => SHA256 Checksum OK for make-4.2.1.tar.bz2. make[1]: don't know how to make 12:amd64/latest/All:. Stop make[1]: stopped in /share/dim/ports/devel/gmake *** Error code 2 Stop. make: stopped in /share/dim/ports/devel/gmake I can confirm that reverting both r438058 and r438901 fixes this issue.
Note: ports tree is at r439221.
438058: "Use native make(1) mechanism to create the package repository directory" bapt@ 438901: "Refactor do-package aka subpackages step 2" bapt@ fyi
I am not sure how this can be fixed, but as a solution, don't use colons in your PACKAGES variables, and create symlinks to the correct directories.
(In reply to Mathieu Arnold from comment #3) > I am not sure how this can be fixed, but as a solution, don't use colons in > your PACKAGES variables, and create symlinks to the correct directories. My solution was to simply revert r438901 and 438058 locally. I'm not sure if parts of make or Mk/*.mk will try to resolve symlinks?
Reverting the commits is going to break things badly when things continue to move on. Your problem is that the directories are created using make(1) targets, and that make(1) targets are in the form of "word:" so if you have "target-with-a:in-the-middle:" it parses it as target-with-a that depends on in-the-middle:. The targets are only there to create the directories if they do not exist, so symlinks will work as long as the target exists.
I think surrounding the target with quotes should be enough, but I can't try it
(In reply to Baptiste Daroussin from comment #6) > I think surrounding the target with quotes should be enough, but I can't try > it Did you mean in bsd.port.mk, or in make.conf? But indeed, quoting the vale of PACKAGES, or escaping the colons, in /etc/make.conf makes it work again. E.g.: PACKAGES?="/share/dim/dist/FreeBSD:12:i386/latest" or: PACKAGES?=/share/dim/dist/FreeBSD\:12\:i386/latest both allow me to build ports, even with r438058 and r438901 applied. Let's close this bug then, but maybe it would be nice to have some sort of warning in bsd.port.mk about using colons (or other make metacharacters) in ports-related make.conf variables?
I was meaning in bsd.port.mk :) quoting ${PKGFILE}: should imho to the trick
(In reply to Baptiste Daroussin from comment #8) > I was meaning in bsd.port.mk :) quoting ${PKGFILE}: should imho to the trick No, I tried that, but PKGFILE is used in a great many other macros, so it eventually ends up erroring out anyway...
Reverting Mk/bsd.port.mk to r438057 is the only solution which works for me. Since the pkg convention is to use colons for pathnames, these should also work for the upper bulding stages, in form of setting PACKAGES. Changing PACKAGES definition is no acceptable solution, it even contradicts pkg's native convention!
It seems r441712 was reviewed and accepted as fix. Unfortunately it wasn't mentioned here, maybe I'm missing that reviews.freebsd.org is where fixes get discussed... However, USE_PACKAGE_DEPENDS is still broken as a result of r438058, 438901 and r441712, if PACKAGES are set and contain colons, due to the same cause initially reported here by Dimitry Andric. -harry