aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--SBO-Lib/lib/SBO/Lib.pm38
-rwxr-xr-xsbofind38
2 files changed, 43 insertions, 33 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
diff --git a/sbofind b/sbofind
index a35b476..ec2fb3e 100755
--- a/sbofind
+++ b/sbofind
@@ -93,38 +93,10 @@ sub get_file_contents ($) {
return $contents;
}
-# 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 %seen = ();
- &add_to_queue(\@temp_queue,"$_[0]",1);
- @temp_queue = reverse(@temp_queue);
- # Remove duplicate entries (leaving first occurance)
- for my $sb( @temp_queue ) {
- next if $seen{ $sb }++;
- push @build_queue, $sb;
- }
- return join(" ", @build_queue);
-}
-
-# add slackbuild to build queue.
-# args: @queue(array), $sbname(string), $recursive(boolean)
-sub add_to_queue () {
- my $queue = \@{$_[0]};
- my $sbname = $_[1];
- my $recursive = $_[2];
- my $sbpath = get_sbo_location($sbname);
- push(@{$queue}, $sbname);
- return 1 unless $recursive;
- for my $line (split("\n", get_file_contents("$sbpath/$sbname.info"))) {
- if ($line =~ /REQUIRES="(.*?)"/) {
- for my $req (split(" ", $1)) {
- &add_to_queue($queue,"$req",1) unless ( $req eq "%README%" );
- }
- }
- }
+sub show_build_queue ($) {
+ exists $_[0] or script_error 'prepare_queue requires an argument.';
+ my $queue = join(" ", get_build_queue($_[0]));
+ return "$queue";
}
my $findings = perform_search $search;
@@ -138,7 +110,7 @@ if (exists $$findings[0]) {
say "Path: $val";
say "info: ". get_file_contents "$val/$key.info" if $show_info;
say "README: ". get_file_contents "$val/README" if $show_readme;
- say "Queue: ". get_build_queue "$key" if $show_queue;
+ say "Queue: ". show_build_queue "$key" if $show_queue;
say '';
}
}