File: install-tasks

package info (click to toggle)
feta 1.4.15
  • links: PTS
  • area: main
  • in suites: etch-m68k
  • size: 444 kB
  • ctags: 85
  • sloc: perl: 1,200; sh: 192; makefile: 55
file content (42 lines) | stat: -rwxr-xr-x 919 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/perl -w
# Copyright (c)2001-2002 Joe Wreschnig
# A Feta plugin to install tasks.
# Licensed under the GNU GPL.

use Getopt::Std;
use strict;

my %opts; getopts('tyqV', \%opts);

if (!$opts{'q'}) { open(QUIET, ">&STDOUT"); }
else { open(QUIET, ">>/dev/null"); }

my @packages;
foreach (@ARGV) {
 print QUIET "Looking for packages in the $_ task... ";
 my @task_packages = `feta search Task: $_`;
  print QUIET "Done. ";
 if (!@task_packages) {
  print QUIET "There is no task named $_.\n";
 } else {
  push (@packages, @task_packages);
  print QUIET scalar(@task_packages) . " packages found.\n";
 }
}

chomp @packages;

if (!@packages) {
 print STDERR "\nW: No packages were found in the tasks given.\n";
 exit 0;
}

print QUIET "\n";
exit system('feta', feta_opts(), 'install', @packages);

sub feta_opts {
 my @opts;
 foreach ('y','t','V','q') { if ($opts{$_}) { push (@opts, "-$_"); } }
 return @opts;
}