FOSSology  3.2.0rc1
Open Source License Compliance by Open Source Software
checkOutSrcs.php
1 #!/usr/bin/php
2 <?php
3 /*
4  Copyright (C) 2008 Hewlett-Packard Development Company, L.P.
5 
6  This program is free software; you can redistribute it and/or
7  modify it under the terms of the GNU General Public License
8  version 2 as published by the Free Software Foundation.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License along
16  with this program; if not, write to the Free Software Foundation, Inc.,
17  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18  */
19 
34 $Tot = 'svn co https://fossology.svn.sourceforge.net/svnroot/fossology/trunk/fossology';
35 
36 $options = getopt('hc:u');
37 
38 $Usage = "$argv[0] [-h] [-c {top | svnPath}] [-u]\n";
39 
40 if(empty($options)) {
41  print $Usage;
42  exit(1);
43 }
44 
45 if(array_key_exists('h',$options)) {
46  print $Usage;
47  exit(0);
48 }
49 if(array_key_exists('c',$options)) {
50  $Opt = $options['c'];
51  $coOpt = strtolower($Opt);
52  if($coOpt == 'top') {
53  $last = exec($Tot, $output, $rtn);
54  print "checkout results are, last and output:$last\n";
55  print_r($output) . "\n";
56  if ($rtn != 0) {
57  print "ERROR! Could not check out FOSSology sources at\n$Tot\n";
58  exit(1);
59  }
60  }
61  else {
62  $last = exec($coOpt, $output, $rtn);
63  print "checkout results are, last and output:$last\n";
64  print_r($output) . "\n";
65  if ($rtn != 0) {
66  print "ERROR! Could not check out FOSSology sources at\n$coOpt\n";
67  exit(1);
68  }
69  }
70 }
71 
72 if(array_key_exists('u',$options)) {
73  $svnUp = 'svn up';
74  $last = exec($svnUp, $output, $rtn);
75  print "svn up results are, last and output:$last\n";
76  print_r($output) . "\n";
77  if ($rtn != 0) {
78  $dir = getcwd();
79  print "ERROR! Could not svn up FOSSology sources at $dir\n";
80  exit(1);
81  }
82 }
83 
84 
85 ?>