root/modules/branches/2.10/get_latest.php

Revision 9046, 1.4 kB (checked in by p_lindheimer, 3 years ago)

script to populate new release branch with just the latest tarball needed

  • Property svn:executable set to *
Line 
1 #!/usr/bin/php -q
2 <?php
3   if ($argc != 3) {
4     echo "Usage: $argv[0] current_revision new_revision\n";
5     exit;
6   }
7   $current_revision = $argv[1];
8   $new_revision = $argv[2];
9
10   // Get all releases
11   //
12   $output = array();
13   exec("svn list http://www.freepbx.org/v2/svn/modules/release/$current_revision",$output,$retcode);
14
15   // Now hash them to find the highest revision
16   //
17   $release_hash = array();
18   foreach ($output as $tarball) {
19     preg_match("(.*-)",$tarball,$matches);
20     if (!isset($release_hash[$matches[0]]) || version_compare($tarball, $release_hash[$matches[0]], "gt")) {
21       $release_hash[$matches[0]] = $tarball;
22     }
23   }
24
25   // Now check if the module exist in the module directory since it may have been discontinued
26   //
27   foreach ($release_hash as $module => $archive) {
28     $dir = rtrim($module,"-");
29     exec("svn list http://www.freepbx.org/v2/svn/modules/branches/$new_revision/$dir 2>&1",$output,$ret);
30     if (!$ret) {
31       echo "svn cp -m \"initiating $new_revision with latest $dir: $archive\" http://www.freepbx.org/v2/svn/modules/release/$current_revision/$archive  http://www.freepbx.org/v2/svn/modules/release/$new_revision\n";
32       //system("svn cp -m \"initiating $new_revision with latest $dir: $archive\" http://www.freepbx.org/v2/svn/modules/release/$current_revision/$archive  http://www.freepbx.org/v2/svn/modules/release/$new_revision");
33     } else {
34       //echo "# skipping $archive as $dir not in new branch\n";
35     }
36   }
37
38
Note: See TracBrowser for help on using the browser.