Bug 276157

Summary: graphics/imv: Install imv_config as imv_config.sample
Product: Ports & Packages Reporter: embhd
Component: Individual Port(s)Assignee: Nuno Teixeira <eduardo>
Status: Closed FIXED    
Severity: Affects Only Me Flags: bugzilla: maintainer-feedback? (eduardo)
Priority: ---    
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
Patch
none
Use @sample macro
none
Patch none

Description embhd 2024-01-06 18:13:37 UTC
Created attachment 247491 [details]
Patch

As of now, reinstalling graphics/imv overwrites any existing config in /usr/local/etc. With the proposed patch, the default config file is installed as /usr/local/etc/imv_config.sample instead, leaving any custom configs in place.

Even without any config, imv starts without any warnings.
Comment 1 Nuno Teixeira freebsd_committer freebsd_triage 2024-01-06 19:03:04 UTC
Created attachment 247495 [details]
Use @sample macro

Please try this patch (without paching meson)

@sample macro will do check if config exists.
Comment 2 Nuno Teixeira freebsd_committer freebsd_triage 2024-01-06 19:05:17 UTC
(In reply to Nuno Teixeira from comment #1)

(...)

We need a .sample for this to work

@sample etc/imv_config.sample

This file can be copied during install time.
Comment 3 Nuno Teixeira freebsd_committer freebsd_triage 2024-01-06 19:07:22 UTC
(In reply to Nuno Teixeira from comment #2)
(...)

https://docs.freebsd.org/en/books/porters-handbook/book/#plist-config
Comment 4 embhd 2024-01-06 20:59:07 UTC
Adding "@sample" to pkg-plist is a good idea, thank's for the pointer.

I'm wondering, though, the port uses install_data() in meson.build (ll. 203-207) to copy everything to stage/ - wouldn't this require patching meson anyways, to make sure only the new imv_config.sample is moved there?

In addition, having a separate imv_config.sample would require additional work (or at least an additional check to see if the default config has changed) to keep the port up to date.
Comment 5 embhd 2024-01-06 21:18:20 UTC
Created attachment 247502 [details]
Patch
Comment 6 commit-hook freebsd_committer freebsd_triage 2024-01-06 22:53:00 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=3ef68ca2451cad33eebe3619777fd7f96a709bad

commit 3ef68ca2451cad33eebe3619777fd7f96a709bad
Author:     embhd <embhd@posteo.de>
AuthorDate: 2024-01-06 22:46:50 +0000
Commit:     Nuno Teixeira <eduardo@FreeBSD.org>
CommitDate: 2024-01-06 22:52:07 +0000

    graphics/imv: Install imv_config as imv_config.sample

    - Use @sample macro on installed config .sample

    While I'm here:

    - Fix hardcoded paths in imv program and manual(1)

    PR:             276157

 graphics/imv/Makefile                        |  7 ++++++-
 graphics/imv/files/patch-doc_imv.1.txt (new) | 15 +++++++++++++++
 graphics/imv/files/patch-meson.build         | 12 ++++++++++--
 graphics/imv/files/patch-src_imv.c (new)     | 12 ++++++++++++
 graphics/imv/pkg-plist                       |  2 +-
 5 files changed, 44 insertions(+), 4 deletions(-)
Comment 7 Nuno Teixeira freebsd_committer freebsd_triage 2024-01-06 22:56:36 UTC
Using 'rename' in meson.build was a brilliant idea!

Committed, thank you!
Comment 8 embhd 2024-01-07 07:29:35 UTC
Sure, glad to help out.