Opened 17 years ago
Closed 15 years ago
#15161 closed enhancement (fixed)
depends_* should have more useful semantics
Reported by: | jmroot (Joshua Root) | Owned by: | macports-tickets@… |
---|---|---|---|
Priority: | Normal | Milestone: | MacPorts 1.8.0 |
Component: | base | Version: | 1.7.0 |
Keywords: | dependencies | Cc: | vinc17@…, ryandesign (Ryan Carsten Schmidt) |
Port: |
Description
The depends_lib, depends_build and depends_run dependency classes don't currently do what a typical new portfile author would expect. Presumably the different classes exist so that end users installing binaries can avoid installing ports that are only needed to build the port they are interested in, and not to run it. (Possibly also so that the build box that makes the binary can avoid installing ports that are only needed at runtime.) However, the actual behaviour is this (from the portfile(7) manual):
depends_build List of dependencies to check before build, destroot, install, and package targets. depends_run List of dependencies to check before destroot, install and package targets. depends_lib List of dependencies to check before configure, build, destroot, install, and package targets.
This seems to match up with what happens in mportdepends
in macports.tcl. The Guide gives the dep classes some additional meanings, e.g. "Build dependencies are needed when software is compiled, but not needed at all once the software is compiled and installed," but there appears to be nothing to back this up in the code.
The way the system currently works means that you can't avoid installing build-time-only dependencies when you install from a binary package. Even if that part worked, you still couldn't have deps that are needed at configure time but not at runtime (e.g. pkgconfig), because depends_build is not checked before configure.
I would suggest changing the meanings to the following:
- depends_lib: these dependencies must be present for all phases of port building and installation (fetch through to activate).
- depends_build: these dependencies must be present for fetch through to destroot. (Note that this adds the ability to use software from dependencies in the fetch, extract and patch phases, as required by e.g. python23.)
- depends_run: these dependencies are only needed when the port is installed. (and also for test?)
Attachments (2)
Change History (13)
comment:1 Changed 17 years ago by jmroot (Joshua Root)
comment:2 Changed 17 years ago by jmroot (Joshua Root)
It seems that there is one useful distinction made currently: depends_build deps are not added to the registry, so even though they get installed whether you're building the port or not, you can at least uninstall them afterwards without getting dependency errors.
I think that fully resolving this ticket will have to wait for the fabled dependency engine rewrite. For now, I propose making it possible to use depends_build stuff in the extract, patch and configure phases.
Changed 17 years ago by jmroot (Joshua Root)
Attachment: | depends-guide.diff added |
---|
patch for the guide
comment:3 follow-ups: 4 5 Changed 17 years ago by raimue (Rainer Müller)
There is a problem with your patch. You removed depends_lib
from the configure phase although it needs them at this stage. Most configure scripts check for existance of necessary libraries.
Is there are specific reason you excluded the fetch phase from your additions? I made ffmpeg use svn for fetching, so I think depends_build port:subversion
would be appropriate. But it would not be installed for the fetch phase with your proposed change as there are no dependencies for fetch.
comment:4 Changed 17 years ago by raimue (Rainer Müller)
Replying to raimue@macports.org:
There is a problem with your patch. You removed
depends_lib
from the configure phase although it needs them at this stage. Most configure scripts check for existance of necessary libraries.
Sorry for the noise, the patch is fine on this. I misread the fall-through "-".
comment:5 Changed 17 years ago by jmroot (Joshua Root)
Replying to raimue@macports.org:
Is there are specific reason you excluded the fetch phase from your additions? I made ffmpeg use svn for fetching, so I think
depends_build port:subversion
would be appropriate. But it would not be installed for the fetch phase with your proposed change as there are no dependencies for fetch.
No terribly convincing reason for excluding it. Just because phases before extract were ignored by the tracemode check, so I thought there might be a good reason for it. And also because it's sometimes convenient to be able to fetch a port without installing all its build deps. Although, come to think of it, that applies equally to extract. It may actually be better to have special dependency classes for fetch (automatically set by fetch.type) and extract, as suggested by Jordan on the ML. This would also help with #13981.
comment:6 follow-up: 10 Changed 16 years ago by jmroot (Joshua Root)
comment:7 Changed 16 years ago by raimue (Rainer Müller)
comment:9 Changed 16 years ago by ryandesign (Ryan Carsten Schmidt)
Cc: | ryandesign@… added |
---|
comment:10 Changed 16 years ago by ryandesign (Ryan Carsten Schmidt)
comment:11 Changed 15 years ago by jmroot (Joshua Root)
Milestone: | MacPorts Future → MacPorts 1.8.0 |
---|---|
Resolution: | → fixed |
Status: | new → closed |
Added depends_fetch and depends_extract in r51780. I'm going to call this fixed; we can revisit skipping fetch/extract/build deps when not needed when we start distributing binaries.
There is another deps check done by target_run in portutil.tcl, for trace mode. The two should be kept in sync.