Re: git: d061fc9816e6 - main - sysutils/elephant: look for LOCALBASE/etc/xdg for installed providers

From: Gleb Popov <arrowd_at_freebsd.org>
Date: Wed, 15 Oct 2025 15:05:31 UTC
On Wed, Oct 15, 2025 at 6:00 PM Hiroki Tagato <tagattie@freebsd.org> wrote:
>
> The branch main has been updated by tagattie:
>
> URL: https://cgit.FreeBSD.org/ports/commit/?id=d061fc9816e69509e9d75a0c7763b7bc9d3b898a
>
> commit d061fc9816e69509e9d75a0c7763b7bc9d3b898a
> Author:     Hiroki Tagato <tagattie@FreeBSD.org>
> AuthorDate: 2025-10-15 14:58:18 +0000
> Commit:     Hiroki Tagato <tagattie@FreeBSD.org>
> CommitDate: 2025-10-15 15:00:20 +0000
>
>     sysutils/elephant: look for LOCALBASE/etc/xdg for installed providers
>
>     github.com/adrg/xdg specifies only /etc/xdg as the configuration
>     directories. However, LOCALBASE/etc/xdg is usual in FreeBSD. So add
>     the path to the config directories.
> ---
>  sysutils/elephant/Makefile                                    |  6 +++++-
>  .../files/patch-vendor_github.com_adrg_xdg_paths__unix.go     | 11 +++++++++++
>  2 files changed, 16 insertions(+), 1 deletion(-)
>
> diff --git a/sysutils/elephant/Makefile b/sysutils/elephant/Makefile
> index 1c4c21894ba2..ebd602a9a4ae 100644
> --- a/sysutils/elephant/Makefile
> +++ b/sysutils/elephant/Makefile
> @@ -1,7 +1,7 @@
>  PORTNAME=      elephant
>  DISTVERSIONPREFIX=     v
>  DISTVERSION=   2.1.8
> -PORTREVISION=  1
> +PORTREVISION=  2
>  CATEGORIES=    sysutils
>
>  MAINTAINER=    tagattie@FreeBSD.org
> @@ -64,6 +64,10 @@ WEBSEARCH_PLIST_FILES=       etc/xdg/elephant/providers/websearch.so
>
>  ENABLED_PROVIDERS=     ${SELECTED_OPTIONS:NDOCS:tl}
>
> +post-patch:
> +       @${REINPLACE_CMD} -e 's|%%LOCALBASE%%|${LOCALBASE}|' \
> +               ${GO_WRKSRC}/vendor/github.com/adrg/xdg/paths_unix.go
> +
>  post-build:
>  .for provider in ${ENABLED_PROVIDERS}
>         @${ECHO_MSG} "===>  Building ${provider} from ./internal/providers/${provider}"
> diff --git a/sysutils/elephant/files/patch-vendor_github.com_adrg_xdg_paths__unix.go b/sysutils/elephant/files/patch-vendor_github.com_adrg_xdg_paths__unix.go
> new file mode 100644
> index 000000000000..bee2e9cd1b8c
> --- /dev/null
> +++ b/sysutils/elephant/files/patch-vendor_github.com_adrg_xdg_paths__unix.go
> @@ -0,0 +1,11 @@
> +--- vendor/github.com/adrg/xdg/paths_unix.go.orig      2025-10-15 14:39:48 UTC
> ++++ vendor/github.com/adrg/xdg/paths_unix.go
> +@@ -21,7 +21,7 @@ func initBaseDirs(home string) {
> +       baseDirs.dataHome = pathutil.EnvPath(envDataHome, filepath.Join(home, ".local", "share"))
> +       baseDirs.data = pathutil.EnvPathList(envDataDirs, "/usr/local/share", "/usr/share")
> +       baseDirs.configHome = pathutil.EnvPath(envConfigHome, filepath.Join(home, ".config"))
> +-      baseDirs.config = pathutil.EnvPathList(envConfigDirs, "/etc/xdg")
> ++      baseDirs.config = pathutil.EnvPathList(envConfigDirs, "%%LOCALBASE%%/etc/xdg", "/etc/xdg")

The code for "baseDirs.data" already uses "/usr/local", so you
could've just put "/usr/local" here instead of %%LOCALBASE%% and
adjust ${REINPLACE_CMD} accordingly. It is just a nit pick, but with
"/usr/local" the patch is actually upstreamable.