xdg-utils should provide a --destdir option
Submitted by Diego Elio Pettenò
Assigned to Portland Bugs
Description
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.