aboutsummaryrefslogtreecommitdiff
path: root/SBO-Lib/lib
diff options
context:
space:
mode:
Diffstat (limited to 'SBO-Lib/lib')
-rw-r--r--SBO-Lib/lib/SBO/Lib.pm42
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
+}