Opened 4 years ago

Last modified 4 years ago

#59696 new enhancement

Use MacPorts git or svn if available when fetch.type is git or svn

Reported by: RJVB (René Bertin) Owned by:
Priority: Normal Milestone:
Component: base Version:
Keywords: Cc:
Port:

Description

I just noticed that a number of VCS fetch methods get the command from the system, possibly if it meets certain requirements. No account is made for this in the fetch dependencies: ports using fetch.type set to git or to bzr still inherit a depends_fetch on the corresponding port.

Curiously, the git and svn commands are taken from the system when not running on Darwin. I'd do the opposite, take them from $prefix ... at least in an installation that is actually supposed to be usable. On any other Unix than Darwin the same consideration applies that MacPorts could be used to install newer versions of utilities and libraries than those provided by the distribution (case in point: my Ubuntu's git command fails with invent.kde.org while port:git succeeds just fine).

It would probably also be fine to have a lazy dependency on the MacPorts versions of the VCS types that are recent enough in the system, that is, use the version from $prefix if it exists, instead of the system version.

Change History (5)

comment:1 Changed 4 years ago by ryandesign (Ryan Carsten Schmidt)

I think you'll find (look with port -v deps) that the dependency we set is a bin:-style dependency, so that the system executable could satisfy the dependency, but if the system executable doesn't exist or if the port is already installed, the port's executable will be used, except that we require the MacPorts svn or git executables on macOS versions where the system version of the executable is too old to talk to popular services like GitHub or SourceForge. We have made no attempt to also require the MacPorts executables on old versions of non-macOS operating systems because we are not familiar with other operating systems.

comment:2 Changed 4 years ago by ryandesign (Ryan Carsten Schmidt)

You may view the code that does this at browser:macports-base/src/port1.0/portfetch.tcl#L176

comment:3 Changed 4 years ago by RJVB (René Bertin)

That code is what prompted me to file a ticket. I didn't think to check the type of dependency though.

However, portfetch.tcl hardwires e.g. git.cmd to whatever value set in the autoconf.tcl file, meaning /usr/bin/git could be used even if $prefix/bin/git is available and probably newer.

comment:4 in reply to:  3 ; Changed 4 years ago by ryandesign (Ryan Carsten Schmidt)

Summary: redundant depends_fetch on port:git OR just use the port everywhereUse MacPorts git or svn if available when fetch.type is git or svn

Replying to RJVB:

However, portfetch.tcl hardwires e.g. git.cmd to whatever value set in the autoconf.tcl file, meaning /usr/bin/git could be used even if $prefix/bin/git is available and probably newer.

I believe that's correct. I suppose it could be changed to use MacPorts git/svn if available, for a hypothetical situation in which the copy found or specified at MacPorts configure time is not sufficient.

MacPorts supports the user specifying which git or svn to use at the time that they configure MacPorts, and they might not expect MacPorts to use something different instead. But this capability is esoteric and I don't expect many users use it.

comment:5 in reply to:  4 Changed 4 years ago by RJVB (René Bertin)

Replying to ryandesign:

Replying to RJVB: I believe that's correct. I suppose it could be changed to use MacPorts git/svn if available, for a hypothetical situation in which the copy found or specified at MacPorts configure time is not sufficient.

Probably not so hypothetical for users of older OS versions that install prebuilt binaries. And supposing they do build from source: doesn't the MacPorts configure script attempt NOT to find dependencies under $prefix?

Note: See TracTickets for help on using tickets.