# Unable to upgrade perl



## ph0enix (Jan 29, 2015)

I'm trying to upgrade PERL on a 9.3-p9 system with:
`portmaster -o lang/perl5.18 lang/perl5.14`
but it's getting stuck registering pkg-1.4.7 since it's already installed:

```
===>  Installing for pkg-1.4.7
===>  Checking if pkg already installed
===>  pkg-1.4.7 is already installed
  You may wish to ``make deinstall'' and install this port again
  by ``make reinstall'' to upgrade it properly.
  If you really wish to overwrite the old port of pkg
  without deleting it first, set the variable "FORCE_PKG_REGISTER"
  in your environment or the "make install" command line.
*** [check-already-installed] Error code 1

Stop in /usr/ports/ports-mgmt/pkg.
*** [/usr/ports/ports-mgmt/pkg/work/.install_done.pkg._usr_local] Error code 1

Stop in /usr/ports/ports-mgmt/pkg.

===>>> Installation of pkg-1.4.7 (ports-mgmt/pkg) failed
===>>> Aborting update

===>>> Update for ports-mgmt/pkg failed
===>>> Aborting update
```
I have the following in /etc/make.conf:

```
PERL_VERSION=5.18.4
WITH_PKGNG=YES
```
How do I get around this?


----------



## talsamon (Jan 29, 2015)

The error message said it: write `FORCE_PKG_REGISTER=YES` in /etc/make.conf.


----------



## youngunix (Jan 29, 2015)

Did you try using pkg-upgrade(8)?


----------



## ph0enix (Jan 29, 2015)

talsamon said:


> The error message said it: write `FORCE_PKG_REGISTER=YES` in /etc/make.conf.



The problem with this solution is that FORCE_PKG_REGISTER=YES  it will force all the packages/dependencies and that could cause all kinds of problems problems.  I would like to force it only for pkg(8).


----------



## ph0enix (Jan 29, 2015)

youngunix said:


> Did you try using pkg-upgrade(8)?



On my system it's `pkg upgrade`.  I'm trying it now.  Thanks!


----------



## youngunix (Jan 30, 2015)

ph0enix said:


> On my system it's `pkg upgrade`.  I'm trying it now.  Thanks!


Yeah I know, but just for future reference, the manual pages don't accept spaces when you try to look up a command. For example, all the new `pkg *` commands should have a dash linking them (i.e., `man pkg-install`).


----------



## talsamon (Jan 30, 2015)

> I would like to force it only for pkg.



in /etc/make.conf

```
.if ${.CURDIR:M*/usr/ports/ports-mgmt/pkg}
FORCE_PKG_REGISTER=YES
.endif
```


----------



## wblock@ (Jan 30, 2015)

Please stop.

No, do not use FORCE_PKG_REGISTER.  Stop overriding the Perl version in make.conf for starters.


----------



## talsamon (Jan 30, 2015)

Sorry, but this I can't understand. In this case it's the same as deinstall and reinstall.
(Tell me if I guess wrong, but I doubt it makes any sense, that `portmaster` wants to reinstall ports-mgmt/pkg),


----------



## SirDice (Jan 30, 2015)

No, FORCE_PKG_REGISTER as the name implies forces a package to be registered _without_ removing the old registration first. So if things go wrong you could end up with two different versions of the same package installed.


----------



## talsamon (Jan 30, 2015)

Sorry, I shake my head. I have FORCE_PKG_REGISTER in my /etc/make.config. Never had problems with it. I had much to do, if I had to deinstall all these programms, `portmaster` isn't able to reinstall.


----------



## SirDice (Jan 30, 2015)

Remove it, you don't need it. Pretty much every problem I've encountered with the ports/package system I've been able to resolve without using this. It should really only be used if you absolutely know what you're doing and the issue cannot be solved any other way.


----------



## talsamon (Jan 30, 2015)

Ok, I try it. But there were some reasons I put it in /etc/make.conf.


----------



## junovitch@ (Jan 31, 2015)

talsamon said:


> Ok, I try it. But there were some reasons I put it in /etc/make.conf.


For one it would probably break when Perl gets a patch level bump under 5.18.  This make.conf would be correct and not break if Perl gets a 5.18.5.

```
DEFAULT_VERSIONS+= perl5=5.18
```


----------



## talsamon (Jan 31, 2015)

I had no problems with perl, but I know this message:


> If you really wish to overwrite the old ....
> without deleting it first, set the variable "FORCE_PKG_REGISTER"
> in your environment or the "make install" command line.



very well.


----------



## kpa (Jan 31, 2015)

This is one of the major annoyances in the ports(7) system that has existed since the dawn of FreeBSD ports. There has never been a proper "upgrade" target that would upgrade a port in-place with the upgraded version. All `make reinstall` does currently is `make deinstall` on the port to delete the old version (translates to pkg-delete(8) really) followed by `make install` on the port to install the new version. The need to use FORCE_PKG_REGISTER arises if the port being reinstalled is required by other ports and the deletion of the old version has to be done with force using `pkg delete -f`.


----------

