It would be useful to sometimes install a sparse file via portage, currently portage will copy the contents of the file, expanding the space usage to the full size. My proposal would be to add a SPARSE ebuild variable containing a list of paths, relative to the image directory that should be installed as sparse files. The behaviour of this should like cp --sparse=always, as in it replaces any long strings of null characters in the source file with seeks in the destination file. If and when this: http://bugs.python.org/issue10016 upstream python bug gets fixed, this will no longer be necessary for portage. Though other package managers copy files in other ways may need modification to properly support sparse files.
(In reply to Patrick McLean from comment #0) i don't think we'd have to make it a variable for people to opt into -- let the tools do it automatically. latest `cp` should be able to detect it sanely.
PMS doesn't specify the method used for merging, see <http://dev.gentoo.org/~ulm/pms/5/pms.html#x1-15100012.3>. I'd also say that we shouldn't add a variable, but that package managers should just use the cp heuristic, i.e. behave like cp --sparse=auto (which is the default).
We shouldn't be encouraging package manglers to use 'cp' to do installs, though.
Out of curiosity, what is the use case?
(In reply to Ciaran McCreesh from comment #3) seems like another case (akin to bug 465000) where the feature set of `cp` and `install` are not aligned. adding --sparse to `install` upstream shouldn't be too difficult ...
In portage-2.3.17[native-extensions], doins supports sparse files due to this commit from bug 624526: https://gitweb.gentoo.org/proj/portage.git/commit/?id=e8f9d69d760a772aa4bcc695d2ac655a9f89e8d9