Indentation

This commit is contained in:
Eelco Dolstra 2011-12-01 13:25:54 +01:00
parent 6c4e83d454
commit 692a11fd3b

View file

@ -13,7 +13,11 @@ use File::stat;
use File::Path; use File::Path;
our @ISA = qw(Exporter); our @ISA = qw(Exporter);
our @EXPORT = qw(fetchInput evalJobs checkBuild inputsToArgs captureStdoutStderr getReleaseName getBuildLog addBuildProducts restartBuild scmPath); our @EXPORT = qw(
fetchInput evalJobs checkBuild inputsToArgs captureStdoutStderr
getReleaseName getBuildLog addBuildProducts restartBuild scmPath
);
sub scmPath { sub scmPath {
return getHydraPath . "/scm" ; return getHydraPath . "/scm" ;
@ -319,7 +323,7 @@ sub fetchInputGit {
} }
# git pull + check rev # git pull + check rev
chdir $clonePath or die $!; chdir $clonePath or die $!; # !!! urgh, shouldn't do a chdir
(my $res, $stdout, $stderr) = captureStdoutStderr(600, (my $res, $stdout, $stderr) = captureStdoutStderr(600,
("git", "pull")); ("git", "pull"));
die "Error pulling latest change git repo at `$uri':\n$stderr" unless $res; die "Error pulling latest change git repo at `$uri':\n$stderr" unless $res;
@ -397,6 +401,7 @@ sub fetchInputGit {
}; };
} }
sub fetchInputBazaar { sub fetchInputBazaar {
my ($db, $project, $jobset, $name, $type, $value, $checkout) = @_; my ($db, $project, $jobset, $name, $type, $value, $checkout) = @_;
@ -693,60 +698,60 @@ sub addBuildProducts {
my $productnr = 1; my $productnr = 1;
if (-e "$outPath/nix-support/hydra-build-products") { if (-e "$outPath/nix-support/hydra-build-products") {
open LIST, "$outPath/nix-support/hydra-build-products" or die; open LIST, "$outPath/nix-support/hydra-build-products" or die;
while (<LIST>) { while (<LIST>) {
/^([\w\-]+)\s+([\w\-]+)\s+(\S+)(\s+(\S+))?$/ or next; /^([\w\-]+)\s+([\w\-]+)\s+(\S+)(\s+(\S+))?$/ or next;
my $type = $1; my $type = $1;
my $subtype = $2 eq "none" ? "" : $2; my $subtype = $2 eq "none" ? "" : $2;
my $path = $3; my $path = $3;
my $defaultPath = $5; my $defaultPath = $5;
next unless -e $path; next unless -e $path;
my $fileSize, my $sha1, my $sha256; my $fileSize, my $sha1, my $sha256;
# !!! validate $path, $defaultPath # !!! validate $path, $defaultPath
if (-f $path) { if (-f $path) {
my $st = stat($path) or die "cannot stat $path: $!"; my $st = stat($path) or die "cannot stat $path: $!";
$fileSize = $st->size; $fileSize = $st->size;
$sha1 = `nix-hash --flat --type sha1 $path` $sha1 = `nix-hash --flat --type sha1 $path`
or die "cannot hash $path: $?";; or die "cannot hash $path: $?";;
chomp $sha1; chomp $sha1;
$sha256 = `nix-hash --flat --type sha256 $path` $sha256 = `nix-hash --flat --type sha256 $path`
or die "cannot hash $path: $?";; or die "cannot hash $path: $?";;
chomp $sha256; chomp $sha256;
} }
my $name = $path eq $outPath ? "" : basename $path; my $name = $path eq $outPath ? "" : basename $path;
$db->resultset('BuildProducts')->create( $db->resultset('BuildProducts')->create(
{ build => $build->id { build => $build->id
, productnr => $productnr++ , productnr => $productnr++
, type => $type , type => $type
, subtype => $subtype , subtype => $subtype
, path => $path , path => $path
, filesize => $fileSize , filesize => $fileSize
, sha1hash => $sha1 , sha1hash => $sha1
, sha256hash => $sha256 , sha256hash => $sha256
, name => $name , name => $name
, defaultpath => $defaultPath , defaultpath => $defaultPath
}); });
} }
close LIST; close LIST;
} }
else { else {
$db->resultset('BuildProducts')->create( $db->resultset('BuildProducts')->create(
{ build => $build->id { build => $build->id
, productnr => $productnr++ , productnr => $productnr++
, type => "nix-build" , type => "nix-build"
, subtype => "" , subtype => ""
, path => $outPath , path => $outPath
, name => $build->nixname , name => $build->nixname
}); });
} }
} }