clone_packages/clone_all_packages.pl
changeset 117 61b66a9de915
parent 115 671e371caeef
child 161 fb679efeb2dd
equal deleted inserted replaced
116:908694c1352b 117:61b66a9de915
    55 -n             do nothing - don't actually execute the commands
    55 -n             do nothing - don't actually execute the commands
    56 -help          print this help information
    56 -help          print this help information
    57 -exec          execute command on each repository
    57 -exec          execute command on each repository
    58 -filter <RE>   only process repository paths matching regular expression <RE>
    58 -filter <RE>   only process repository paths matching regular expression <RE>
    59 -dummyrun      Dummy Run, don't execute any Mercurial commands.
    59 -dummyrun      Dummy Run, don't execute any Mercurial commands.
       
    60 -webhost       Web Mercurial host (defaults to developer.symbian.org)
    60 
    61 
    61 The -exec option processes the rest of the command line, treating it as
    62 The -exec option processes the rest of the command line, treating it as
    62 a command to apply to each repository in turn. Some keywords are expanded
    63 a command to apply to each repository in turn. Some keywords are expanded
    63 to repository-specific values, and "hg" is always expanded to "hg -R %REPO%"
    64 to repository-specific values, and "hg" is always expanded to "hg -R %REPO%"
    64 
    65 
   105     "h|help" => \$help,
   106     "h|help" => \$help,
   106     "e|exec" => \$exec,
   107     "e|exec" => \$exec,
   107     "f|filter=s" => \$filter,
   108     "f|filter=s" => \$filter,
   108     "l|packagelist=s" => \@packagelist_files,
   109     "l|packagelist=s" => \@packagelist_files,
   109     "d|dummyrun" => \$do_nothing,
   110     "d|dummyrun" => \$do_nothing,
       
   111     "w|webhost=s" => \$hostname,
   110     ))
   112     ))
   111   {
   113   {
   112   Usage("Invalid argument");
   114   Usage("Invalid argument");
   113   }
   115   }
   114   
   116   
   201   my $repo_url = "https://$username:$password\@$hostname/$package/";
   203   my $repo_url = "https://$username:$password\@$hostname/$package/";
   202   my $repo_push_url =$repo_url;
   204   my $repo_push_url =$repo_url;
   203   if ($license ne "sfl" && !$export_control_special_case{$package})
   205   if ($license ne "sfl" && !$export_control_special_case{$package})
   204     {
   206     {
   205     # user registration is not required for reading public package repositories
   207     # user registration is not required for reading public package repositories
   206     $repo_url = "http://developer.symbian.org/$package/";
   208     $repo_url = "http://$hostname/$package/";
   207     }
   209     }
   208   
   210   
   209   my @rev_options = ();
   211   my @rev_options = ();
   210   my $revision = $revisions{$package};
   212   my $revision = $revisions{$package};
   211   if (defined($revision))
   213   if (defined($revision))
   245   elsif (-d "$path/.hg")
   247   elsif (-d "$path/.hg")
   246     {
   248     {
   247     # The repository already exists, so just do an update
   249     # The repository already exists, so just do an update
   248     
   250     
   249     print "Updating $destdir from $package...\n";
   251     print "Updating $destdir from $package...\n";
   250     $ret = do_system("hg", "pull", @pull_options, "-R", $path, $repo_url, @rev_options);
   252     $ret = do_system("hg", "pull", @pull_options, @rev_options, "-R", $path, $repo_url);
   251     if ($ret == 0 && ! $mirror)
   253     if ($ret == 0 && ! $mirror)
   252       {
   254       {
   253       $ret = do_system("hg", "update", "-R", $path, @rev_options)
   255       $ret = do_system("hg", "update", "-R", $path, @rev_options)
   254       }
   256       }
   255     }
   257     }
   256   else
   258   else
   257     {
   259     {
   258     # Clone the repository
   260     # Clone the repository
   259     
   261     
   260     print "Cloning $destdir from $package...\n";
   262     print "Cloning $destdir from $package...\n";
   261     $ret = do_system("hg", "clone", @clone_options, $repo_url, $path, @rev_options);
   263     $ret = do_system("hg", "clone", @clone_options, @rev_options, $repo_url, $path);
   262     }
   264     }
   263   
   265   
   264   $ret = $ret >> 8;   # extract the exit status
   266   $ret = $ret >> 8;   # extract the exit status
   265   print "* Exit status $ret for $path\n\n" if ($verbose);
   267   print "* Exit status $ret for $path\n\n" if ($verbose);
   266   return $ret;
   268   return $ret;
   378 printf "\n------------\nProcessed %d packages, of which %d reported errors\n", 
   380 printf "\n------------\nProcessed %d packages, of which %d reported errors\n", 
   379   $total_packages, scalar @problem_packages;
   381   $total_packages, scalar @problem_packages;
   380 if (scalar @problem_packages)
   382 if (scalar @problem_packages)
   381   {
   383   {
   382   print join("\n", @problem_packages, "");
   384   print join("\n", @problem_packages, "");
   383   }
   385   exit(1);
       
   386   }
       
   387   else
       
   388   {
       
   389   exit(0);
       
   390   }
       
   391