When the old version is installed, I think following code not running properly. pkg_preinst() { if [[ -L "${ROOT}/usr/src/sys" ]]; then einfo "/usr/src/sys is a symlink, removing it..." rm -f "${ROOT}/usr/src/sys" fi Reproducible: Always Steps to Reproduce: 1. emerge -C freebsd-sources 2. rm -rf /usr/src/* 3. emerge --nodeps =freebsd-sources-9.1-r3 4. ls -lha /usr/src total 48 drwxr-xr-x 3 root wheel 512B Aug 21 00:29 . drwxr-xr-x 17 root wheel 512B Aug 21 00:29 .. lrwxr-xr-x 1 root wheel 7B Aug 21 00:29 sys -> sys-9.1 drwxr-xr-x 57 root wheel 1.0k Aug 21 00:29 sys-9.1 5. USE="-*" emerge =freebsd-sources-9.2_rc1 Detected file collision(s): * /usr/src/sys/Makefile * /usr/src/sys/amd64/Makefile * /usr/src/sys/amd64/ia32/ia32_syscall.c * /usr/src/sys/amd64/ia32/ia32_reg.c <snip> * /usr/src/sys/amd64/include/sigframe.h * /usr/src/sys/amd64/include/stdarg.h * /usr/src/sys/amd64/include/vmparam.h * * Package 'sys-freebsd/freebsd-sources-9.2_rc1' NOT merged due to file * collisions. If necessary, refer to your elog messages for the whole * content of the above message. * * The following package has failed to build or install:
Created attachment 356508 [details, diff] sample patch for freebsd-sources-9.2_rc1.ebuild Sample patch to detect the old version and BLOCK. # USE="-*" emerge -pv =freebsd-sources-9.2_rc1 Calculating dependencies... done! [ebuild NS #] sys-freebsd/freebsd-sources-9.2_rc1:0 [9.1-r3:9.1] USE="-build-generic -dtrace -profile" 0 kB [blocks B ] <sys-freebsd/freebsd-sources-9.2_rc1 ("<sys-freebsd/freebsd-sources-9.2_rc1" is blocking sys-freebsd/freebsd-sources-9.2_rc1) Total: 1 package (1 in new slot), Size of downloads: 0 kB Conflict: 1 block (1 unsatisfied) * Error: The above package list contains packages which cannot be * installed at the same time on the same system. (sys-freebsd/freebsd-sources-9.2_rc1::gentoo, ebuild scheduled for merge) pulled in by =freebsd-sources-9.2_rc1 (sys-freebsd/freebsd-sources-9.1-r3::gentoo, installed) pulled in by sys-freebsd/freebsd-sources:9.1 required by @selected For more information about Blocked Packages, please refer to the following section of the Gentoo Linux x86 Handbook (architecture is irrelevant): http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?full=1#blocked Howto Upgrade (I'll update the wiki in future.) 1. emerge -C '<sys-freebsd/freebsd-sources-9.2_rc1' 2. emerge sys-freebsd/freebsd-sources
hmmm but why does that code fail ? imho this should be fixed instead
Created attachment 356612 [details, diff] patch When check symlink in src_install(), I noticed that to succeed it. The new patch just moved. Maybe, the cause is in the following order... ... src_compile src_test src_install pkg_preinst ... FYI, https://devmanual.gentoo.org/ebuild-writing/functions/index.html
this will certainly not work since src_install is in the sandbox and not used for binary packages :/
(In reply to Alexis Ballier from comment #4) > this will certainly not work since src_install is in the sandbox and not > used for binary packages :/ thanks, I had forgot binpkg. How about checking the symlink in both src_install and pkg_preinst ? check_old_symlink(){ if [[ -L "${ROOT}/usr/src/sys" ]]; then einfo "/usr/src/sys is a symlink, removing it..." rm -f "${ROOT}/usr/src/sys" fi } src_install() { # For FEATURES="-sandbox". fix file collisions bug 481766 # Gentoo/FreeBSD doesn't support sandbox. Force set FEATURES="-sandbox" in profile. check_old_symlink ... } pkg_preinst() { # For binary packages. It's not call src_install(). check_old_symlink ... }
you can't modify the filesystem at src_install, so its no good either actually, since I've de-slotted fbsd-sources starting at 9.2 it makes sense to add the blocker you were suggesting at the beginning, but still the symlink will remain as you report and the files will end up in the wrong directory...
(In reply to Alexis Ballier from comment #6) > you can't modify the filesystem at src_install, so its no good either ok. > actually, since I've de-slotted fbsd-sources starting at 9.2 it makes sense > to add the blocker you were suggesting at the beginning, but still the > symlink will remain as you report and the files will end up in the wrong > directory... Detects file collisions in src_install, then die. If file collisions is not detected in the src_install, pkg_preinst is called correctly. Yes. Symbolic link is removed! Sorry to confuse you. # emerge -C '<freebsd-sources-9.2_rc1' # USE="-*" emerge =freebsd-sources-9.2_rc1 <snip> >>> Installing (1 of 1) sys-freebsd/freebsd-sources-9.2_rc1 * Removing /usr/lib/systemd * /usr/src/sys is a symlink, removing it... >>> Recording sys-freebsd/freebsd-sources:0 in "world" favorites file... # ls -lha /usr/src total 64 drwxr-xr-x 4 root wheel 512B Aug 22 06:23 . drwxr-xr-x 17 root wheel 512B Aug 22 06:18 .. drwxr-xr-x 58 root wheel 1.0k Aug 22 06:23 sys drwxr-xr-x 3 root wheel 1.0k Aug 22 06:20 sys-9.1
Created attachment 363662 [details, diff] patch for freebsd-sources-9.2.ebuild Correct patch. will remove the old version with SLOT automatically.
9.2 removed.