Downloading all dependencies, and compiling them later?

Bas den Hond lists at butdifferent.com
Tue Apr 10 00:03:05 PDT 2007


I had the same problem. And just asking for the deps manually is not  
going to do it, because they are likely to have deps themselves.

So I wrote a perl script, mpfetch.pl, to do a recursive fetch. I'm  
pasting it below.

I think there should be a 'recursive' option for the fetch command in  
port.

In fact, I think fetching should be recursive by default. And not  
just because sometimes folks have bad connections or are on the road.  
It will prevent long builds happening before you port finds out some  
dep of a dep is missing.

Bas

==========
#! /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 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, to speed things up
			print "done.";
		} else {
			print $indent,"!! Couldn't fetch $port!";
		}
		my @deps = qx/port deps $port/;
		shift(@deps);	#remove introductory line
		if (@deps) {
			print $indent, "-> $port has the following dependencies:";
			foreach (@deps) {
				s#^\s|\s$##g;
				print $indent, ($fetched{$_} ? "+ " : "- "), $_;
			}
			foreach (@deps) {
				next if $fetched{$_};
				fetch($level+1,$_);
			}
		}
	}
}

==========

Op 9-apr-2007, om 23:51 heeft Altoine Barker het volgende geschreven:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> My solution is to run these following commands for the following  
> effect:
>
> port info exampleport
>
> looks at the dependencies and then run
>
> port fetch exampleport deps1 deps2 deps3
>
> And there you go. HTH
>
> - -Altoine
>
> Don Bright wrote:
>>
>> Dear Macports,
>>
>> I was wondering, is there a simple way with 'port' to download a  
>> package
>> and all its dependencies, and then compile everything later? I have
>> intermittent network access and this would help me a lot. Thank you.
>>
>> -DB
>>
>> _______________________________________________
>> macports-users mailing list
>> macports-users at lists.macosforge.org
>> http://lists.macosforge.org/mailman/listinfo/macports-users
>>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.5 (Darwin)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQFGGrVSS0foIafBdlkRAqK9AJ0WBZABJ/WyZ/4DLNCxSUSkFjujiACfUlJV
> E0rtW5kEgbeC16RjJXLHXNc=
> =OVS/
> -----END PGP SIGNATURE-----
> _______________________________________________
> macports-users mailing list
> macports-users at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo/macports-users



-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 186 bytes
Desc: Dit deel van het bericht is digitaal ondertekend
Url : http://lists.macosforge.org/pipermail/macports-users/attachments/20070410/c46db945/PGP.bin


More information about the macports-users mailing list