Bug 240959 - sysutils/iocage[-devel]: add ability to choose git or git-lite via package options
Summary: sysutils/iocage[-devel]: add ability to choose git or git-lite via package op...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Marcelo Araujo
Depends on:
Reported: 2019-10-01 05:45 UTC by Marcelo Araujo
Modified: 2019-10-21 07:15 UTC (History)
5 users (show)

See Also:
dvl: maintainer-feedback+

Fix git-lite RUN_DEPENDS (675 bytes, patch)
2019-10-01 05:45 UTC, Marcelo Araujo
no flags Details | Diff
a patch to add ability to choose git providing package in options (1.39 KB, patch)
2019-10-04 18:07 UTC, burnerbox
burnerbox: maintainer-approval?
Details | Diff
patch for iocage-devel adding options radio-button switching dependency from git to git-lite (1.48 KB, patch)
2019-10-04 20:11 UTC, burnerbox
burnerbox: maintainer-approval?
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Marcelo Araujo freebsd_committer 2019-10-01 05:45:45 UTC
Created attachment 207976 [details]
Fix git-lite RUN_DEPENDS

We don't need directly install git-lite, the port will also work fine with git, so we can check if there is the binary git, if not, we then can install git-lite.
Comment 1 Dan Langille freebsd_committer 2019-10-01 13:13:16 UTC
This doesn't fix it:

[dan@empty:~] $ pkg info -x git

[dan@empty:~] $ sudo pkg install -y py36-iocage-devel

