Bug 276157 - graphics/imv: Install imv_config as imv_config.sample
Summary: graphics/imv: Install imv_config as imv_config.sample
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Nuno Teixeira
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-01-06 18:13 UTC by embhd
Modified: 2024-01-07 07:29 UTC (History)
0 users

See Also:
bugzilla: maintainer-feedback? (eduardo)


Attachments
Patch (1.62 KB, patch)
2024-01-06 18:13 UTC, embhd
no flags Details | Diff
Use @sample macro (349 bytes, patch)
2024-01-06 19:03 UTC, Nuno Teixeira
no flags Details | Diff
Patch (1.63 KB, patch)
2024-01-06 21:18 UTC, embhd
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.