Bug 208083 - Use pkg install to install port dependencies
Summary: Use pkg install to install port dependencies
Status: Closed Not Accepted
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Ports Framework (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Port Management Team
URL:
Keywords:
: 198881 (view as bug list)
Depends on:
Blocks:
 
Reported: 2016-03-17 12:13 UTC by Max Khon
Modified: 2017-09-18 16:50 UTC (History)
2 users (show)

See Also:


Attachments
USE_PACKAGE_DEPENDS_REPO=yes support (3.58 KB, patch)
2016-03-17 12:13 UTC, Max Khon
no flags Details | Diff
Updated patch - run port build if "pkg install" fails (3.70 KB, patch)
2017-09-08 18:26 UTC, Max Khon
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Max Khon freebsd_committer freebsd_triage 2016-03-17 12:13:12 UTC
Created attachment 168317 [details]
USE_PACKAGE_DEPENDS_REPO=yes support

Attached patch implements USE_PACKAGE_DEPENDS_REPO=yes switch to install port dependencies (during build) using 'pkg install'
Comment 1 Mathieu Arnold freebsd_committer freebsd_triage 2016-03-17 18:00:15 UTC
You can run pkg install devel/m4, it'll work, no need to go and get a pkgname, I think.
Comment 2 Mathieu Arnold freebsd_committer freebsd_triage 2016-03-21 15:34:23 UTC
I see you're adding SU_CMD around, but you're not mentioning it in the patch description, any reason for it ?
Comment 3 Baptiste Daroussin freebsd_committer freebsd_triage 2016-03-21 16:54:36 UTC
(In reply to Mathieu Arnold from comment #1)
Yes there is a reason to get pkgname and not origin: allow to install multiple variant of the same origin: think py27-bla py35-bla or if one the subpackages are for real implemented: bla-libs bla

so we should everywhere stop relying on origin (yes I know poudrière for now still rely on origin)
Comment 4 Mathieu Arnold freebsd_committer freebsd_triage 2016-03-21 17:20:05 UTC
(In reply to Baptiste Daroussin from comment #3)
> (In reply to Mathieu Arnold from comment #1)
> Yes there is a reason to get pkgname and not origin: allow to install
> multiple variant of the same origin: think py27-bla py35-bla or if one the
> subpackages are for real implemented: bla-libs bla
> 
> so we should everywhere stop relying on origin (yes I know poudrière for now
> still rely on origin)

Yes, I thing is, we don't need pkgname, we already have pkgbase in there. My current work on this:

https://github.com/mat813/freebsd-ports/compare/trunk...pkg-depends
Comment 5 Baptiste Daroussin freebsd_committer freebsd_triage 2016-03-21 17:41:40 UTC
pkgbase is ok but in any case one should test the version (compared to the one in ports) and the option (making sure the remote on as the same options sets used/activated as the port) before installing
Comment 6 Mathieu Arnold freebsd_committer freebsd_triage 2016-03-21 18:07:14 UTC
Well, I assume that if someone wants to use distant packages, he doesn't care about version or options, he just wants it there.
Comment 7 Max Khon freebsd_committer freebsd_triage 2016-03-22 12:45:39 UTC
(In reply to Mathieu Arnold from comment #2)
Oh, yes, I also added SU_CMD support to fix non-root builds. I forgot to mention that in the initial submission.
Comment 8 Mathieu Arnold freebsd_committer freebsd_triage 2016-03-22 12:56:21 UTC
On the other hand, if you already have a dependency of a package being installed with different options, it'll be reinstalled with the remote version, possibly breaking things locally.
Comment 9 Mathieu Arnold freebsd_committer freebsd_triage 2016-04-13 11:31:43 UTC
*** Bug 198881 has been marked as a duplicate of this bug. ***
Comment 10 Mathieu Arnold freebsd_committer freebsd_triage 2016-09-08 14:14:56 UTC
USE_PACKAGE_DEPENDS_REPO could not work, you could not know if the package you 
download have the right version, or options.

The closest thing I can see is to run something along the lines of: pkg install 
-A `make missing`
Comment 11 David Naylor freebsd_committer freebsd_triage 2016-09-08 17:18:58 UTC
@mat: I must disagree.  I have found this option to be very useful for test building ports (without having to compile dependencies).  This is effectively adding the "install from pkg repo" that poudriere does into the Ports Framework.  

To address the issues you raised:
 - Correct version: this risk is already in the Ports tree (i.e. if someone updates select ports in the tree - an "unsupported" state however).  Also, given that the official repo is at most 7 days behind the Ports tree the risk is minimal.
 - Correct options: this risk is already in the Ports tree (i.e. unless you chose the correct options you are stuck with the defaults).  The offical repo does ship with the default options, so for most uses it is fine.  Also, testing that the port builds against the default options is not a bad thing.  

Please note that both the issues you raise are also an issue if the user simply "manually" installs the dependencies instead of building from ports.  If this is a stopper for this feature then I submit that it is also a stopper for (a) USE_PACKAGE_DEPENDS and for building in a "dirty" environment (like many people do).  

Lastly, I contest the wording of "could".  I have successfully used this option and I submit most use cases *will* work, although some use cases *may* not work.
Comment 12 Max Khon freebsd_committer freebsd_triage 2017-09-08 18:26:26 UTC
Created attachment 186176 [details]
Updated patch - run port build if "pkg install" fails
Comment 13 David Naylor freebsd_committer freebsd_triage 2017-09-18 16:50:57 UTC
Thanks Max, I'm currently working off a laptop and this makes my life much easier.