Alternatives: avoid explicit paths to update-alternatives #1346

Open
yselkowitz wants to merge 1 commit from flatpaks into main
Member

Using installation path macros in file dependencies is disallowed by https://pagure.io/packaging-committee/c/35d89f0f3ff118359f1fef1c328570a944e0ddf8 ("Recommend avoiding macros in file depenencies") and breaks flatpak builds when the dependency is in the runtime.

Using installation path macros in file dependencies is disallowed by https://pagure.io/packaging-committee/c/35d89f0f3ff118359f1fef1c328570a944e0ddf8 ("Recommend avoiding macros in file depenencies") and breaks flatpak builds when the dependency is in the runtime.
Owner

Extra % here

Extra % here
Owner

I have long been a proponent of avoiding path macros outside of situations like %_libdir where they are required or where they enhance readability, so I'm certainly happy with this but I suppose I'm a bit biased.

I have long been a proponent of avoiding path macros outside of situations like `%_libdir` where they are required or where they enhance readability, so I'm certainly happy with this but I suppose I'm a bit biased.
Author
Member

rebased onto 5940265643265b43d9877eeb71a9762680083aac

rebased onto 5940265643265b43d9877eeb71a9762680083aac
Author
Member

Extra % here

Thanks, fixed.

> Extra % here Thanks, fixed.
Member

I wonder if there is another place of the documentation that might need to be updated.
When referring to macros for paths, the documentation says:

So, it’s usually preferable to not hard-code these paths in spec files either, but use the same macros for consistency.

Source: https://docs.fedoraproject.org/en-US/packaging-guidelines/RPMMacros/#macros_installation

If I'm understanding the issue correctly, the part that I quoted may need to be removed and the previous part might need to be modified to:

... use the values defined by RPM to set installation paths for packages and when referring to files and directories installed by the current spec file.

Is that interpretation correct?

I wonder if there is another place of the documentation that might need to be updated. When referring to macros for paths, the documentation says: > So, it’s usually preferable to not hard-code these paths in spec files either, but use the same macros for consistency. Source: https://docs.fedoraproject.org/en-US/packaging-guidelines/RPMMacros/#macros_installation If I'm understanding the issue correctly, the part that I quoted may need to be removed and the previous part might need to be modified to: > ... use the values defined by RPM to set installation paths for packages **and when referring to files and directories installed by the current spec file**. Is that interpretation correct?
Contributor

Isn't https://pagure.io/packaging-committee/c/35d89f0f3ff118359f1fef1c328570a944e0ddf8 just referring to paths in BuildRequires/Requires ?

Isn't https://pagure.io/packaging-committee/c/35d89f0f3ff118359f1fef1c328570a944e0ddf8 just referring to paths in BuildRequires/Requires ?
Author
Member

... use the values defined by RPM to set installation paths for packages and when referring to files and directories installed by the current spec file.

Is that interpretation correct?

Something like that, yes.

> > ... use the values defined by RPM to set installation paths for packages **and when referring to files and directories installed by the current spec file**. > > Is that interpretation correct? Something like that, yes.
Author
Member

Isn't https://pagure.io/packaging-committee/c/35d89f0f3ff118359f1fef1c328570a944e0ddf8 just referring to paths in BuildRequires/Requires ?

By the same logic, if you can't rely on using e.g. Requires: %{_sbindir}/alternatives, you also can't call %{_sbindir}/alternatives in scriptlets etc. either. Besides, it doesn't make sense for the style of these two (the file dependency and its invocation in the body of a spec file) to be different.

> Isn't https://pagure.io/packaging-committee/c/35d89f0f3ff118359f1fef1c328570a944e0ddf8 just referring to paths in BuildRequires/Requires ? By the same logic, if you can't rely on using e.g. `Requires: %{_sbindir}/alternatives`, you also can't call `%{_sbindir}/alternatives` in scriptlets etc. either. Besides, it doesn't make sense for the style of these two (the file dependency and its invocation in the body of a spec file) to be different.
Contributor

So does this mean that something like this is wrong:

https://github.com/rpm-software-management/rpm/blob/master/macros.in#L769

So does this mean that something like this is wrong: https://github.com/rpm-software-management/rpm/blob/master/macros.in#L769
Author
Member

So does this mean that something like this is wrong:

https://github.com/rpm-software-management/rpm/blob/master/macros.in#L769

Since we anyway have to override PKG_CONFIG_PATH (and other such variables) to search both /app and /usr prefixes simultaneously, the question is practically moot.

> So does this mean that something like this is wrong: > > https://github.com/rpm-software-management/rpm/blob/master/macros.in#L769 Since we anyway have to override PKG_CONFIG_PATH (and other such variables) to search both /app and /usr prefixes simultaneously, the question is practically moot.
Contributor

So does this mean that something like this is wrong:

https://github.com/rpm-software-management/rpm/blob/master/macros.in#L769

Since we anyway have to override PKG_CONFIG_PATH (and other such variables) to search both /app and /usr prefixes simultaneously, the question is practically moot.

I understand this specific case may not matter for flatpak builds, but I'm asking more in general is something like this not allowed according to the packaging guidelines.

> > So does this mean that something like this is wrong: > > > > https://github.com/rpm-software-management/rpm/blob/master/macros.in#L769 > > Since we anyway have to override PKG_CONFIG_PATH (and other such variables) to search both /app and /usr prefixes simultaneously, the question is practically moot. I understand this specific case may not matter for flatpak builds, but I'm asking more in general is something like this not allowed according to the packaging guidelines.
Author
Member

I understand this specific case may not matter for flatpak builds, but I'm asking more in general is something like this not allowed according to the packaging guidelines.

The difference here is that any given individual dependency will only be in one location at a time, and the question is how to refer to that dependency in a way that applies to both regular and flatpak builds. When it comes to search paths though, an override is anyways necessary to handle multiple prefixes, and I'm not proposing that they should (since, in the case of regular builds, this would just result in duplicate entries). Therefore, I don't want to compare these use cases at all.

> I understand this specific case may not matter for flatpak builds, but I'm asking more in general is something like this not allowed according to the packaging guidelines. The difference here is that any given individual dependency will only be in one location at a time, and the question is how to refer to that dependency in a way that applies to both regular and flatpak builds. When it comes to search paths though, an override is anyways necessary to handle multiple prefixes, and I'm not proposing that they should (since, in the case of regular builds, this would just result in duplicate entries). Therefore, I don't want to compare these use cases at all.
Member

The commit message is too terse to my taste.

The commit message is too terse to my taste.
Owner

I think the change is correct and the reasons is well documented in the commit message.

I think the change is correct and the reasons is well documented in the commit message.
Author
Member

rebased onto b85d6de485

rebased onto b85d6de4858b9a826c69ca531d1c2ec2813f141e
Author
Member

Rebased; how can this be moved forward?

Rebased; how can this be moved forward?
Member

I have reviewed this as an user and it LGTM.
This documentation works before and after the bin/sbin merge.

I have reviewed this as an user and it LGTM. This documentation works before and after the bin/sbin merge.
This pull request is broken due to missing fork information.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin flatpaks:flatpaks
git switch flatpaks

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch main
git merge --no-ff flatpaks
git switch flatpaks
git rebase main
git switch main
git merge --ff-only flatpaks
git switch flatpaks
git rebase main
git switch main
git merge --no-ff flatpaks
git switch main
git merge --squash flatpaks
git switch main
git merge --ff-only flatpaks
git switch main
git merge flatpaks
git push origin main
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
6 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
packaging/guidelines!1346
No description provided.