git: Fallback to git-clone for all snapshot failures.

Not just the minor failures.
wilder
Michael Pyne 12 years ago
parent 621b535e93
commit 87bdd66fa2
  1. 6
      modules/ksb/BuildException.pm
  2. 5
      modules/ksb/Updater/Git.pm
  3. 18
      modules/ksb/Util.pm

@ -27,4 +27,10 @@ sub to_string
return $exception->{exception_type} . " Error: " . $exception->{message};
}
sub message
{
my $self = shift;
return $self->{message};
}
1;

@ -91,7 +91,10 @@ sub clone
note ("\tCloning g[$module]");
if (!$self->installGitSnapshot()) {
my $result = eval { $self->installGitSnapshot() };
if (my $e = had_an_exception() || !$result) {
warning($e->message()) if $e;
if (0 != log_command($module, 'git-clone', ['git', 'clone', @args])) {
croak_runtime("Failed to make initial clone of $module");
}

@ -22,8 +22,9 @@ use ksb::Version qw(scriptVersion);
use ksb::BuildException;
use Exporter qw(import); # Use Exporter's import method
our @EXPORT = qw(list_has make_exception assert_isa assert_in any
croak_runtime croak_internal download_file absPathToExecutable
our @EXPORT = qw(list_has assert_isa assert_in any
croak_runtime croak_internal had_an_exception make_exception
download_file absPathToExecutable
fileDigestMD5 log_command disable_locale_message_translation
split_quoted_on_whitespace safe_unlink safe_system p_chdir
pretend_open safe_rmtree get_list_digest
@ -88,6 +89,19 @@ sub make_exception
return ksb::BuildException->new($exception_type, $message);
}
# Helper function to return $@ if $@ is a ksb::BuildException.
#
# This function assumes that an eval block had just been used in order to set or
# clear $@ as appropriate.
sub had_an_exception
{
if ($@ && ref $@ && $@->isa('ksb::BuildException')) {
return $@;
}
return;
}
# Should be used for "runtime errors" (i.e. unrecoverable runtime problems that
# don't indicate a bug in the program itself).
sub croak_runtime

Loading…
Cancel
Save