-
Notifications
You must be signed in to change notification settings - Fork 51
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
Enable installation under a specified prefix #58
Comments
I don't think destdir support needs to be baked into any Destination object, or need special casing in this library. The caller can do the prefixing themselves. def prefix_with_destdir(path: str) -> str:
return os.path.join(my_destdir, path.lstrip("/"))
schemes = {key: prefix_with_destdir(value) for key, value in sysconfig.get_paths()}
interpreter = sys.executable
my_destdir_destination = SchemeDictDestination(schemes, interpreter, "posix") Originally posted by @pradyunsg in https://github.com/pradyunsg/installer/issues/52#issuecomment-841639249 |
This is the incorrect fix, I don't think anything uses full paths from sysconfig right now, but they could in the future. The project would not be ready for such cases, in fact, the implementation would be incorrect. This really is a feature for the destination, I just want to place the file in a custom path during the copying/install process, everything else should be the same. If I implement it in a separate library/CLI it would be via |
There's 3 things here:
|
From the other issue:
Excellent question! In fact, Arch Linux for example passes the GCC option -fdebug-prefix-map to ensure all build references to the source files are remapped to refer to files such as /usr/src/debug is the root hierarchy for "debug source" packages, and when debug info is enabled, we actually package these files to help users step through the debugger with full references. The original file would be something like Not all languages are perfectly handled, e.g. nodejs package.json often contains inscrutable references such as:
or
which is flagged as a warning for manual review because most commonly, references to the build tree, or the install tree without removing $DESTDIR, indicates the package is broken at runtime and will actually try to read/write files from that location (/home/eschwartz/git/pkgbuilds/some-program/src/) once installed on Jane User's computer. In the nodejs case, there are actually package guidelines to sed out this "_where" reference: https://wiki.archlinux.org/title/Node.js_package_guidelines#Package_contains_reference_to_$srcdir/$pkgdir Solving this sort of thing when the installer doesn't handle it is a hassle, and may end up with people ignoring a screenful of false positives and allow actual legitimate errors to slip by without being noticed. Compiled C/C++ is generally pretty clean, golang has -trimpath, rust has --remap-path-prefix. Python has distutils/setuptools, which handled this via At least as a CLI experience, I'd say this is pretty important functionality. I don't know whether or not it should be the API's responsibility to provide a common library abstraction to other tools for this, but one could make the argument that if every installer wants to support this then having that abstraction avoids duplicating the work everywhere... |
This is implemented in #94, as part of the CLI ( |
There are requests for baking in support for https://gnu.org/prep/standards/html_node/DESTDIR.html in this library.
Originally posted by @FFY00 in https://github.com/pradyunsg/installer/issues/52#issuecomment-835831533
Originally posted by @flying-sheep in https://github.com/pradyunsg/installer/issues/52#issuecomment-838092371
The text was updated successfully, but these errors were encountered: