Bug 240006 - portmaster fails to build security/rubygem-acme-client: wrong order of installing requisite packages
Summary: portmaster fails to build security/rubygem-acme-client: wrong order of instal...
Status: Closed Works As Intended
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: Stefan Eßer
Keywords: needs-patch, needs-qa
Depends on:
Reported: 2019-08-21 03:39 UTC by Koichiro Iwao
Modified: 2020-01-25 22:04 UTC (History)
4 users (show)

See Also:
bugzilla: maintainer-feedback? (se)

portmaster-fail.log (4.45 KB, text/plain)
2019-08-21 14:45 UTC, Koichiro Iwao
no flags Details
portmaster-fail.log (4.45 KB, text/plain)
2019-08-21 14:54 UTC, Koichiro Iwao
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Koichiro Iwao freebsd_committer 2019-08-21 03:39:32 UTC
I'll work on this but just for the record.

====> Compressing man pages (compress-man)
====> Running Q/A tests (stage-qa)
Error: RubyGem dependency faraday ~> 0.9 is not satisfied.
Error: RubyGem dependency faraday >= 0.9.1 is not satisfied.
*** Error code 1

make: stopped in /home/meta/FreeBSD/ports/head/security/rubygem-acme-client

===>>> make stage failed for security/rubygem-acme-client
===>>> Aborting update

===>>> You can restart from the point of failure with this command line:
       portmaster <flags> security/rubygem-acme-client www/rubygem-faraday www/rubygem-multipart-post

This command has been saved to /tmp/portmasterfail.txt
Comment 1 Koichiro Iwao freebsd_committer 2019-08-21 06:40:25 UTC
After quick test, loosening version pin looks working fine with current version of faraday 0.15.4 in ports tree.

Reported to upstream: https://github.com/unixcharles/acme-client/issues/164
Comment 2 Sunpoet Po-Chuan Hsieh freebsd_committer 2019-08-21 12:32:53 UTC
faraday 0.15.4 satisfies both "~> 0.9" and ">= 0.9.1".
And I cannot reproduce this failure using "poudriere -t". 

Could you please check again that your ports tree is unmodified as follows:
- security/rubygem-acme-client 2.0.3
- www/rubygem-faraday 0.15.4
Comment 3 Koichiro Iwao freebsd_committer 2019-08-21 13:31:16 UTC
(In reply to Sunpoet Po-Chuan Hsieh from comment #2)

I found the repro. It might be a portmaster bug. The ports tree is not modified at all.

1. make sure rubygem-acme-client and rubygem-faraday not intalled)
2. portmaster -d security/rubygem-acme-client 
3. got comment #0

Worrkaround: install rubygem-faraday first, then install rubygem-acme-client

1. portmaster -d www/rubygem-faraday
2. portmaster -d security/rubygem-acme-client
3. rubygem-acme-client will be installed successfully

Alternatively, adding "-t" option to portmaster goes well.

portmaster -t -d security/rubygem-faraday
====> Compressing man pages (compress-man)
====> Running Q/A tests (stage-qa)
===>  Installing for rubygem-acme-client-2.0.3
===>  Checking if rubygem-acme-client is already installed
===>   Registering installation for rubygem-acme-client-2.0.3
Installing rubygem-acme-client-2.0.3...

===>>> Creating a package for new version rubygem-acme-client-2.0.3
	===>>> Package saved to /usr/ports/packages/All

===>>> Waiting for background 'make clean' processes to finish

===>>> The following actions were performed:
	Installation of www/rubygem-faraday (rubygem-faraday-0.15.4)
	Installation of security/rubygem-acme-client (rubygem-acme-client-2.0.3)

Of course, not using portmaster goes well too.

make -C /usr/ports/security/rubygem-acme-client install
Comment 4 Sunpoet Po-Chuan Hsieh freebsd_committer 2019-08-21 13:41:36 UTC
Oh, I do not use portmaster.
You could change Summary and assign this PR to maintainer of portmaster. :)
Comment 5 Koichiro Iwao freebsd_committer 2019-08-21 14:45:03 UTC
Created attachment 206752 [details]

This is the full log of failure.
Comment 6 Koichiro Iwao freebsd_committer 2019-08-21 14:54:35 UTC
Created attachment 206753 [details]

The previous log doesn't include some logs written to stderr.
Comment 7 Walter Schwarzenfeld freebsd_triage 2019-08-21 15:42:37 UTC
/usr/ports/Mk/Uses/gem.mk needs:

Comment 8 Stefan Eßer freebsd_committer 2020-01-25 22:04:43 UTC
Sorry for the late reply - apparently I do no longer get a notification by mail when a PR is assigned to me.

The information given by Walter Schwarzenfeld in Comment 7 is correct:

Some ports have dependencies that are declared as run dependencies, but which are in fact required to install a port. This is possible in the "plain" ports system, since it implements recursion into run dependencies before installing the port being requested. I.e. the building and installation of run dependencies is injected between building and installing the requested port. I consider this an artefact of the implementation of the ports system in "make", which cannot provide a different order: when the requested port has been installed the trigger for the installation of run dependencies is lost - if you interrupt the process at that time, the requested port has been installed and the missing run dependencies will be ignored.

Portmaster processes always just one port from begin to end, it knows to update or install build dependencies before the port needing them, run dependencies afterwards, and it will detect missing run dependencies even if the build process is interrupted between installation of the port and its run dependencies.

A different treatment of run dependencies in portmaster is possible, but will lead to dependency cycles, since run dependencies may themselves depend on the port being worked being installed. If all run dependencies were treated like build dependencies, then these cycles will prevent building of either of them.

Those ports that need run dependencies being available before the port depending on them has been installed have to declare them as build dependencies. If they are required for the build process to finish besides being run dependencies, then they need to be declared as both build and run dependencies.

That the plain ports system does not require them to be declared as build dependencies is caused by the tool used (make) which does not support a different order than is implemented, but that does not set a precedent for portmaster, IMHO.

Therefore, I'm going to close this PR - the fix is in the individual port that lacks a RUN_DEPENDS declaration.