FOSSology  4.4.0
Open Source License Compliance by Open Source Software
checkOutSrcs.php
1 #!/usr/bin/php
2 <?php
3 /*
4  SPDX-FileCopyrightText: © 2008 Hewlett-Packard Development Company, L.P.
5 
6  SPDX-License-Identifier: GPL-2.0-only
7 */
8 
23 $Tot = 'svn co https://fossology.svn.sourceforge.net/svnroot/fossology/trunk/fossology';
24 
25 $options = getopt('hc:u');
26 
27 $Usage = "$argv[0] [-h] [-c {top | svnPath}] [-u]\n";
28 
29 if(empty($options)) {
30  print $Usage;
31  exit(1);
32 }
33 
34 if(array_key_exists('h',$options)) {
35  print $Usage;
36  exit(0);
37 }
38 if(array_key_exists('c',$options)) {
39  $Opt = $options['c'];
40  $coOpt = strtolower($Opt);
41  if($coOpt == 'top') {
42  $last = exec($Tot, $output, $rtn);
43  print "checkout results are, last and output:$last\n";
44  print_r($output) . "\n";
45  if ($rtn != 0) {
46  print "ERROR! Could not check out FOSSology sources at\n$Tot\n";
47  exit(1);
48  }
49  }
50  else {
51  $last = exec($coOpt, $output, $rtn);
52  print "checkout results are, last and output:$last\n";
53  print_r($output) . "\n";
54  if ($rtn != 0) {
55  print "ERROR! Could not check out FOSSology sources at\n$coOpt\n";
56  exit(1);
57  }
58  }
59 }
60 
61 if(array_key_exists('u',$options)) {
62  $svnUp = 'svn up';
63  $last = exec($svnUp, $output, $rtn);
64  print "svn up results are, last and output:$last\n";
65  print_r($output) . "\n";
66  if ($rtn != 0) {
67  $dir = getcwd();
68  print "ERROR! Could not svn up FOSSology sources at $dir\n";
69  exit(1);
70  }
71 }