[dan@empty:~] $ pkg info -x git
Comment 2 Dan Langille freebsd_committer 2019-10-01 13:14:26 UTC
(In reply to Dan Langille from comment #1)
Sorry, wrong pasting, let me try this again.
Comment 3 Dan Langille freebsd_committer 2019-10-01 13:16:03 UTC
(In reply to Dan Langille from comment #2)

[dan@empty:~] $ pkg info -x git iocage
pkg: No package(s) matching iocage
[dan@empty:~] $ 

[dan@empty:~] $ sudo pkg install -y py36-iocage-devel-,1

[dan@empty:~] $ pkg info -x git iocage
[dan@empty:~] $
Comment 4 Sascha Holzleiter 2019-10-03 15:33:54 UTC
This doesn't work if the package is build with poudriere.

Because it is build in a clean environment there is no git binary detected and it always depends on git-lite. If you have other ports depending on devel/git you get conflicts when installing these packages. Here an example with iocage and portshaker:

# pkg install portshaker-1.0.18
Updating buildhost repository catalogue...
buildhost repository is up to date.
All repositories are up to date.
Checking integrity... done (1 conflicting)
  - git-2.23.0 conflicts with git-lite-2.23.0 on /usr/local/bin/git
Checking integrity... done (0 conflicting)
The following 4 package(s) will be affected (of 0 checked):

Installed packages to be REMOVED:

New packages to be INSTALLED:
        portshaker: 1.0.18
        git: 2.23.0
Comment 5 Dan Langille freebsd_committer 2019-10-03 15:35:08 UTC
Are you saying this will only help systems which contains packages not build with poudirere?
Comment 6 Dan Langille freebsd_committer 2019-10-03 15:37:50 UTC
(In reply to Dan Langille from comment #5)
I will try English this time.

Are you saying the proposed change will only help on systems if they have packages not built with poudriere?

If so, perhaps we should provide a compile time option for git/git-lite.
Comment 7 Sascha Holzleiter 2019-10-03 16:28:51 UTC
I don't see how it can work. Each package is build in its own environment with only the dependencies added that are defined by the port. So this will always install git-lite and use it as a dependency for the created package.
Comment 8 burnerbox 2019-10-04 18:07:59 UTC
Created attachment 208096 [details]
a patch to add ability to choose git providing package in options
Comment 9 Dan Langille freebsd_committer 2019-10-04 18:42:55 UTC
(In reply to burnerbox from comment #8)

Thank you for your patch. I see two things:

1 - it bumps PORTVERSION. There is no iocage 1.3 yet - I think you meant to bump PORTREVSION

2 - your patch is for iocage, whereas we are talking about iocage-devel here. - did you mean that?
Comment 10 burnerbox 2019-10-04 20:08:12 UTC
(In reply to Dan Langille from comment #9)

1 The PORTVERSION bump is a typo, your guess is correct.

2 The patch is for iocage, not iocage-devel, the problem there is the same. Will provide patch for iocage-devel in a minute.
Comment 11 burnerbox 2019-10-04 20:11:49 UTC
Created attachment 208101 [details]
patch for iocage-devel adding options radio-button switching dependency from git to git-lite
Comment 12 burnerbox 2019-10-04 20:13:21 UTC
I am new to FreeBSD and OSS collaboration in general, so please excuse and guide me if i posted the patch wrongly formated or made any other procedural mistakes.

Spent an evening trying to solve this properly. And by that i mean there surely must be a way to make the package depend on a "capability". Like an existence of a file or availability of an executable. Not sure if these two examples cover all the cases, but you can do that in ports. It took me a while to get so desperate with debugging why this doesn't work with pkg that i resorted to gutting the package created by my poudriere instance. And there I found that YAML describing the package just doesn't have that info.

O-ok... Maybe I don't understand something and this is made on purpose. Abstractions and all that hip stuff. Then there should be a way to list packages that will suffice, right? Nah, sleepless night turns morning, porters handbook, scarce documentation of pkg(suspiciously smelling of 2010, ma-aybe 2014) and mailing list searching(if anyone has any guide or directions on how to do this effectively, i will very appreciate it) turned up some mentions of "variable dependencies" as some promised land in the future and some poor sods from 2016 with sasl samba dilemma(https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=215642).
So the answer is no. Pkg behaves differently from ports, live with it.

Are my findings correct or am i missing something?
Comment 13 Sascha Holzleiter 2019-10-04 22:02:56 UTC
Seems to me you got it down right. Ports/pkgs are depending on other ports/packages, not files which these provide. So you cannot depend  on e.g. the git binary but you have to choose the port that provides this dependency at build time.

I'm no ports expert myself but what might work is if the git-lite port was just a flavour of the git port instead of a slave port. Then one could depend just on devel/git and let the user select the flavour in their poudriere make.conf file. As said this is untested and just an idea, maybe asking on the ports mailing list might bring a solution.
Comment 14 Marcelo Araujo freebsd_committer 2019-10-07 08:52:21 UTC
(In reply to Sascha Holzleiter from comment #13)

Thanks guys for the patch, I'm in holidays!!!
I'm testing the patch proposed and I think that is the right direction, I'm still on vacation anyway. I'm gonna try to open a review just for other folks chime in and give their opinion.

Thanks again folks.

@dvl if you don't mind, I will take over this PR.

Best Regards,
Comment 15 Marcelo Araujo freebsd_committer 2019-10-07 08:53:03 UTC
I'm taking over this PR! I'm testing the proposed patch on sysutils/iocage.
Comment 16 Dan Langille freebsd_committer 2019-10-07 12:29:15 UTC
(In reply to burnerbox from comment #12)
burnerbox - you did very well.
Comment 17 Dan Langille freebsd_committer 2019-10-07 12:29:42 UTC
(In reply to Marcelo Araujo from comment #14)
Sure, please proceed.
Comment 18 commit-hook freebsd_committer 2019-10-21 06:25:25 UTC
A commit references this bug:

Author: araujo
Date: Mon Oct 21 06:24:49 UTC 2019
New revision: 515084
URL: https://svnweb.freebsd.org/changeset/ports/515084

  - Fix git/git-lite dependencies as well as leftover EGG files.
  - Now the port pass "poudriere testport".

  PR:		240959 (based on)
  Submitted by:	burnerbox <burnerbox_protonmail.com>
  		Sascha Holzleiter <sascha_root-login.org>
  Reported by:	many
  Reviewed by:	romain
  Differential Revision:	https://reviews.freebsd.org/D21929

Comment 19 commit-hook freebsd_committer 2019-10-21 07:13:30 UTC
A commit references this bug:

Author: araujo
Date: Mon Oct 21 07:13:24 UTC 2019
New revision: 515086
URL: https://svnweb.freebsd.org/changeset/ports/515086

  - Fix git/git-lite dependencies.
  - Fix "poudriere testport".
  - Pet portlint.

  PR:		240959 (based on)
  Submitted by:	burnerbox <burnerbox_protonmail.com>
  		Sascha Holzleiter <sascha_root-login.org>
  Approved by:	dvl (maintainer)

Comment 20 Marcelo Araujo freebsd_committer 2019-10-21 07:15:33 UTC
Thank you all!!!!