Most distributors, when preparing a binary package from a source one, don't install directly on the live filesystem, as that would make it difficult to track down which files belong to who, and they instead use a DESTDIR variable (usually passed to the make install phase) to install in a different tree. Right now packages using xdg-utils to install data only try to write on the live filesystem, which they might not be able to write to (either through permissions, or through the use of sandbox software). Having a --destdir option, that still searches the directories on the live filesystem, but writes in a different tree would be a good deal for most distributions. It would still require modifying the packages' build system to add the option, but then it would be a one-time upstreamable change. Just remember that DESTDIR is allowed to be empty, so --destdir '' should still be allowed. Also, as it should check for presence of directories on live filesystem (to see what the system already is using), it would be a good idea to _create_ the target directories if they don't exist, as that's likely what a distributor would want.
Also, update-desktop-database and update-mime-database should _not_ be ran when using --destdir as otherwise they'll create colliding files.
I second Diego's request. Would be great if it would be accompanied by a variable XDG_DESTDIR as done with XDG_DATA_DIR and friends. I would try hacking a patch together myself provided that you want such an extension upstream conceptually. What do you say?
As I said that I'm willing to help either "yes please" or "no thanks" would be nice to hear. Thank you.
ping
-- GitLab Migration Automatic Message -- This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/xdg/xdg-utils/issues/22.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.