Bug 222358 - Mk/bsd.port.mk: include /etc/ports.conf as a file to hold ports-specific settings
Summary: Mk/bsd.port.mk: include /etc/ports.conf as a file to hold ports-specific sett...
Status: Closed Not Accepted
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Ports Framework (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: Port Management Team
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-09-15 21:22 UTC by Yasuhiro Kimura
Modified: 2019-08-10 01:56 UTC (History)
2 users (show)

See Also:


Attachments
patch file (594 bytes, patch)
2017-09-15 21:22 UTC, Yasuhiro Kimura
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Yasuhiro Kimura freebsd_committer freebsd_triage 2017-09-15 21:22:47 UTC
Created attachment 186423 [details]
patch file

Writing ports-specific settings to /etc/make.conf is not good because such settings are also applied when you 'make' something that has nothing to with ports. There is a workaround to guard them as following:

.if !empty(.CURDIR:M*usr/ports*)

# settings that should be applied only for ports build.

.endif

But there is some cases that such a workaround does not work as expected. For example,

1. When /usr/ports is symbolic link to somewhere else and real path is somothing like /foo/bar/baz/portsdir.
2. When you decide to do some experiment, check out port tree to /some/where/temp/ports, cd to /some/where/temp/ports/category/portname, edit some files and try 'make PORTSDIR=/some/where/temp/ports'.

By contrast including file for ports-specific settings from bsd.port.mk works well regardless of whether /usr/ports is symbolic link or not, whatever the real path of /usr/ports is and whatever value is set as PORTSDIR. And in addtion there is already similar best practice in base system, /etc/src.conf. So I think this is better way to isolate ports-specific settings from others.
Comment 1 Adam Weinberger freebsd_committer freebsd_triage 2017-09-15 22:09:26 UTC
Those customizations should go into /usr/local/etc/poudriere.d/JAILNAME-make.conf. You could match on */ports/*, or make /usr/ports/Makefile.local, etc.

Including yet another file feels redundant, and people are going to want to be able to redefine that location so that it can be in VC.

Ports are designed to be configured by 'make config.' If you want to do it by hand, they're much better off in poudriere.d/JAILNAME-make.conf, or poudriere.d/make.conf to apply everywhere.
Comment 2 Yasuhiro Kimura freebsd_committer freebsd_triage 2017-09-15 23:53:14 UTC
(In reply to Adam Weinberger from comment #1)

What I would like to put in /etc/ports.conf is

1. Settings that affects all ports (DEVELOPER,DISTDIR,PACKAGES,WRKDIRPREFIX etc.)
2. Settings that affects multipule ports (DEFAULT_VERSION for example)

And ways you provide do not satisfy my requirement because

1. /usr/local/etc/poudriere.d/JAILNAME-make.conf works only with poudriere. If you use other tools (portupgrade, portmaster, synth etc.) or don't use any tools and just do 'cd /usr/ports/cat/name; make install', it has no effect.
2. Matching pattern '*/ports/*' does not work if real path does not include 'ports'. Ports tree can check out anywhere in the file system and it is impossible to specify pattern to match such ports tree.
3. As for /usr/ports/Makefile.local, I moved my /etc/ports.conf to /usr/ports/Makefile.local and tried to build some ports. But it seemed no effect. Is it really work as a way to customize global behavior of ports framework ?

What I would like to achieve is to provide way to customize ports framework with following 2 conditions.

1. Settings does not affect outside of ports framework.
2. Customization works regardless of
   - What tools are used or no tool is used at all.
   - Where the real path of port tree is.
Comment 3 Yasuhiro Kimura freebsd_committer freebsd_triage 2019-08-10 01:56:26 UTC
Give up this bug report.