blob: f5a25c36af3b03de6952f4fc194bfa9a7e4040b1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
#!/usr/bin/perl
use warnings;
use strict;
use do_common;
$| = 1;
sub fetch {
my $module = shift;
my $source = shift;
# Check if directory exists
if (-d "$module/.git") {
print "Skipping $module: detected existing git installation.\n";
return;
}
# Change into subdir if necessary
if ($module =~ m|/|) {
(my $subdir = $module) =~ s|/.*||;
if (! -d $subdir) {
mkdir($subdir) or die "Failed to create directory $subdir: $!\n";
}
chdir($subdir) or die "Failed to change directory to $subdir: $!\n";
}
# Run clone command
my $cmd = "git clone git://anongit.freedesktop.org/git/$source";
print "Running command: $cmd\n";
system($cmd) == 0 or die "Operation failed!\n";
print "Operation succeeded\n";
# Change back to main dir
chdir($basedir) or die "Failed to change directory to $basedir: $!\n";
}
# git-clone everything
chdir($basedir) or die "Failed to change directory to $basedir: $!\n";
while (@all_modules) {
my $module = shift @all_modules;
my $source = shift @all_modules;
fetch($module, $source);
}
|