Skip to content

Commit 7eb09b4

Browse files
committed
Add a updatelocalgbininfo RepoMgr method
Also drop the builddir parameter, as it is part of the repo data structure.
1 parent 3e5bdc9 commit 7eb09b4

File tree

3 files changed

+25
-9
lines changed

3 files changed

+25
-9
lines changed

PBuild/RepoMgr.pm

+15-2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ package PBuild::RepoMgr;
2323
use strict;
2424

2525
use PBuild::Util;
26+
use PBuild::LocalRepo;
2627
use PBuild::RemoteRepo;
2728
use PBuild::RemoteRegistry;
2829
use PBuild::Verify;
@@ -99,11 +100,11 @@ sub addemptyrepo {
99100
# Update the local reposiory with new binary data
100101
#
101102
sub updatelocalrepo {
102-
my ($repos, $bconf, $myarch, $builddir, $pkgsrc, $pkgs) = @_;
103+
my ($repos, $bconf, $myarch, $pkgsrc, $pkgs) = @_;
103104
my $id = "$myarch/local";
104105
my $repo = $repos->{$id};
105106
die("local repo does not exist\n") unless $repo;
106-
my $bins = PBuild::LocalRepo::fetchrepo($bconf, $myarch, $builddir, $pkgsrc, $pkgs);
107+
my $bins = PBuild::LocalRepo::fetchrepo($bconf, $myarch, $repo->{'dir'}, $pkgsrc, $pkgs);
107108
$_->{'repoid'} = $id for @$bins;
108109
$repo->{'bins'} = $bins;
109110
}
@@ -263,4 +264,16 @@ sub get_gbininfo {
263264
return $gbininfo;
264265
}
265266

267+
#
268+
# Update the local reposiory with the artifact information of a succeeded build
269+
#
270+
sub updatelocalgbininfo {
271+
my ($repos, $myarch, $pkg, $bininfo) = @_;
272+
my $id = "$myarch/local";
273+
my $repo = $repos->{$id};
274+
die("local repo does not exist\n") unless $repo;
275+
PBuild::LocalRepo::update_gbininfo($repo->{'dir'}, $pkg, $bininfo);
276+
delete $repo->{'gbininfo'}; # flush our cache
277+
}
278+
266279
1;

PBuild/Result.pm

+6-2
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,16 @@ sub print_result {
6969
return $found_failures;
7070
}
7171

72+
sub has_failed_code {
73+
my ($opts, $code) = @_;
74+
return $code_failures{$code || 'unknown'} ? 1 : 0;
75+
}
76+
7277
sub has_failed {
7378
my ($opts, $builddir, $pkg) = @_;
7479
my $r = PBuild::Util::retrieve("$builddir/.pbuild/_result", 1);
7580
die("pbuild has not run yet for $builddir\n") unless $r;
76-
my $code = $r->{$pkg}->{'code'} || 'unknown';
77-
return $code_failures{$code} ? 1 : 0;
81+
return has_failed_code($opts, $r->{$pkg}->{'code'});
7882
}
7983

8084
1;

pbuild

+4-5
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@ while (1) {
518518
$details = ": $result->{$pkg}->{'details'}" if $result->{$pkg}->{'details'};
519519
}
520520
print "$pkg: $code$details\n";
521-
exit($code eq 'broken' || $code eq 'failed' || $code eq 'unresolvable' ? 1 : 0);
521+
exit PBuild::Result::has_failed_code($opts, $code);
522522
}
523523

524524
# mix in old result from other packages if in single package mode
@@ -571,14 +571,13 @@ while (1) {
571571

572572
# if the build was successful, update artifact information and the local repo
573573
if ($bininfo) {
574-
PBuild::LocalRepo::update_gbininfo($builddir, $p->{'pkg'}, $bininfo);
575-
delete $repos[0]->{'gbininfo'};
574+
$repomgr->updatelocalgbininfo($myarch, $p->{'pkg'}, $bininfo);
576575
if ($p->{'useforbuildenabled'}) {
577576
# update with new local bin information
578577
if ($p->{'native'}) {
579-
$repomgr->updatelocalrepo($bconf, $hostarch, $builddir, \%pkgsrc, \@pkgs_native);
578+
$repomgr->updatelocalrepo($bconf, $hostarch, \%pkgsrc, \@pkgs_native);
580579
} else {
581-
$repomgr->updatelocalrepo($bconf, $myarch, $builddir, \%pkgsrc, \@pkgs_target);
580+
$repomgr->updatelocalrepo($bconf, $myarch, \%pkgsrc, \@pkgs_target);
582581
}
583582
# we also need a new checker
584583
undef $ctx;

0 commit comments

Comments
 (0)