#16085: port deactivates then activates active dependency if more than one "latest" version of a port is installed --------------------------------------+------------------------------------- Reporter: ryandesign@macports.org | Owner: macports-tickets@lists.macosforge.org Type: defect | Status: new Priority: Normal | Milestone: MacPorts base bugs Component: base | Version: 1.7.0 Resolution: | Keywords: --------------------------------------+------------------------------------- Changes (by ryandesign@macports.org): * summary: port deactivates then activates active dependency if another version is installed => port deactivates then activates active dependency if more than one "latest" version of a port is installed Comment: The problem can also be reproduced even if a port doesn't need upgrading, which at least makes it easy to reproduce and test. After some testing, it seems that r36762 is indeed implicated, though the behavior before r36762 is hardly better. Consider this set of installed ports: {{{ $ port installed dcraw lcms tiff The following ports are currently installed: dcraw @8.86_2 (active) lcms @1.17_0 lcms @1.17_0+universal (active) tiff @3.8.2_2+macosx tiff @3.8.2_2+macosx+universal (active) $ }}} With trunk @36762: {{{ $ port upgrade dcraw ---> Deactivating lcms @1.17_0+universal ---> Activating lcms @1.17_0+universal ---> Deactivating tiff @3.8.2_2+macosx+universal ---> Activating tiff @3.8.2_2+macosx+universal $ }}} With trunk @36761: {{{ $ port upgrade dcraw ---> Activating lcms @1.17_0+universal Error: Activating lcms @1.17_0 failed: Image error: lcms @1.17_0+universal is already active. $ }}} The code tries to activate the "latest" installed version of a port, and I'm going to go out on a limb and assume that the problem occurs when you have more than one "latest" version installed. In my case, both installed lcms ports are the latest ''version'' but they have different variants. And the one that's active is not the first one in the list. See: {{{ $ port deactivate lcms @1.17_0+universal ---> Deactivating lcms @1.17_0+universal $ port activate lcms @1.17_0 ---> Activating lcms @1.17_0 $ port upgrade dcraw ---> Deactivating tiff @3.8.2_2+macosx+universal ---> Activating tiff @3.8.2_2+macosx+universal $ }}} See, now it doesn't complain about lcms anymore, because now the first lcms in the list was already active. So fix !#1 that's needed: if the active port is of the latest ''version'' then don't deactivate and activate. Ignore the variants in this comparison. This leads to quandary !#2: if the active version is not the latest, and we do need to deactivate it and activate the latest version, what if there's more than one latest version installed (with different variants)? Which one do we activate? We may want to activate the one with the most similar variants to the currently-active one. Does the code currently do this? I don't know which one it picks. This may be a matter for another ticket, or it may in fact be too special a case to warrant spending a lot of time on, but I wanted to point it out. -- Ticket URL: <http://trac.macports.org/ticket/16085#comment:2> MacPorts <http://www.macports.org/> Ports system for Mac OS