Bug 225654

Summary: ports-mgmt/portlint: Please add checks for flavors and python dependencies
Product: Ports & Packages Reporter: Yuri Victorovich <yuri>
Component: Individual Port(s)Assignee: Joe Marcus Clarke <marcus>
Status: Closed FIXED    
Severity: Affects Only Me CC: koobs
Priority: --- Flags: bugzilla: maintainer-feedback? (marcus)
Version: Latest   
Hardware: Any   
OS: Any   

Description Yuri Victorovich freebsd_committer freebsd_triage 2018-02-03 22:04:41 UTC
Python ports that don't have USE_PYTHON=noflavors should require all py-* dependencies to have @${FLAVOR}.

Python ports that do have USE_PYTHON=noflavors should require all py-* dependencies to have @${PY_FLAVOR}.

Non-python ports should require all py-* dependencies to have @${PY_FLAVOR}.
Comment 1 Antoine Brodin freebsd_committer freebsd_triage 2018-02-03 22:09:05 UTC
hmm, the request is not correct.

In some cases,  you want the default flavor as a dependency which is different from ${FLAVOR} and ${PY_FLAVOR}.
Comment 2 Antoine Brodin freebsd_committer freebsd_triage 2018-02-03 22:09:57 UTC
(default flavor = no @something at all)
Comment 3 Yuri Victorovich freebsd_committer freebsd_triage 2018-02-03 22:15:42 UTC
(In reply to Antoine Brodin from comment #2)

For python dependencies? Can python ports have any other flavors than pyNN?
Comment 4 Joe Marcus Clarke freebsd_committer freebsd_triage 2018-02-18 20:15:15 UTC
I'm not sure what the ask is here, nor is it clear that something really needs to be done.  Please be specific (examples of messages along with ports that do the wrong thing would be very much appreciated) as possible when asking for things like this in the future.
Comment 5 Yuri Victorovich freebsd_committer freebsd_triage 2018-02-18 21:25:39 UTC
Since recent flavors commit, portlint has to check for flavor specifiers in python ports.

Basic testcase:
1. cd devel/py-bandit
2. Remove @${FLAVOR}
3. "portlint -C" doesn't complain. It has to say "py-xx" dependency without @${FLAVOR}

In case a python port has USE_PYTHON=noflavors, or in case the port isn't a python port, @${PY_FLAVOR} has to be specified in py-xx dependencies.
Comment 6 Yuri Victorovich freebsd_committer freebsd_triage 2018-02-18 21:31:37 UTC
In short:
Every py-xx dependency of any port has to have a flavor specifier.
It should be @${FLAVOR} in python ports without USE_PYTHON=noflavors
It should be @${PY_FLAVOR} otherwise.
Comment 7 Joe Marcus Clarke freebsd_committer freebsd_triage 2018-05-11 21:24:09 UTC
Check add to my repo pending the next release.
Comment 8 Joe Marcus Clarke freebsd_committer freebsd_triage 2018-05-11 21:34:35 UTC
Added to 2.18.0.
Comment 9 Antoine Brodin freebsd_committer freebsd_triage 2018-05-11 21:45:09 UTC
Why was this committed when I objected in comment #1 ?
Comment 10 Antoine Brodin freebsd_committer freebsd_triage 2018-05-11 22:03:36 UTC
Please revert the "Add a check to make sure Python dependencies include a FLAVOR [9]",  I anticipate breaking changes due to this portlint error.
Comment 11 Joe Marcus Clarke freebsd_committer freebsd_triage 2018-05-11 22:05:31 UTC
I didn't see your comment as the replies to my initial question came in after it.  Why was this PR not just closed if it is wrong?
Comment 12 Antoine Brodin freebsd_committer freebsd_triage 2018-05-11 22:07:19 UTC
It was closed in comment #4 ...
Comment 13 Joe Marcus Clarke freebsd_committer freebsd_triage 2018-05-11 22:08:38 UTC
But re-opened in comment #5, which is why I still had it in my todo list (and assumed it was still valid).  Ugh.
Comment 14 Joe Marcus Clarke freebsd_committer freebsd_triage 2018-05-11 22:10:25 UTC
Yuri, why did you re-open this when it was rejected?  I don't want to play ping pong with this PR back and forth.  So can you both agree what is needed here?  Is it a full revert, or is there a way to take this forward?
Comment 15 Joe Marcus Clarke freebsd_committer freebsd_triage 2018-05-11 22:10:52 UTC
Re-opening to track next steps.
Comment 16 Antoine Brodin freebsd_committer freebsd_triage 2018-05-11 22:28:25 UTC
(In reply to Joe Marcus Clarke from comment #15)
Either full revert or turn it from an error to a possible warning (FATAL -> WARN and must -> may)
Comment 17 commit-hook freebsd_committer freebsd_triage 2018-05-12 18:59:42 UTC
A commit references this bug:

Author: marcus
Date: Sat May 12 18:59:08 UTC 2018
New revision: 469754
URL: https://svnweb.freebsd.org/changeset/ports/469754

Log:
  Bump version to 2.18.1.

  Soften the py-* dependency error around flavors.

  Now the message is a warning and a suggestion. This is pending more discussion,
  but this seems like a good compromise for now.

  PR:		225654
  Requested by:	antoine

Changes:
  head/ports-mgmt/portlint/Makefile
  head/ports-mgmt/portlint/src/portlint.pl
Comment 18 Joe Marcus Clarke freebsd_committer freebsd_triage 2018-05-12 18:59:59 UTC
I have updated portlint to soften the error to a warning pending final consensus.
Comment 19 Kubilay Kocak freebsd_committer freebsd_triage 2018-06-09 05:54:50 UTC
Please remove (or disable) the check entirely, as it is currently providing incorrect/ambiguous information in a few ways for entirely correct dependency lines, such as:

py-tox:

RUN_DEPENDS=    ${PYTHON_PKGNAMEPREFIX}py>=1.4.17:devel/py-py@${PY_FLAVOR} \
                ${PYTHON_PKGNAMEPREFIX}pluggy>=0.3.0:devel/py-pluggy@${PY_FLAVOR} \
                ${PYTHON_PKGNAMEPREFIX}six>0:devel/py-six@${PY_FLAVOR} \
                ${PYTHON_PKGNAMEPREFIX}virtualenv>=1.11.2:devel/py-virtualenv@${PY_FLAVOR}

WARN: Makefile: you may want directory for dependency ${PYTHON_PKGNAMEPREFIX}py>=1.4.17 to be devel/py-py:@${FLAVOR}
WARN: Makefile: you may want directory for dependency ${PYTHON_PKGNAMEPREFIX}pluggy>=0.3.0 to be devel/py-pluggy:@${FLAVOR}
WARN: Makefile: you may want directory for dependency ${PYTHON_PKGNAMEPREFIX}six>0 to be devel/py-six:@${FLAVOR}
WARN: Makefile: you may want directory for dependency ${PYTHON_PKGNAMEPREFIX}virtualenv>=1.11.2 to be devel/py-virtualenv:@${FLAVOR}


* Suggests an incorrect syntax: "cat/port:@flavor" (the : is incorrect).

It was perhaps a typo meant to be ":cat/port@flavor", but even if that was the case, the : is still unnecessary to display as the : is part of the known and separate dependency tuple syntax anyway.

* Suggests FLAVOR incorrectly, should be PY_FLAVOR for python ports [1], at least in the current state.

[1] PY_FLAVOR is available to depend on the correct version of Python modules. All dependencies on flavored Python ports should use PY_FLAVOR, and not FLAVOR directly.. (from Porters Handbook)

As of right now, the check should remain disabled, unless and until the checks can be made completely accurate for all cases (flavors, noflavors), with no chance for false positives, which is just not possible at the moment given the state of flavor support:

- overlap//conflict between generic port flavouring & python flavouring
- the fact that ports currently must explicitly append flavours to origins versus have them implicitly added/modified via python.mk
Comment 20 Joe Marcus Clarke freebsd_committer freebsd_triage 2018-09-05 16:33:57 UTC
The fix for this has been in the tree for a while, and I have not heard any more negative comments.  I'm considering this closed.

Please open a new PR if there is still undesired behavior.