Homebrew / homebrew-cask

🍻 A CLI workflow for the administration of macOS applications distributed as binaries
https://brew.sh
BSD 2-Clause "Simplified" License
20.95k stars 10.73k forks source link

feature request: attach already downloaded files or use company wide cache #44505

Closed muescha closed 6 years ago

muescha commented 6 years ago

Description of feature request

in #44501 there is a temporary problem with an download server.

for this i can manually download the file as an workaround - but i like to process it with an formula to have it "on file" in my installed casks.

instead of downloading it should use an alternate location.

for example:

it should skip the download from original place and lookup in source_folder for the file or use the source_file and place the file into the /caches/ dir and and folllow the other steps in formula

with this you can:

example usages:

brew cask install sweet-home3d --source_file=/Users/muescha/Downloads/sweet-home3d--5.7.dmg

brew cask install sweet-home3d --source_folder=/Users/muescha/Downloads/

brew cask install sweet-home3d --source_folder=/Volumes/NAS/casks-predownloads

export HOMEBREW_CASK_OPTS="--source_folder=/Volumes/NAS/cask-predownloads"
brew cask install sweet-home3d

PS: i expected this option also with the brew cask fetch command where i can just place an file into the .../caches/ folder

Output of your command with --verbose --debug

brew cask install sweet-home3d --verbose --debug
==> Hbc::Installer#install                                                                                                                                              
==> Printing caveats                                                                                                                                                    
==> Hbc::Installer#fetch                                                                                                                                                
==> Satisfying dependencies                                                                                                                                             
==> Downloading                                                                                                                                                         
==> Downloading https://downloads.sourceforge.net/sweethome3d/SweetHome3D/SweetHome3D-5.7/SweetHome3D-5.7-macosx.dmg                                                    
Already downloaded: /Users/muescha/Library/Caches/Homebrew/Cask/sweet-home3d--5.7.dmg                                                                                   
==> Downloaded to -> /Users/muescha/Library/Caches/Homebrew/Cask/sweet-home3d--5.7.dmg                                                                                  
==> Verifying download                                                                                                                                                  
==> Determining which verifications to run for Cask sweet-home3d                                                                                                        
==> Checking for verification class Hbc::Verify::Checksum                                                                                                               
==> 1 verifications defined                                                                                                                                             
Hbc::Verify::Checksum                                                                                                                                                   
==> Running verification of class Hbc::Verify::Checksum                                                                                                                 
==> Verifying checksum for Cask sweet-home3d                                                                                                                            
==> Note: running "brew update" may fix sha256 checksum errors                                                                                                          
Error: Checksum for Cask 'sweet-home3d' does not match.                                                                                                                 

Expected: 5440e833e771acb390bb31b6553d86869f36a9ea699be49ba5176f9851c01d09                                                                                              
Actual:   7a07d3f7cca5c0b38ca811984ef8da536da32932d68c1a6cce33ec2462b930bf                                                                                              
File:     /Users/muescha/Library/Caches/Homebrew/Cask/sweet-home3d--5.7.dmg                                                                                             

To retry an incomplete download, remove the file above.                                                                                                                 

/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/verify/checksum.rb:42:in `verify_checksum'                                                                            
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/verify/checksum.rb:22:in `verify'                                                                                     
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/verify.rb:21:in `block in all'                                                                                        
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/verify.rb:19:in `each'                                                                                                
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/verify.rb:19:in `all'                                                                                                 
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/installer.rb:138:in `verify'                                                                                          
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/installer.rb:52:in `fetch'                                                                                            
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/installer.rb:75:in `install'                                                                                          
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli/install.rb:20:in `block in run'                                                                                   
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli/install.rb:14:in `each'                                                                                           
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli/install.rb:14:in `run'                                                                                            
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli/abstract_command.rb:35:in `run'                                                                                   
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:98:in `run_command'                                                                                            
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:168:in `run'                                                                                                   
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:132:in `run'                                                                                                   
/usr/local/Homebrew/Library/Homebrew/cmd/cask.rb:8:in `cask'                                                                                                            
/usr/local/Homebrew/Library/Homebrew/brew.rb:100:in `<main>'                                                                                                            
Error: Kernel.exit                                                                                                                                                      
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:173:in `exit'                                                                                                  
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:173:in `rescue in run'                                                                                         
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:156:in `run'                                                                                                   
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:132:in `run'                                                                                                   
/usr/local/Homebrew/Library/Homebrew/cmd/cask.rb:8:in `cask'                                                                                                            
/usr/local/Homebrew/Library/Homebrew/brew.rb:100:in `<main>' 
vitorgalvao commented 6 years ago

Set HOMEBREW_CACHE to another directory. man -P 'less -p " HOMEBREW_CACHE"' brew.

muescha commented 6 years ago

this changes the cache for all files - but i like only some files used from different (download) location instead downloaded.

muescha commented 6 years ago

ok - you are right - bad idea - i injected it into the cache just with cp and then installed it:

cp ~/Downloads/SweetHome3D-5.7-macosx.dmg /Users/muescha/Library/Caches/Homebrew/Cask/sweet-home3d--5.7.dmg

brew cask install sweet-home3d
==> Satisfying dependencies                                                                                                                                             
==> Downloading https://downloads.sourceforge.net/sweethome3d/SweetHome3D/SweetHome3D-5.7/SweetHome3D-5.7-macosx.dmg                                                    
Already downloaded: /Users/muescha/Library/Caches/Homebrew/Cask/sweet-home3d--5.7.dmg                                                                                   
==> Verifying checksum for Cask sweet-home3d                                                                                                                            
==> Installing Cask sweet-home3d                                                                                                                                        
==> Moving App 'Sweet Home 3D.app' to '/Applications/Sweet Home 3D.app'.                                                                                                
🍺  sweet-home3d was successfully installed! 

PS: the same i can do with an company wide local cache