Bug 224244

Summary: make reinstall and FORCE_PKG_REGISTER does not work
Product: Ports & Packages Reporter: Walter Schwarzenfeld <w.schwarzenfeld>
Component: Ports FrameworkAssignee: Port Management Team <portmgr>
Status: Closed FIXED    
Severity: Affects Many People CC: bdrewery, chris, franco, jakub_lach, jsmith, michael.osipov, mmpestorich, olevole, pi, ports-bugs
Priority: ---    
Version: Latest   
Hardware: Any   
OS: Any   
Description Flags
svn-diff-bsd.port.mk none

Description Walter Schwarzenfeld freebsd_triage 2017-12-11 11:58:27 UTC
The command make reinstall does not work anymore (after the changes with FLAVOR).
Also FORCE_PKG_REGISTER does not work.

It ends with "Error Code 70".

Baptiste Daroussin wrote:
because it should have always been like that, the real reinstallation was make deinstall reinstall, the fact one needs not to run deinstall first was a bug introduced very very long ago.

If it is so, so please obsolete these two commands .
Comment 1 Walter Schwarzenfeld freebsd_triage 2017-12-11 12:01:21 UTC
Forgot the link to Bapt's statement
Comment 2 Mathieu Arnold freebsd_committer 2017-12-11 12:20:30 UTC
I vote for removing FORCE_PKG_REGISTER and reinstall.
Comment 3 Rob Belics 2018-01-07 14:17:29 UTC
So just do 'make install clean'?
Comment 4 Rob Belics 2018-01-07 14:19:08 UTC
(In reply to Rob Belics from comment #3)
Sorry. Ignore. I mis-read it.
Comment 5 Christina Mueller 2018-01-10 20:24:29 UTC
"make xyz install" complains about the package already being installed, "make xyz reinstall" has just been disabled.

I don't really care about the sematics but I need to be able to reinstall a package. Am I missing something?
Comment 6 Christina Mueller 2018-01-10 20:32:15 UTC
Remove the "xyz" bit - the make target is install or reinstall, of course. I was thinking along the lines of my upgrade script which goes through a list of packages I need to be compiled from source because of changed options, patched source, etc.
Comment 7 Walter Schwarzenfeld freebsd_triage 2018-01-10 20:44:38 UTC
I would say remove FORCE_PKG_REGISTER. But make something like a alias. reinstall as alias for 
deinstall install. It is more handy for typing the command.
Comment 8 Christina Mueller 2018-01-11 00:04:44 UTC
I just finished rolling back my entire system after hitting this issue.

My problem in detail:
 * Most of my packages are installed via pkg
 * A few packages are installed via ports because I need custom patches, debug information, different build options, etc.

I (and probably quite a few others) need an option to reinstall a package via ports in a system generally maintained via pkg.
Comment 9 Christina Mueller 2018-01-14 09:58:54 UTC
I just read the few existing comments and commit logs again. And again. And eventually it occurred to me that this is exclusively about pkg and package management and the believe that the "ports reinstall" sequence is broken. Thus, there had to be a way considered to be correct for pkg to reinstall something, and there is: pkg install -f ...

IMHO, it's unfortunate that this was released without a corresponding fix to the ports project. For others who are wondering how reinstall an installed package from ports:

- run "make package" in ports
- run "pkg install -f /usr/ports/packages/..."

Would it be possible to consider mapping the "make reinstall" target to doing something along those lines as well?
Comment 10 jsmith 2018-01-27 16:28:48 UTC
I ran into this problem too where trying to upgrade any installed package through ports would result in "make reinstall" throwing error 70.

This is all the more frustrating because running "make install" specifically tells the user to run "make reinstall" which will always fail. I think the "make reinstall" command should probably, instead of simply failing with error 70, tell the user something like: "Run 'make package ; pkg install -f work/pkg/package-name"

Alternatively it would be nice if "make reinstall" did that automatically, so "make reinstall" functioned as an alias for "make package; pkg install -f". This would best reflect what the user was trying to do.
Comment 11 Walter Schwarzenfeld freebsd_triage 2018-03-05 10:39:26 UTC
I see no big work, if I am right all what is to do is:
3703 reinstall:
   3704         @${RM} ${INSTALL_COOKIE} ${PACKAGE_COOKIE}
   3705 -       @cd ${.CURDIR} && DEPENDS_TARGET="${DEPENDS_TARGET}" ${MAKE} install
   3706 +        @cd ${.CURDIR} && ${MAKE} deinstall && ${MAKE} install
   3707 .endif
Comment 12 Bryan Drewery freebsd_committer 2018-03-05 22:00:27 UTC
(In reply to w.schwarzenfeld from comment #11)
> I see no big work, if I am right all what is to do is:
> bsd.port.mk
> 3703 reinstall:
>    3704         @${RM} ${INSTALL_COOKIE} ${PACKAGE_COOKIE}
>    3705 -       @cd ${.CURDIR} && DEPENDS_TARGET="${DEPENDS_TARGET}" ${MAKE}
> install
>    3706 +        @cd ${.CURDIR} && ${MAKE} deinstall && ${MAKE} install
>    3707 .endif

Pretty much it looks right. I don't know what's up with DEPENDS_TARGET there.
Comment 13 Walter Schwarzenfeld freebsd_triage 2018-03-05 22:48:06 UTC
A copy and paste error. The original line is
Comment 14 Walter Schwarzenfeld freebsd_triage 2018-03-05 23:01:22 UTC
But that is only for "reinstall".
The were still the problem with "install".
Comment 15 jakub_lach 2018-05-19 16:09:49 UTC
> Alternatively it would be nice if "make reinstall" did that automatically

Comment 16 Walter Schwarzenfeld freebsd_triage 2018-05-19 16:28:52 UTC
Whatever, I hope someone would soon solve this annoying problem.
Comment 17 olevole 2018-05-21 14:26:09 UTC
2018-05-21: some problem. Really, none of the FreeBSD developers do not suffer from this, only users ;-)?
Comment 18 Franco Fichtner 2018-05-21 14:56:15 UTC
The silly issue being the ports framework is still lying to its users ;)

Comment 19 Walter Schwarzenfeld freebsd_triage 2019-09-01 01:51:01 UTC
I don't understand why nobody removes "-DFORCE_PKG_REGISTER"
or change only one line (see comment11).
Comment 20 Walter Schwarzenfeld freebsd_triage 2019-09-04 10:38:52 UTC
Created attachment 207181 [details]
Comment 21 Walter Schwarzenfeld freebsd_triage 2019-09-04 10:40:06 UTC
Created attachment 207182 [details]

Attached the wrong file.
Comment 22 commit-hook freebsd_committer 2019-09-04 12:01:46 UTC
A commit references this bug:

Author: bapt
Date: Wed Sep  4 12:01:20 UTC 2019
New revision: 511086
URL: https://svnweb.freebsd.org/changeset/ports/511086

  Fix the reinstall target to make it follow a proper sequence
  first deinstall then reinstall.

  For now keep the DEPENDS_TARGET, which should probably die, but
  let study that in a second step

  PR:		224244
  Submitted by:	Walter Schwarzenfeld <w.schwarzenfeld@utanet.at>

Comment 23 Baptiste Daroussin freebsd_committer 2019-09-04 12:03:35 UTC
Sorry for the delay, I somehow completly missed that PR over the years.

Thanks for the fix. Note that I kept the DEPENDS_TARGET for now.

More work is needed imho on the DEPENDS_TARGET, to deornit it or at the very least cleaning it up