Closed chdiza closed 5 years ago
We don't know if the tar
step will be the last one, since there could be a nested archive inside it. We run cp -R
as the last step since this works with all archive types. Sadly there is no such thing as mv -R
.
since this works with all archive types
Since we know the archive type (otherwise we don't know how to unarchive it), can't we: copy only if needed and move otherwise?
since there could be a nested archive inside it
But if there isn't, then HB should not be wastefully copying. Outside of cask, I'm not sure when this would ever happen anyway (except for the trivial case of .tar.[compression-suffix]
).
Passing on this, sorry. Will review a PR.
brew
command and reproduced the problem with multiple formulae? If it's a problem with a single, official formula (not cask) please file this issue at Homebrew/homebrew-core: https://github.com/Homebrew/homebrew-core/issues/new/choose. If it's abrew cask
problem please file this issue at https://github.com/Homebrew/homebrew-cask/issues/new/choose. If it's a tap (e.g. Homebrew/homebrew-php) problem please file this issue at the tap.brew update
and can still reproduce the problem?brew doctor
, fixed all issues and can still reproduce the problem?brew config
andbrew doctor
and included their output with your issue?I've noticed that when installing a formula, HB is extracting the source tarball to Dir1, and then for some reason is copying Dir1/* into Dir2. This seems totally unnecessary and doesn't match how HB used to behave.
Here's what it looks like now (with HOMEBREW_VERBOSE set). You can see that there is what appears to be a totally unnecessary copying:
Why is it copying the unpacked contents from one temp dir to another, instead of either (a) moving them, or (b) just extracting them directly to the desired tmpdir in the first place? HB used to not do this. Here's what it used to look like:
Copying them makes the build take longer (particularly for large source dirs, and particularly for sequences of many builds in a row like when I fresh-install all my packages from a script), and also is putting needless writes on my SSD.
Backtracking through the commit history, I've found that 556e76b037dcc65ea6 is the first commit to show the extra copy step in my local testing.
Doctor: Only the warning about HOMEBREW_VERBOSE, but it needs to be set in order to display the bug.
Config: