Skip to content

Respect XDG_CONFIG_HOME #2153

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
hadess opened this issue Aug 16, 2022 · 1 comment · Fixed by #2992
Closed

Respect XDG_CONFIG_HOME #2153

hadess opened this issue Aug 16, 2022 · 1 comment · Fixed by #2992
Assignees
Labels
handsfree Packaging automation and convenience RFE
Milestone

Comments

@hadess
Copy link

hadess commented Aug 16, 2022

rpm looks for .rpmmacros in ~/ but should probably look for an rpmmacros file in $HOME/.config instead.

From https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html:

$XDG_CONFIG_HOME defines the base directory relative to which user-specific configuration files should be stored. If $XDG_CONFIG_HOME is either not set or empty, a default equal to $HOME/.config should be used.

@pmatilai pmatilai added the RFE label Sep 2, 2022
@pmatilai pmatilai added this to RPM Sep 2, 2022
@pmatilai pmatilai moved this to Backlog in RPM Sep 2, 2022
@pmatilai
Copy link
Member

pmatilai commented Sep 2, 2022

It's not a new idea nor a bad one, the last time it was proposed the whole XDG thing was so new I remember being wary whether this new thing'll actually catch on at all 😅

The "problem" is that rpmrc and macros loading is handled as a simple PATH style construct which has no room for extra logic like checking one path only if the other didn't exist, but maybe it can be retrofitted there, and not a whole lot of damage would happen if we just included both in the load path.

@pmatilai pmatilai added the handsfree Packaging automation and convenience label Sep 27, 2023
@pmatilai pmatilai added this to the 4.20.0 milestone Sep 27, 2023
@pmatilai pmatilai moved this from Backlog to Todo in RPM Sep 27, 2023
@pmatilai pmatilai moved this from Todo to Priority in RPM Feb 21, 2024
@pmatilai pmatilai moved this from Priority to In Progress in RPM Mar 25, 2024
@pmatilai pmatilai self-assigned this Mar 25, 2024
pmatilai added a commit to pmatilai/rpm that referenced this issue Mar 25, 2024
Look for per-user macros primarily in ${XDG_CONFIG_HOME}/rpmmacros
but fall back to traditional ~/.rpmmacros iff it exists and there's
no config in the XDG location. As per the XDG spec, if ${XDG_CONFIG_HOME}
is not set, it defaults to ~/.config

Fixes: rpm-software-management#2153
pmatilai added a commit to pmatilai/rpm that referenced this issue Mar 25, 2024
Look for per-user macros primarily in ${XDG_CONFIG_HOME}/rpmmacros
but fall back to traditional ~/.rpmmacros iff it exists and there's
no config in the XDG location. As per the XDG spec, if ${XDG_CONFIG_HOME}
is not set, it defaults to ~/.config

Fixes: rpm-software-management#2153
pmatilai added a commit to pmatilai/rpm that referenced this issue Mar 25, 2024
Look for per-user macros primarily in ${XDG_CONFIG_HOME}/rpmmacros
but fall back to traditional ~/.rpmmacros iff it exists and there's
no config in the XDG location. As per the XDG spec, if ${XDG_CONFIG_HOME}
is not set, it defaults to ~/.config

Fixes: rpm-software-management#2153
@pmatilai pmatilai moved this from In Progress to In Review in RPM Mar 25, 2024
pmatilai added a commit to pmatilai/rpm that referenced this issue Mar 25, 2024
Look for per-user macros primarily in ${XDG_CONFIG_HOME}/rpmmacros
but fall back to traditional ~/.rpmmacros iff it exists and there's
no config in the XDG location. As per the XDG spec, if ${XDG_CONFIG_HOME}
is not set, it defaults to ~/.config

As a side-effect of this change, always allocate the macrofiles path,
previously it was sometimes allocated and sometimes not.

Fixes: rpm-software-management#2153
pmatilai added a commit to pmatilai/rpm that referenced this issue Mar 25, 2024
Look for per-user macros primarily in ${XDG_CONFIG_HOME}/rpmmacros
but fall back to traditional ~/.rpmmacros iff it exists and there's
no config in the XDG location. As per the XDG spec, if ${XDG_CONFIG_HOME}
is not set, it defaults to ~/.config

As a side-effect of this change, always allocate the macrofiles path,
previously it was sometimes allocated and sometimes not.

Fixes: rpm-software-management#2153
pmatilai added a commit to pmatilai/rpm that referenced this issue Mar 26, 2024
Look for per-user rpm configugration primarily in ${XDG_CONFIG_HOME}/rpm
but fall back to traditional ~/.rpmmacros and ~/.rpmrc iff either exists
and the new XDG directory doesn't. This way we only advertise the old
setup in 'rpm --showrc' for old users, new users only ever see the
new path.

As per the XDG spec, if ${XDG_CONFIG_HOME} is not set, it defaults
to ~/.config

Fixes: rpm-software-management#2153
pmatilai added a commit to pmatilai/rpm that referenced this issue Mar 26, 2024
Look for per-user rpm configugration primarily in ${XDG_CONFIG_HOME}/rpm
but fall back to traditional ~/.rpmmacros and ~/.rpmrc iff either exists
and the new XDG directory doesn't. This way we only advertise the old
setup in 'rpm --showrc' for old users, new users only ever see the
new path.

As per the XDG spec, if ${XDG_CONFIG_HOME} is not set, it defaults
to ~/.config

Fixes: rpm-software-management#2153
dmnks pushed a commit that referenced this issue Mar 26, 2024
Look for per-user rpm configugration primarily in ${XDG_CONFIG_HOME}/rpm
but fall back to traditional ~/.rpmmacros and ~/.rpmrc iff either exists
and the new XDG directory doesn't. This way we only advertise the old
setup in 'rpm --showrc' for old users, new users only ever see the
new path.

As per the XDG spec, if ${XDG_CONFIG_HOME} is not set, it defaults
to ~/.config

Fixes: #2153
@github-project-automation github-project-automation bot moved this from In Review to Done in RPM Mar 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
handsfree Packaging automation and convenience RFE
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants