Page MenuHomeFreeBSD

ports-mgmt/porttree: Port tests, USE_PYTHON=optsuffix
AbandonedPublic

Authored by Vladimir.Chukharev_gmail.com on Feb 12 2019, 6:52 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Jun 26, 6:20 PM
Unknown Object (File)
May 8 2024, 12:21 AM
Unknown Object (File)
May 8 2024, 12:21 AM
Unknown Object (File)
May 8 2024, 12:21 AM
Unknown Object (File)
May 7 2024, 11:30 PM
Unknown Object (File)
Feb 16 2024, 5:32 PM
Unknown Object (File)
Feb 1 2024, 1:39 AM
Unknown Object (File)
Dec 22 2023, 10:48 PM
Subscribers

Details

Reviewers
None
Group Reviewers
Python
Summary

This is a simple update of a port, just an update to version 1.0.
Additionally to other things inside the new version, I made two changes in
the port itself. I could not find answers for some questions about them,
so I ask here.

  1. The port uses Python. It works with Python 2.7 and 3.6. But it depends on

two libraries flavored for py27 and py3*. Previously, I used in Makefile
USE_PYTHON=optsuffix. Now this is deprecated, as also is PYTHON_PKGNAMESUFFIX.
Is defining PKGNAMESUFFIX=-py${PYTHON_SUFFIX} a correct way to get rid of
optsuffix?

I noticed that an update of the optsuffix version to PKGNAMESUFFIX one
with portmaster leads to the following error.

...
====> Running Q/A tests (stage-qa)
===>  Installing for porttree-py27-1.0.r99
===>  Checking if porttree-py27 already installed
===>   Registering installation for porttree-py27-1.0.r99
Installing porttree-py27-1.0.r99...
pkg-static: porttree-py27-1.0.r99 conflicts with porttree-1.0.r99 (installs files into the same place).  Problematic file: /usr/local/bin/porttree
*** Error code 70

Stop.
make: stopped in /usr/ports/ports-mgmt/porttree

===>>> Installation of porttree-py27-1.0.r99 (ports-mgmt/porttree) failed
===>>> Aborting update

Surely, this is easily fixed by 'sudo pkg delete porttree-1.0.r99' and
reinstalling with portmaster.
Does this need mentioning in UPDATING?

  1. I added some tests to the port. Is it OK to run the tests from ${WRKSRC}

or should I first install them to ${STAGEDIR} and run from there?

BTW, in src it's porttree.py, and in stage it's just porttree.
Does this make difference?

The tests create a temp file (cache) in /tmp (and delete it on exit or
interrupt). Is this acceptable?

Test Plan

$ ( cd /usr/ports/ports-mgmt/porttree ; DEVELOPER=yes portlint -Ca )
looks fine.
Builds alright in poudriere and portmaster for flavors py27 and py36.

Diff Detail

Repository
rP FreeBSD ports repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

optsuffix was added because I did not want to have to decide if all those ports that kinda used python but did not have PYTHON_PKGNAME/PRE/SUF/FIX in them needed flavors or not.

Here, it looks like it is not a Python "module"/"library" but a script, which does not require flavors, running it with the default Python version is just fine. It would probably be better to remove the Python flavoring.

ports-mgmt/porttree/Makefile
8

${PYTHON_PKGNAMESUFFIX}

14–15

Why +=?

16–17

Why +=?

I'm sure I tried to remove flavors, and failed with dependence specification. Then I had problems with same name of pkgnames for flavors.
The first was rather long time ago, and the second, not so long, few months ago. Good progress!
Would be nice to have in Poter's Handbook up-to-date recommendations for flavors for Python...

Thanks a lot for nice review, mat!

ports-mgmt/porttree/Makefile
8

It seems being deprecated:
$ fgrep -r -A2 "PYTHON_PKGNAMESUFFIX" /usr/ports/Mk | fgrep -i deprecated -1
/usr/ports/Mk/Uses/python.mk:# PYTHON_PKGNAMESUFFIX
/usr/ports/Mk/Uses/python.mk-# - Deprecated, use PYTHON_PKGNAMEPREFIX instead
/usr/ports/Mk/Uses/python.mk-# default: -py${PYTHON_SUFFIX}

linimon retitled this revision from Port tests, USE_PYTHON=optsuffix to ports-mgmt/porttree: Port tests, USE_PYTHON=optsuffix.Feb 16 2019, 11:19 AM

Shell I submit a PR to Bugzilla? Or will it be committed directly from here? Provided no more questions arise, of course.

My question about tests is not commented yet. What is current best practices, is it better to test the installed program, enough to test the patched sources, or staged software?

sunpoet added inline comments.
ports-mgmt/porttree/Makefile
8

Add PKGNAMESUFFIX=${PYTHON_PKGNAMESUFFIX} here.

Instead of optsuffix, it is recommended to add suffix unconditionally.

16–18

IMHO, you could remove it for 2 reasons:

  • Setting FETCH_DEPENDS is no-op because fetch is not the prerequisite of gen-dist:. It does not help install subversion if it's not installed.
  • Since gen-dist: is a personal target mainly used by the maintainer, it should be enough with a comment (for others to read).

I would suggest to put all maintainer stuff at the end of Makefile, see sysutils/moreutils/Makefile.

42

Just write "do-test:".
stage is the prerequisite of test which is defined in Mk/bsd.port.mk by _TEST_DEP=stage.

Vladimir.Chukharev_gmail.com added inline comments.
ports-mgmt/porttree/Makefile
8

Yes, I understood from mat's comment, that I can use this line. I tested the port with it, all my tests passed. But I'd like to understand the deprecation comment in /usr/ports/Mk/Uses/python.mk. Is it valid?

Later on, I removed flavors completely. This line is not necessary without flavors. Some of *FLAVOR* variables are available now even without flavors (at early period of flavors development this was not the case, IIRC). The updated version also passes all my tests.

Please, could you comment on these:

  1. deprecation of PYTHON_PKGNAMESUFFIX
  2. do I need to use the line you suggest even without USE_PYTHON=flavors? (distutils is not used, either)
16–18

Thanks for catching this!

ports-mgmt/porttree/Makefile
8

PYTHON_PKGNAMESUFFIX is not deprecated. I'll remove the deprecation message from python.mk.

You need to set USE_PYTHON=flavors explicitly if USE_PYTHON=distutils is not used because distutils implies flavors.

18–19

I think SVNROOT is part of the maintainer section.

I moved 'SVNROOT?=...' to the maintainer section.

Few of my questions are still unanswered.

  1. Do I need to submit a Bugzilla PR when all issues raised here in Fabricator will be resolved, or a committer will use the patch from here?
  2. Does a package need to define PKGNAMESUFFIX? The port itself does not need it, it installs same files for all flavors. It uses '@${PY-FLAVOR}' for all depends to build correct flavors of them. In this case, all depends have ${PYTHON_PKGNAMEPREFIX}, thus, the checks of installed depends will anyway be correct. I started to use optsuffix when I got a warning that different flavor package names clash. This is not a problem any more. Still I want to understand if all the needed information will be stored in the package of port P1, for the case, when P1 depends on P2, P2 depends on P3 , P1 and P2 do not anyhow use flavors, while P3 does use flavors? And how a dependence on P2 should be written in P1?
  3. Is a notice in UPDATING needed (see details in Summary)?
  4. Any comments on testing (see question 2 in Summary)?