2011-03-20 03:05:41 +00:00
|
|
|
#!/usr/bin/perl
|
|
|
|
|
|
|
|
use strict;
|
|
|
|
use FindBin qw($Bin);
|
|
|
|
|
|
|
|
chdir($Bin) or die;
|
|
|
|
|
|
|
|
my $workdir = "$Bin/workdir";
|
|
|
|
unless (-d $workdir) {
|
|
|
|
mkdir $workdir, 0755 or die;
|
|
|
|
}
|
|
|
|
|
2011-07-16 20:12:08 +00:00
|
|
|
my %proj = (
|
|
|
|
"fuse" => {
|
2011-03-20 03:05:41 +00:00
|
|
|
git => "https://github.com/hanwen/go-fuse.git",
|
|
|
|
copies => [
|
|
|
|
# File glob => target directory
|
|
|
|
[ "fuse/*.go", "github.com/hanwen/go-fuse/fuse" ]
|
|
|
|
],
|
|
|
|
},
|
2011-07-16 20:12:08 +00:00
|
|
|
"mysql" => {
|
2011-03-20 03:05:41 +00:00
|
|
|
git => "https://github.com/Philio/GoMySQL.git",
|
|
|
|
copies => [
|
|
|
|
# File glob => target directory
|
|
|
|
[ "*.go", "github.com/Philio/GoMySQL" ]
|
|
|
|
],
|
|
|
|
},
|
2011-07-16 20:12:08 +00:00
|
|
|
"mysqlfork" => {
|
2011-07-04 20:03:38 +00:00
|
|
|
git => "https://github.com/camlistore/GoMySQL.git",
|
|
|
|
copies => [
|
|
|
|
# File glob => target directory
|
|
|
|
[ "*.go", "github.com/camlistore/GoMySQL" ]
|
|
|
|
],
|
|
|
|
},
|
2011-07-16 20:12:08 +00:00
|
|
|
"gomemcache" => {
|
2011-07-02 16:56:50 +00:00
|
|
|
git => "https://github.com/bradfitz/gomemcache/",
|
|
|
|
copies => [
|
|
|
|
# File glob => target directory
|
|
|
|
[ "*.go", "github.com/bradfitz/gomemcache" ]
|
|
|
|
],
|
|
|
|
},
|
2011-07-16 20:12:08 +00:00
|
|
|
"flickr" => {
|
|
|
|
git => "https://github.com/mncaudill/go-flickr.git",
|
|
|
|
copies => [
|
|
|
|
# File glob => target directory
|
|
|
|
[ "*", "github.com/mncaudill/go-flickr" ]
|
|
|
|
],
|
|
|
|
},
|
2011-03-20 03:05:41 +00:00
|
|
|
);
|
|
|
|
|
2011-07-16 20:12:08 +00:00
|
|
|
foreach my $name (sort keys %proj) {
|
2011-07-03 23:13:35 +00:00
|
|
|
next if @ARGV && $name !~ /\Q$ARGV[0]\E/;
|
2011-07-16 20:12:08 +00:00
|
|
|
my $p = $proj{$name};
|
2011-03-20 03:05:41 +00:00
|
|
|
|
|
|
|
chdir($workdir) or die;
|
2011-07-16 20:12:08 +00:00
|
|
|
$p->{git} or die "no git key defined for $name";
|
|
|
|
unless (-d $name) {
|
2011-03-20 03:05:41 +00:00
|
|
|
print STDERR "Cloning $name ...\n";
|
2011-07-16 20:12:08 +00:00
|
|
|
system("git", "clone", $p->{git}, $name) and die "git clone failure";
|
2011-03-20 03:05:41 +00:00
|
|
|
}
|
2011-07-16 20:12:08 +00:00
|
|
|
chdir($name) or die;
|
2011-03-20 03:05:41 +00:00
|
|
|
print STDERR "Updating $name ...\n";
|
|
|
|
system("git", "pull");
|
|
|
|
for my $cp (@{$p->{copies}}) {
|
|
|
|
my $glob = $cp->[0] or die;
|
|
|
|
my $target_dir = $cp->[1] or die;
|
|
|
|
system("mkdir", "-p", "$Bin/$target_dir") and die "Failed to make $Bin/$target_dir";
|
|
|
|
my @files = glob($glob) or die "Glob '$glob' didn't match any files for project '$name'";
|
|
|
|
system("cp", "-p", @files, "$Bin/$target_dir") and die "Copy failed.";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|