source: tags/ms_r16q2/util/arb_check_build_env.pl

Last change on this file was 7040, checked in by westram, 13 years ago
  • merged from refactor [6875] [6876] [6877] [6878] [6879] [6880] [6881] [6882] [6892] [6893] [6902] [6909] [6919] [6920] [6921] [6924] [6938]
    • formatted alignment of test-db
    • added TEST_ASSERT_TEXTFILE_DIFFLINES
    • added special mode that treats different dates as equal
    • moved file compare tests to ARBDB (shall goto ARBCORE later)
    • added tests for sequence export
    • big test indicator
    • skip SLOW warning when running under valgrind
    • no ':' in patch names
  • fixes included:
    • do not export full installation path when exporting sequences as xml
    • stuffed a leak in XML-exporter
  • Property svn:executable set to *
File size: 2.5 KB
Line 
1#!/usr/bin/perl
2#
3# This script checks whether all tools needed for ARB compilation are found in path.
4
5use strict;
6use warnings;
7
8my @commands = (
9                'bash',
10                'cat',
11                'chmod',
12                'cp',
13                'find',
14                'grep',
15                'gzip',
16                'ln',
17                'ls',
18                'lynx',
19                'mkdir',
20                'mv',
21                'perl',
22                'rm',
23                'sed',
24                'sort',
25                'tar',
26                'test',
27                'time',
28                'touch',
29                'uniq',
30                'xmllint',
31                'xsltproc',
32               );
33
34sub findPath($\@) {
35  my ($command,$path_dirs_r) = @_;
36  my ($found,$executable) = (undef,undef);
37
38  if (-e $command) {
39    $found = $command;
40    if (-X $command) { $executable = $command; }
41  }
42
43  if (not defined $executable) {
44    foreach (@$path_dirs_r) {
45      my $full = $_.'/'.$command;
46      if (-e $full) {
47        $found = $full;
48        if (-X $full) { $executable = $full; }
49      }
50    }
51  }
52  return ($found,$executable);
53}
54
55sub main() {
56  foreach (@ARGV) {
57    s/ .*$//og; # skip anything from first space to EOL
58    push @commands, $_;
59  }
60  {
61    my %commands = map { $_ => 1; } @commands;
62    @commands = sort keys %commands;
63  }
64
65  my $path = $ENV{PATH};
66  if (not defined $path) { die "Environmentvariable 'PATH' is undefined"; }
67  my @path_dirs = split(':',$path);
68
69  my @missing       = ();
70  my @notExecutable = ();
71
72  foreach (@commands) {
73    my ($found,$executable) = findPath($_,@path_dirs);
74    if (not defined $executable) { # not ok
75      if (defined $found) { push @notExecutable, $_; }
76      else { push @missing, $_; }
77    }
78  }
79
80  my $missing = scalar(@missing);
81  my $notExecutable = scalar(@notExecutable);
82
83  if (($missing+$notExecutable)==0) {
84    print "All tools needed for ARB compilation have been located.\n";
85  }
86  else {
87    my $missingList       = join(', ', @missing);
88    my $notExecutableList = join(', ', @notExecutable);
89
90    my $msg = "The following tools are missing:\n";
91    if ($missing>0)       { $msg .= "    $missingList\n"; }
92    if ($notExecutable>0) { $msg .= "    $notExecutableList (found but not executable)\n"; }
93    $msg .= "These tools are vital to compile ARB, so\n";
94    $msg .= "please ensure that these tools are installed and that either\n";
95    $msg .= "- their installation directory is in PATH or\n";
96    $msg .= "- they are linked into the PATH\n\n";
97
98    die $msg;
99  }
100}
101
102main();
103
Note: See TracBrowser for help on using the repository browser.