Bug 275745 - Mk/bsd.local.mk: Propose renaming to bsd.local.mk.sample
Summary: Mk/bsd.local.mk: Propose renaming to bsd.local.mk.sample
Status: In Progress
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Ports Framework (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Muhammad Moinur Rahman
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-12-13 14:09 UTC by Jason W. Bacon
Modified: 2023-12-16 13:33 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jason W. Bacon freebsd_committer freebsd_triage 2023-12-13 14:09:53 UTC
Currently, any changes to Mk/bsd.local.mk are part of the ports repo and must be stashed before making commits.  Stashing is very slow, so this is an annoyance.  Local changes can also be accidentally committed, which would be a nuisance to fix.

I think it would be better to mimic plist's @sample, and provide a bsd.local.mk.sample file that should never be locally modified.  I'd add a note for NOOBs explaining how to use it as shown below.

--- bsd.local.mk        2023-12-12 13:58:29.486426000 -0600
+++ bsd.local.mk.sample 2023-12-13 08:01:56.210499000 -0600
@@ -1,4 +1,5 @@
 # bsd.local.mk - Sandbox for local modification to ports framework.
+# Copy this file to bsd.local.mk and modify as desired
 #
 
 .if !defined(_POSTMKINCLUDED) && !defined(Local_Pre_Include)

bsd.local.mk could also be added to .gitignore.
Comment 1 Muhammad Moinur Rahman freebsd_committer freebsd_triage 2023-12-13 19:35:12 UTC
We are going to mark these in gitignore.
Comment 2 commit-hook freebsd_committer freebsd_triage 2023-12-13 20:44:39 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=2ad655931f6cc8e2cb0c2c17125642d8d6323b2b

commit 2ad655931f6cc8e2cb0c2c17125642d8d6323b2b
Author:     Muhammad Moinur Rahman <bofh@FreeBSD.org>
AuthorDate: 2023-12-13 19:59:19 +0000
Commit:     Muhammad Moinur Rahman <bofh@FreeBSD.org>
CommitDate: 2023-12-13 20:43:43 +0000

    .gitignore: Ignore files which are local

    PR:             275745
    Approved by:    portmgr

 .gitignore | 2 ++
 1 file changed, 2 insertions(+)
Comment 3 Jason W. Bacon freebsd_committer freebsd_triage 2023-12-13 21:23:59 UTC
The changes made did not fix this issue.

bsd.local.mk has not been renamed, so .gitignore is now listing a file that is part of the repo.

My main suggestion was to rename bsd.local.mk to bsd.local.mk.sample and add the comment provided.
Comment 4 Jason W. Bacon freebsd_committer freebsd_triage 2023-12-16 13:27:12 UTC
I misspoke in the original description: stashing must be done before every pull to update the ports tree, which is actually the real problem.  Commits can work around it without stashing, of course.

But in general, doing local modifications to any file that's part of FreeBSD base or ports is likely to cause headaches with some future update.  Since bsd.local.mk is essentially empty by default, renaming it to an inactive file like Mk/bsd.local.mk.sample and directing users to copy it to the active Mk/bsd.local.mk seems like a good solution.  bsd.local.mk.sample can receive updates without risk of conflict, while local modifications to bsd.local.mk are irrelevant to git, since it's not in the repo.
Comment 5 Jason W. Bacon freebsd_committer freebsd_triage 2023-12-16 13:31:09 UTC
It may be that nobody really cares about this issue, but since it's a global change to the ports tree, I'm leaving it open for discussion for a while before taking any action.
Comment 6 Muhammad Moinur Rahman freebsd_committer freebsd_triage 2023-12-16 13:33:12 UTC
This file is supposed to go to the Templates/Tools directory actually. And from there it should be copied over.

We will discuss this and revert back. But most probably next year.