Bug 229630 - rubygem update fails with portmaster caused of wrong order of build (missing build depends in rubygem ports)
Summary: rubygem update fails with portmaster caused of wrong order of build (missing ...
Status: Open
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: freebsd-ruby (Nobody)
Depends on:
Reported: 2018-07-09 09:17 UTC by Walter Schwarzenfeld
Modified: 2020-01-25 23:14 UTC (History)
3 users (show)

See Also:

make-stage.log (5.87 KB, text/plain)
2019-08-22 00:20 UTC, Koichiro Iwao
no flags Details
svn-diff-portmaster (14.45 KB, patch)
2019-08-22 09:43 UTC, Walter Schwarzenfeld
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Walter Schwarzenfeld freebsd_triage 2018-07-09 09:17:18 UTC

rubygem update fails with portmaster caused of wrong order of build.
Seems the rubygem needs the same build depends as run depends.

Comment 1 Walter Schwarzenfeld freebsd_triage 2018-07-09 09:28:27 UTC
I don't know how much ports effected. But most needed for:

may be also for
Comment 2 Stefan Eßer freebsd_committer 2018-07-11 12:41:09 UTC
The RUN_DEPENDS list is for dependencies that need not be available or up-to-date during a port build, but only to execute the applications in this port (e.g. shells, interpreters). These lead to dependencies recorded in the package built from a port. If the port is manually installed, then run dependencies are checked in the install phase (after the port has been built and staged).

Pure run dependencies need not be available when some port is built. Dependencies that are required to build a port are either BUILD_DEPENDS (if the test is for the existence of some binary, e.g. a compiler) or LIB_DEPENDS.
These are made available (and upgraded by portmaster, if applicable) before port that depends on them is built.

Since the rubygem ports declare their dependencies as RUN_DEPENDS only, it is correct to assume that they need by updated before the dependent port is built.

Therefore, the actual problem is that there are dependencies on shared libraries, which are wrongly declared as run dependencies.

The relevant excerpts from bsd.port.mk (somewhat sanitized for easier reading) are:


A list of "path:dir[:target]" tuples of other ports this 
package depends to run.  The test done to determine
the existence of the dependency is the same as
FETCH_DEPENDS.  This will be checked during the
"install" stage and the name of the dependency will
be put into the package as well. [...]


A list of "lib:dir[:target]" tuples of other ports this
package depends on.  "lib" is the name of a shared library.

For dependencies on shared libraries provided by other ports, it is sufficient to specify those ports in LIB_DEPENDS, this will imply that those libraries will be registered as run dependencies in the generated packages.

Examples of correct usage can also be found in many Uses/*.mk files.
Comment 3 Walter Schwarzenfeld freebsd_triage 2019-08-21 15:43:31 UTC
usr/ports/Mk/Uses/gem.mk needs:

Comment 4 Koichiro Iwao freebsd_committer 2019-08-21 23:45:32 UTC
BUILD_DEPENDS+=${RUN_DEPENDS} actually fixes the issue but I'm still not sure if it is the correct fix because the issue doesn't occur when `make install`.

I observed the difference between portmaster and make install, stage-qa is the point. Isn't stage-qa showing false-positive error?
Comment 5 Koichiro Iwao freebsd_committer 2019-08-22 00:20:06 UTC
Created attachment 206774 [details]

Hmm, not a bug of stage-qa itself. 

When installing rubygem-acme-client, make install perform installation with following order.

* build acme-client
* try to stage acme-client but faraday is not installed
* build faraday
* stage faraday
* stage-qa faraday
* install faraday
* stage acme-client
* stage-qa acme-client
* install acme-client

portmaster doesn't install faraday before staging. It is an order issue. I'm not sure why and where this order difference come from.
Comment 6 Walter Schwarzenfeld freebsd_triage 2019-08-22 05:55:48 UTC
You can insert -V RUN_DEPENDS in line 2314 in portmaster (it is then the same as ${BUILD_DEPENDS}+=${RUN_DEPENDS} in gem.mk)

2312                 all-depends-list|build-depends-list)
2313                         var_opt="$var_opt -V PKG_DEPENDS -V EXTRACT_DEPENDS \
2314                                 -V PATCH_DEPENDS -V FETCH_DEPENDS -V BUILD_DEPENDS \
2315                                 -V RUN_DEPENDS -V LIB_DEPENDS"
Comment 7 Koichiro Iwao freebsd_committer 2019-08-22 07:49:35 UTC
(In reply to Walter Schwarzenfeld from comment #6)
That's looks the correct fix to me. Stefan, what do you think about that?
Comment 8 Walter Schwarzenfeld freebsd_triage 2019-08-22 09:43:12 UTC
Created attachment 206783 [details]

Includes another small change for bug #235793.