diff options
author | xocel <xocel@iquidus.org> | 2012-10-08 15:07:41 +1300 |
---|---|---|
committer | xocel <xocel@iquidus.org> | 2012-10-08 15:07:41 +1300 |
commit | 9c6ec67cadcf1d7bbaeb1a34a2073916e4399f39 (patch) | |
tree | be7a02f35022c81838c834d49a6671485dcc2635 /SBO-Lib/lib/SBO | |
parent | e5d7cf3a50a27a37434da8b3046681426aa25012 (diff) | |
download | sbotools2-9c6ec67cadcf1d7bbaeb1a34a2073916e4399f39.tar.xz |
Moved build queue subroutines to Lib.pm
Diffstat (limited to 'SBO-Lib/lib/SBO')
-rw-r--r-- | SBO-Lib/lib/SBO/Lib.pm | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/SBO-Lib/lib/SBO/Lib.pm b/SBO-Lib/lib/SBO/Lib.pm index 92f22b5..378d0a7 100644 --- a/SBO-Lib/lib/SBO/Lib.pm +++ b/SBO-Lib/lib/SBO/Lib.pm @@ -36,6 +36,7 @@ our @EXPORT = qw( get_from_info get_tmp_extfn get_arch + get_build_queue $tempdir $conf_dir $conf_file @@ -704,3 +705,40 @@ sub do_upgradepkg ($) { return 1; } +# add slackbuild to build queue. +sub add_to_queue (%); +sub add_to_queue (%) { + my %args = %{$_[0]}; + my $infopath = get_sbo_location($args{NAME}); + push(@{$_[0]}{QUEUE}, $args{NAME}); + return 1 unless $args{RECURSIVE}; + my $requires = get_from_info (LOCATION => $infopath, GET => 'REQUIRES'); + return unless $$requires[0]; + for my $req (@$requires) { + unless (( $req eq "%README%") or ($req eq $args{NAME})) { + $args{NAME} = $req; + add_to_queue(\%args) + } + } +} + +# get full build queue and prepare it for output. +sub get_build_queue ($) { + exists $_[0] or script_error 'get_build_queue requires an argument.'; + my @temp_queue = (); + my @build_queue = (); + my %args = ( + QUEUE => \@temp_queue, + NAME => $_[0], + RECURSIVE => 1 + ); + add_to_queue(\%args); + @temp_queue = reverse(@temp_queue); + # Remove duplicate entries (leaving first occurance) + my %seen = (); + for my $sb( @temp_queue ) { + next if $seen{ $sb }++; + push @build_queue, $sb; + } + return @build_queue; +}
\ No newline at end of file |