clone_packages/clone_all_packages.pl
changeset 162 fb679efeb2dd
parent 116 671e371caeef
child 174 4c0108e0b6dd
equal deleted inserted replaced
161:fed3f1d2c557 162:fb679efeb2dd
    14 # Description:
    14 # Description:
    15 # Perl script to clone or update all of the Foundation MCL repositories
    15 # Perl script to clone or update all of the Foundation MCL repositories
    16 
    16 
    17 use strict;
    17 use strict;
    18 use Getopt::Long;
    18 use Getopt::Long;
       
    19 use File::Basename;
    19 
    20 
    20 sub Usage($)
    21 sub Usage($)
    21   {
    22   {
    22   my ($msg) = @_;
    23   my ($msg) = @_;
    23   
    24   
    90 my $do_nothing = 0; # print the hg commands, don't actually do them
    91 my $do_nothing = 0; # print the hg commands, don't actually do them
    91 my $help = 0;
    92 my $help = 0;
    92 my $exec = 0;
    93 my $exec = 0;
    93 my $filter = "";
    94 my $filter = "";
    94 my @packagelist_files = ();
    95 my @packagelist_files = ();
    95 
       
    96 my $program_path = $0;
       
    97 
    96 
    98 # Analyse the rest of command-line parameters
    97 # Analyse the rest of command-line parameters
    99 if (!GetOptions(
    98 if (!GetOptions(
   100     "u|username=s" => \$username,
    99     "u|username=s" => \$username,
   101     "p|password=s" => \$password,
   100     "p|password=s" => \$password,
   272 if (scalar @packagelist_files == 0)
   271 if (scalar @packagelist_files == 0)
   273   {
   272   {
   274   # Read the package list files alongside the script itself
   273   # Read the package list files alongside the script itself
   275   
   274   
   276   # Extract the path location of the program and locate package list files
   275   # Extract the path location of the program and locate package list files
   277   $program_path =~ s/\\/\//g;
   276   my ($program_name,$program_path) = &File::Basename::fileparse($0);
   278   $program_path =~ s/(^.*\/)[^\/]+$/$1/;
   277   
   279   foreach my $file ("sf_mcl_packages.txt", "sftools_mcl_packages.txt", "other_packages.txt")
   278   foreach my $file ("sf_mcl_packages.txt", "sftools_mcl_packages.txt", "other_packages.txt")
   280     {
   279     {
       
   280     if (! -e $program_path.$file)
       
   281     	{
       
   282     	print "Cannot find implied packagelist $program_path$file\n";
       
   283     	next;
       
   284 			}
   281     push @packagelist_files, $program_path.$file;
   285     push @packagelist_files, $program_path.$file;
   282     }
   286     }
   283   $add_implied_FCL_repos = 1;   # lists only contain the MCL repo locations
   287   $add_implied_FCL_repos = 1;   # lists only contain the MCL repo locations
   284   }
   288   }
   285 
   289