Solved Fetch distfiles for all installed packages

If you don't mind using portmaster, I just tried this and it worked, I think (didn't check too closely):

portmaster -aftv

It will fetch what-looks-like-everything then offer to rebuild - so say No at that point.
 
Does anyone have a script or know of a simple way to fetch distfiles for all packages currently installed?
Something like this might do the trick (sh(1)/bash(1)): # for port in $(pkg info -oa | tr -s ' ' | cut -f2 -d' '); do make -C /usr/ports/$port fetch-recursive; done

Better, using pkg-query(8):
# for port in $( pkg query -a '%o' ); do make -C /usr/ports/$port fetch-recursive; done

Using fetch-recursive as you also want to get the build dependencies if you plan on using the distfiles to build from ports.

Code:
     fetch-recursive  Fetch the distfiles of the port and all its
                      dependencies.
ports(7)
 
Shouldn't the pkg prime-origins list be sufficient if using fetch-recursive?
Maybe, not sure if that would pick up all build dependencies of the 'prime' dependencies correctly. And it doesn't matter if it tries to fetch the same file multiple times, the second fetch would find the file is already there and not download it again.
 
Back
Top