Re: Downloading all dependencies, and compiling them later?
Bas, thank you. I tried your script, and had a slight problem. I rewrote it, pasted below. I hope the 'ports' program will be modified in the future to do this itself... ----------- #! /usr/bin/perl # mpfetch --- fetch Macports ports and al dependencies, recursively. use warnings; use strict; my (%fetched); foreach(@ARGV) { fetch(0,$_); } print "\nDone\n\n"; sub getdeps { my @deps = (); my @port_result = qx/port deps $_/; if (grep(/has no dependencies/,@port_result)) { return; } #print "\nstripping extra messages from port deps command..\n"; my @stage1=grep(!/has build dependencies/,@port_result); @stage1=grep(!/has library dependencies/,@stage1); @stage1=grep(!/has runtime dependencies/,@stage1); #print "stripping whitespace..\n"; foreach (@stage1) { s#^\s|\s$##g; push (@deps, $_); } #print "deps: ", join(",",@deps) ,"\n"; return @deps; } sub fetch { my $level = shift; my $indent = "\n" . (" " x $level); foreach(@_) { my $port = $_; print $indent, "<- Fetching '$port' ..."; my $result = system("port fetch $port"); unless ($result) { $fetched{$port}++; # remember what whas fetched, for speed print "done."; } else { print $result; print $indent,"!! Couldn't fetch '$port' !"; } my @deps = getdeps $port; if (!@deps) { #print "\n$port has no dependencies\n"; return; } else { print $indent, "-> $port has the following dependencies:"; foreach (@deps) { print $indent, ($fetched{$_} ? "+ " : "- "), $_; next if $fetched{$_}; fetch($level+1,$_); } } } } --------
Good job, thanks! Bas Op 12-apr-2007, om 1:31 heeft Don Bright het volgende geschreven:
Bas, thank you. I tried your script, and had a slight problem. I rewrote it, pasted below.
I hope the 'ports' program will be modified in the future to do this itself...
-----------
participants (2)
-
Bas den Hond
-
Don Bright