2 # (c) Petr Baudis <pasky@suse.cz>
14 my $gcgi = Girocco
::CGI
->new('Project Mirroring');
17 my $name = $cgi->param('name');
18 $name =~ s
#.git$## if $name; #
20 unless (defined $name) {
21 print "<p>I need the project name as an argument now.</p>\n";
25 if (!Girocco
::Project
::valid_name
($name)) {
26 print "<p>Invalid project name. Go away, sorcerer.</p>\n";
30 if (!Girocco
::Project
::does_exist
($name)) {
31 print "<p>Sorry but the project $name does not exist. Now, how did you <em>get</em> here?!</p>\n";
35 my $proj = Girocco
::Project
->load($name);
36 $proj or die "not found project $name, that's really weird!";
38 if (!$proj->{mirror
} or !$proj->{clone_in_progress
}) {
39 print "<p>This project is not a mirror to be cloned.</p>\n";
46 if (!$proj->{clone_logged
} or $proj->{clone_failed
}) {
47 # Kick off the clone since it is not running yet
48 print "<p>Initiated mirroring of ".$proj->{url
}." to $Girocco::Config::name project ".
49 "<a href=\"$Girocco::Config::gitweburl/$name.git\">$name</a>.git:</p>\n";
53 print "<p>Mirroring of ".$proj->{url
}." to $Girocco::Config::name project ".
54 "<a href=\"$Girocco::Config::gitweburl/$name.git\">$name</a>.git in progress:</p>\n";
59 open LOG
, $proj->_clonelog_path() or die "clonelog: $!";
62 for ($curpos = tell(LOG
); <LOG
>; $curpos = tell(LOG
)) {
64 $_ eq '@OVER@' and last tailf
;
68 seek(LOG
, $curpos, 0); # seek to where we had been
74 my $proj = Girocco
::Project
->load($name);
75 $proj or die "not found project $name on second load, that's _REALLY_ weird!";
77 if ($proj->{clone_failed
}) {
79 <p><strong>Mirroring failed!</strong> Please <a href="editproj.cgi?name=$name">revisit the project settings</a>.</p>