Bug 290226 - how should py- ports set ETCDIR?
Summary: how should py- ports set ETCDIR?
Status: Open
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Ports Framework (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: FreeBSD Port Management Team (mail alias)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-10-14 12:01 UTC by Dan Langille
Modified: 2025-11-11 15:52 UTC (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dan Langille freebsd_committer freebsd_triage 2025-10-14 12:01:37 UTC
I have noticed that the default ETCDIR for sysutils/py-mqttwarn is:

[11:57 mydev dvl /usr/ports/sysutils/py-mqttwarn] % make -V ETCDIR         
/usr/local/etc/py311-mqttwarn


I expect this to not contain the Python prefix. There is not reason for this to be a Python-specific directory.

However, changing that default is awkward.

This doesn't work:

.include <bsd.port.pre.mk>
ETCDIR=${PREFIX}/etc/${PORTNAME}
.include <bsd.port.post.mk>

% make -V ETCDIR
/usr/local/etc/py311-mqttwarn


This does work:

.include <bsd.port.mk>

ETCDIR=${PREFIX}/etc/${PORTNAME}
% make -V ETCDIR
/usr/local/etc/mqttwarn

But makes portlint unhappy:

FATAL: Makefile: the last line of Makefile has to be .include <bsd.port(.post).mk> (or .endif in the case of a conditional)


I note a few major ports do take this last approach:

* sysutils/py-ansible-core
* sysutils/py-ansible-core219

Am I doing this wrong and I should be using the python-prefixed ETCDIR?
Is something else broken?

What's up please?
Comment 1 Vladimir Druzenko freebsd_committer freebsd_triage 2025-10-14 14:11:18 UTC
Did you tried:

ETCDIR=${PREFIX}/etc/${PORTNAME}

.include <bsd.port.pre.mk>

...

.include <bsd.port.post.mk>
?
Comment 2 Dan Langille freebsd_committer freebsd_triage 2025-10-14 15:09:56 UTC
(In reply to Vladimir Druzenko from comment #1)

No, but here that is:

[15:08 pkg01 dvl ~/ports/head/sysutils/py-mqttwarn] % make -V ETCDIR
/usr/local/etc/py311-mqttwarn
[15:08 pkg01 dvl ~/ports/head/sysutils/py-mqttwarn] % tail Makefile

ETCDIR=${PREFIX}/etc/${PORTNAME}

.include <bsd.port.pre.mk>
.include <bsd.port.post.mk>
Comment 3 Vladimir Druzenko freebsd_committer freebsd_triage 2025-10-14 15:20:58 UTC
(In reply to Dan Langille from comment #2)
Mk/Uses/uniquefiles.mk(90):
ETCDIR=         ${PREFIX}/etc/${UNIQUE_PREFIX}${PORTNAME}

Mk/Uses/python.mk(60):
#       concurrent      - Indicates that the port can be installed for
#                         different python versions at the same time. The port
#                         is supposed to use a unique prefix for certain
#                         directories using USES=uniquefiles:dirs (see the
#                         uniquefiles.mk Uses for details about the
#                         directories), if set to yes. Binaries receive an
#                         additional suffix, based on ${PYTHON_VER}.

This port can be installed on same host multiple times with different python versions.
Each instance have separate ETCDIR.
Comment 4 Dan Langille freebsd_committer freebsd_triage 2025-10-14 15:32:52 UTC
(In reply to Vladimir Druzenko from comment #3)
You win all the points.

[15:26 mydev dvl /usr/ports/sysutils/py-mqttwarn] % make -V ETCDIR   
/usr/local/etc/mqttwarn
[15:27 mydev dvl /usr/ports/sysutils/py-mqttwarn] % git diff    
diff --git a/sysutils/py-mqttwarn/Makefile b/sysutils/py-mqttwarn/Makefile
index 03829d2f1bba..c3bad17c67eb 100644
--- a/sysutils/py-mqttwarn/Makefile
+++ b/sysutils/py-mqttwarn/Makefile
@@ -29,7 +29,7 @@ RUN_DEPENDS+= ${PYTHON_PKGNAMEPREFIX}attrs>=19.3.0:devel/py-attrs@${PY_FLAVOR} \
 
 USES=          python shebangfix
 
-USE_PYTHON=    autoplist concurrent pep517
+USE_PYTHON=    autoplist pep517
 SHEBANG_REGEX= '.*\.py$$'
 
 NO_ARCH=       yes
[15:27 mydev dvl /usr/ports/sysutils/py-mqttwarn] % 

I added concurrent back in 2020, but do not know why.

https://cgit.freebsd.org/ports/commit/sysutils/py-mqttwarn/Makefile?id=b46669dca631f099fa9ee1ff36a85f32bd05db87
Comment 5 Vladimir Druzenko freebsd_committer freebsd_triage 2025-10-14 15:45:13 UTC
(In reply to Dan Langille from comment #4)
Happy to help!
Comment 6 Mateusz Piotrowski freebsd_committer freebsd_triage 2025-11-11 15:30:43 UTC
Can this be closed or is there a patch on its way?
Comment 7 Dan Langille freebsd_committer freebsd_triage 2025-11-11 15:34:52 UTC
(In reply to Mateusz Piotrowski from comment #6)

My immediate block is resolved.
Comment 8 Mateusz Piotrowski freebsd_committer freebsd_triage 2025-11-11 15:37:02 UTC
I see now. I've developed a patch to allow overriding USES=uniquefiles which seems to be related:

https://reviews.freebsd.org/D30315
Comment 9 Mathieu Arnold freebsd_committer freebsd_triage 2025-11-11 15:52:12 UTC
I know it's probably a bit late to the party, but it does not feel like ETCDIR for py- ports should be versioned.