FM4O2L4MNPCHWRDRHKGKSH5TFFX6R2RMCPEQ3XCECA6UVLJPLUVQC TPDJL4TYC537S67K7T4FOVOIWOB7VPTN4ZPMG2SL2ZPILR42VIOQC A22P7HCOGNO3XEQWBNEG2VHTGUB2GKQ75Q6JDMPQNQCLFHE7XBFAC 3XTHEUMP2ZOMPQWE3S5QWHIHCEJNEXGDPQB3JUVZFPS3RFMY455QC OOQ2D3KCLFPYNAN253PHWLBQMB6OMO2KYQWQXLTP65SQAYZWQ5LAC SJN2QPWHFYKX7CJMW4XZHI2P2THH7MECZZIHQMCH6EKBZ45G3DOAC 7UJ5YV4VUSXMKB57KKXDG6KLIXMQXO45VO5UTOT46BHQJBFZ7XKQC LBNVQXUBEZ45SOTGVXK5UEZXIAIZTJLWZNUYFI4JZ6J65N3KPDVQC BD3GRK4BQUGRQGTAILUITIH3RRSVUH6AKINVMMKYLBAAHAAUSB4AC 7YBYT2LQML2PKEO6UO4444AGSASS664UCDXW2YO3ALB7THQHCEBQC B72GLND4UQKSGNGIY4FA6HLQNFS42SKRXV5NHTHADUJRU73NELAAC D3DIBMOKXK2E65267BEEWQL4S4NSHGZBCY7YTU34JSEPZ7AKNBRQC KOTB7BKVML6T6S5ZNTQ6456FMGCRZCP3E3KVWCOW7T6SPRHC53LAC EJSBLCLTEWBUTLZZRFNQGFYKDZWDI5Q7T2QPNBFFHIAFNDGPXS3AC MOCEUXZAS4CNZL2QDKGVTZCRZ6AMOO2WSFHJ4VPZPPPAXHANG4NAC ECBA3GQOGTF73Y7A5EFUXZ5PDIZ5NPJM3WMOUJTE3AEK2PZQX3MQC sub addBuildProducts {my ($db, $build) = @_;my $outPath = $build->outpath;my $productnr = 1;if (-e "$outPath/nix-support/hydra-build-products") {open LIST, "$outPath/nix-support/hydra-build-products" or die;while (<LIST>) {/^([\w\-]+)\s+([\w\-]+)\s+(\S+)(\s+(\S+))?$/ or next;my $type = $1;my $subtype = $2 eq "none" ? "" : $2;my $path = $3;my $defaultPath = $5;next unless -e $path;my $fileSize, my $sha1, my $sha256;# !!! validate $path, $defaultPath
if (-f $path) {my $st = stat($path) or die "cannot stat $path: $!";$fileSize = $st->size;$sha1 = `nix-hash --flat --type sha1 $path`or die "cannot hash $path: $?";;chomp $sha1;$sha256 = `nix-hash --flat --type sha256 $path`or die "cannot hash $path: $?";;chomp $sha256;}
my $name = $path eq $outPath ? "" : basename $path;$db->resultset('BuildProducts')->create({ build => $build->id, productnr => $productnr++, type => $type, subtype => $subtype, path => $path, filesize => $fileSize, sha1hash => $sha1, sha256hash => $sha256, name => $name, defaultpath => $defaultPath});}close LIST;}else {$db->resultset('BuildProducts')->create({ build => $build->id, productnr => $productnr++, type => "nix-build", subtype => "", path => $outPath, name => $build->nixname});}}
my $productnr = 1;if (-e "$outPath/nix-support/hydra-build-products") {open LIST, "$outPath/nix-support/hydra-build-products" or die;while (<LIST>) {/^([\w\-]+)\s+([\w\-]+)\s+(\S+)(\s+(\S+))?$/ or next;my $type = $1;my $subtype = $2 eq "none" ? "" : $2;my $path = $3;my $defaultPath = $5;next unless -e $path;my $fileSize, my $sha1, my $sha256;# !!! validate $path, $defaultPathif (-f $path) {my $st = stat($path) or die "cannot stat $path: $!";$fileSize = $st->size;$sha1 = `nix-hash --flat --type sha1 $path`or die "cannot hash $path: $?";;chomp $sha1;$sha256 = `nix-hash --flat --type sha256 $path`or die "cannot hash $path: $?";;chomp $sha256;}my $name = $path eq $outPath ? "" : basename $path;$db->resultset('BuildProducts')->create({ build => $build->id, productnr => $productnr++, type => $type, subtype => $subtype, path => $path, filesize => $fileSize, sha1hash => $sha1, sha256hash => $sha256, name => $name, defaultpath => $defaultPath});}close LIST;}else {$db->resultset('BuildProducts')->create({ build => $build->id, productnr => $productnr++, type => "nix-build", subtype => "", path => $outPath, name => $build->nixname});}
addBuildProducts($db, $build);