Opened 13 years ago

Last modified 16 months ago

#15186 assigned defect

port upgrade does not work correctly on current pseudo-port

Reported by: raimue (Rainer Müller) Owned by: raimue (Rainer Müller)
Priority: Normal Milestone: MacPorts 2.7.0
Component: base Version: 1.6.0
Keywords: Cc: mojca (Mojca Miklavec), ryandesign (Ryan Schmidt)
Port:

Description

Instead of taking the actual porturl, macports::upgrade searches for the port in the tree which makes the behavior totally unexpected when using the current pseudo-port.

Imagine you got some directory with a Portfile outside of your ports tree which has the same name as a port in the tree. Then run port upgrade in this directory, and not the port from this directory is build and installed, but the one from the tree. This is absolutely not expected behavior.

I think macports::upgrade should take a porturl instead of the name of a port.

Change History (11)

comment:1 Changed 13 years ago by raimue (Rainer Müller)

Component: portsbase

comment:2 Changed 12 years ago by tobypeterson

Milestone: MacPorts base bugsMacPorts Future

Milestone MacPorts base bugs deleted

comment:3 Changed 5 years ago by mojca (Mojca Miklavec)

Cc: mojca@… added

Cc Me!

comment:4 Changed 3 years ago by neverpanic (Clemens Lang)

Milestone: MacPorts FutureMacPorts 2.5.0
Owner: changed from macports-tickets@… to raimue
Status: newassigned

We should probably just remove the possibility to run upgrade with the current port. This is a very uncommon usecase otherwise, so it's probably not worth investing a lot of time into it.

comment:5 Changed 3 years ago by neverpanic (Clemens Lang)

Keywords: base upgrade removed
Milestone: MacPorts 2.5.0MacPorts 2.6.0

comment:6 Changed 3 years ago by raimue (Rainer Müller)

Milestone: MacPorts 2.6.0MacPorts 2.5.0

comment:7 in reply to:  4 ; Changed 3 years ago by jmroot (Joshua Root)

Replying to neverpanic:

This is a very uncommon usecase otherwise, so it's probably not worth investing a lot of time into it.

I don't know about that; I do it most of the time when updating ports. It's not needed of course, but it'll be an annoyance to retrain around.

comment:8 in reply to:  7 Changed 3 years ago by raimue (Rainer Müller)

If we want this to work, we are missing an API just like macports::upgrade, but instead of looking up a port by name with mportlookup, it would take a port name of the installed port and a porturl for the replacement. However, that seems a bit complex just for this case.

You can use sudo port install with the current pseudo-port to replace an installed port. The only difference is that port install is allowed to downgrade to an earlier version. Therefore another alternative could be to divert port upgrade current automatically to the install target, maybe with an informational message as the behavior changes slightly.

However, I thought that completely removing this functionality from port upgrade would be a good idea. After a while we could even make port upgrade default to port upgrade outdated to make using MacPorts easier.

comment:9 in reply to:  7 Changed 3 years ago by ryandesign (Ryan Schmidt)

Cc: ryandesign added

Replying to raimue:

Imagine you got some directory with a Portfile outside of your ports tree which has the same name as a port in the tree. Then run port upgrade in this directory, and not the port from this directory is build and installed, but the one from the tree. This is absolutely not expected behavior.

I have been bitten by this behavior before, and I agree it was not at all obvious what was happening.

Replying to jmroot:

Replying to neverpanic:

This is a very uncommon usecase otherwise, so it's probably not worth investing a lot of time into it.

I don't know about that; I do it most of the time when updating ports. It's not needed of course, but it'll be an annoyance to retrain around.

I also use sudo port upgrade constantly. Whenever I work on a port, I first cd $(port dir foo) so that I can easily edit Portfile, sudo port install, sudo port upgrade, sudo port uninstall, port info, and so forth, without having to further specify the port name.

Could we only error out if sudo port upgrade is being attempted on a port that is not the one that is in the index?

comment:10 Changed 3 years ago by neverpanic (Clemens Lang)

Milestone: MacPorts 2.5.0MacPorts 2.6.0

comment:11 Changed 16 months ago by jmroot (Joshua Root)

Milestone: MacPorts 2.6.0MacPorts 2.7.0

Ticket retargeted after milestone closed

Note: See TracTickets for help on using tickets.