-
Notifications
You must be signed in to change notification settings - Fork 8
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
Should a "prefix" be required, even for non-relocatable packages? #84
Comments
I propose that the CPS spec be updated to guarantee that clients can always compute the proper installation prefix of a package. This means that at least one of the following fields must always be present:
|
A lot of this is XY problem. The only plausible solution I've yet seen presented to the The real question is in your last sentence; do we need/want "prefix" as an emergent concept from a CPS, even if nothing in CPS itself cares? The advantage of the proposal (besides that there is always some notion of "prefix") is that tools are assured of having a meaningful substitution for I think we agree that with the proposed modification, |
If a wrong Alternatively, one way to ensure the |
We can't require both; one expected use case is "sidecar" CPS files for packages that don't yet ship them, e.g. the To be clear, "the prefix can be nonsense" isn't a strong objection from me; I'm okay with not knowing it at all. Rather, it seemed worth pointing out the proposal can't actually ensure that a reasonable prefix is known. |
Could we simply require that tools resolve symlinks when locating cps files? |
Okay, for sidecar CPS files we certainly can't include My main goal here is that the CPS spec ensures that a prefix can always be known from a well-formed All of these use cases can be supported if we require at least one of |
In some cases symlinks are desirable and should be preserved. I've seen environments in which a network file system is mounted in a different physical path on different hosts, but a symlink provides a path name common to all hosts. CMake in particular goes to lengths to avoid resolving such symlinks. Regardless, symlinks are a xy-problem for this issue. The real issue here is about always knowing the package's prefix. |
That said, I am also considering the following updated recommendation for determining the prefix from If ``fullpath`` is the location of the ``.cps`` file,
tools shall attempt prefix resolution
against ``dirname(fullpath)``, at minimum.
It is recommended that, if this fails,
tools also attempt prefix resolution
against ``realpath(dirname(fullpath))``
and ``dirname(realpath(fullpath))``,
where ``realpath(...)`` represents the canonicalized
(that is, with all symlinks fully expanded)
form of its argument. Rationale: I don't want us to needlessly fall flat on our face if the user has done something silly like symlinking |
If one of |
Hmm. It's possible, particularly for a sidecar CPS file, that a package's artifacts are scattered across the filesystem with no well-defined prefix. On Windows the artifacts might not even be on the same drive letter, so even I propose we categorize packages as follows:
The scattered category should be documented as a last resort. If a |
There's no good way to validate this beforehand; you'd have to parse not only the entire initial |
Some Linux distros have a "usr-move" initiative such that
/lib
is a symbolic link to/usr/lib
. This can cause trouble for relocatable packages that compute their resource locations relative to the path at which the package file is found.Consider a package installed in
/usr
that provides/usr/lib/cps/foo.cps
withcps_path=@prefix@/lib/cps
. Other fields use@prefix@
with the expectation that it be replaced by/usr
, since that is the prefix to which the package is installed. If the package is loaded through the/lib -> /usr/lib
cross-prefix symlink, it will be loaded as/lib/cps/foo.cps
and@prefix@
will not have/usr
. The resulting expansion of other fields will have incorrect paths.The only way to have a well-defined prefix in the case of a cross-prefix symlink is for the package to not be relocatable, and to simply memorize its prefix. This means there is a trade-off between being relocatable and supporting cross-prefix symlinks. Distros with usr-move symlinks can choose the latter and hard-code the prefix.
One way for the
.cps
file to hard-code a prefix is by using absolute paths in all fields and not referencing@prefix@
at all. IMO that is unnecessarily restrictive. Furthermore, even if a CPS file does not use@prefix@
anywhere, it is semantically useful for clients to be able to know the prefix of the package.The text was updated successfully, but these errors were encountered: