diff options
author | xocel <xocel@iquidus.org> | 2012-11-12 16:04:55 +1300 |
---|---|---|
committer | xocel <xocel@iquidus.org> | 2012-11-12 16:04:55 +1300 |
commit | 07462e9fb1bd131e703b3392eac5c1c0417dc0d2 (patch) | |
tree | b28a899755bfa9e7865b9c314194c52bb0f6303d /SBO-Lib/lib/SBO/Lib.pm | |
parent | 203c16aa05c79d3d388f4b291d3ead2968b3a38e (diff) | |
download | sbotools2-07462e9fb1bd131e703b3392eac5c1c0417dc0d2.tar.xz |
merged multisbo into xocel
Diffstat (limited to 'SBO-Lib/lib/SBO/Lib.pm')
-rw-r--r-- | SBO-Lib/lib/SBO/Lib.pm | 42 |
1 files changed, 20 insertions, 22 deletions
diff --git a/SBO-Lib/lib/SBO/Lib.pm b/SBO-Lib/lib/SBO/Lib.pm index 7b9dff7..c2c1f4c 100644 --- a/SBO-Lib/lib/SBO/Lib.pm +++ b/SBO-Lib/lib/SBO/Lib.pm @@ -1,3 +1,4 @@ + #!/usr/bin/env perl # # vim: set ts=4:noet @@ -366,7 +367,7 @@ sub get_filename_from_link ($) { my $fn = shift; my $regex = qr#/([^/]+)$#; my $filename = $fn =~ $regex ? $distfiles .'/'. ($fn =~ $regex)[0] : undef; - $filename =~ s/%2B/+/g; + $filename =~ s/%2B/+/g if $filename; return $filename; } @@ -733,16 +734,12 @@ sub add_to_queue ($) { my $args = shift; my $sbo = \${$args}{NAME}; return unless $$sbo; - push(@{$args}{QUEUE}, $$sbo); - my @locations = get_sbo_location $$sbo; - my $location; - for my $loc (@locations) { - $location = $loc if basename($loc) eq $$sbo; - } + unshift @$args{QUEUE}, $$sbo; + my $location = get_sbo_location $$sbo; return unless $location; my $requires = get_from_info (LOCATION => $location, GET => 'REQUIRES'); - for my $req (@$requires) { - next if $req eq $$sbo; + FIRST: for my $req (@$requires) { + next FIRST if $req eq $$sbo; if ($req eq "%README%") { ${$args}{WARNINGS}{$$sbo}="%README%"; } else { @@ -754,21 +751,22 @@ sub add_to_queue ($) { # recursively add a sbo's requirements to the build queue. sub get_build_queue ($$) { - unless ($_[0] && $_[1]) { - script_error 'get_build_queue requires two arguments.'; + exists $_[1] or script_error 'get_build_queue requires two arguments.'; + my ($sbos, $warnings) = @_; + my $temp_queue = []; + for my $sbo (@$sbos) { + my %args = ( + QUEUE => $temp_queue,, + NAME => $sbo, + WARNINGS => $warnings + ); + add_to_queue(\%args); } - my (@temp_queue, @build_queue); - my %args = ( - QUEUE => \@temp_queue, - NAME => $_[0], - WARNINGS => \%{$_[1]} - ); - add_to_queue(\%args); # Remove duplicate entries (leaving first occurrence) - my %seen; - for my $sb( reverse(@temp_queue) ) { - next if $seen{ $sb }++; + my (%seen, @build_queue); + FIRST: for my $sb (@$temp_queue) { + next FIRST if $seen{$sb}++; push @build_queue, $sb; } return \@build_queue; -}
\ No newline at end of file +} |