home *** CD-ROM | disk | FTP | other *** search
/ Cricao de Sites - 650 Layouts Prontos / WebMasters.iso / Servidores / xampp-win32-1.6.7-installer.exe / php / PEAR / package.php < prev    next >
Encoding:
PHP Script  |  2008-07-02  |  2.0 KB  |  69 lines

  1. #!/usr/bin/php -q
  2. <?php
  3. /* vim: set noai expandtab tabstop=4 softtabstop=4 shiftwidth=4: */
  4. /**
  5.  * Script to generate changelog file, store it in package docs
  6.  * and generates PEAR package. Uses package_gen.php & changelog_gen.php
  7.  *  
  8.  * PHP version 5
  9.  * 
  10.  * @category  System
  11.  * @package   System_Daemon
  12.  * @author    Kevin van Zonneveld <kevin@vanzonneveld.net>
  13.  * @copyright 2008 Kevin van Zonneveld (http://kevin.vanzonneveld.net)
  14.  * @license   http://www.opensource.org/licenses/bsd-license.php New BSD Licence
  15.  * @version   SVN: Release: $Id$
  16.  * @link      http://trac.plutonia.nl/projects/system_daemon
  17.  */
  18.  
  19. $workspace_dir = realpath(dirname(__FILE__)."");
  20.  
  21. // Determine build version + corresponding SVN revision basedd on MAPPING file
  22. $mapping = parse_ini_file($workspace_dir."/docs/MAPPING");
  23. asort($mapping);
  24. $build_version  = end(array_keys($mapping));
  25. $build_revision = preg_replace('/[^\d]/', '', end($mapping));
  26.  
  27. // Read changes up from current revision
  28. $cmd = "php ".$workspace_dir."/tools/changelog_gen.php ".
  29.     $build_revision;
  30. exec($cmd, $o, $r);
  31. if ($r) {
  32.     print_r($o);
  33.     die("command: ".$cmd." failed!\n");
  34. }
  35.  
  36. // If there are any updates, overwrite changelog
  37. $change_log = trim(implode("\n", $o));
  38. if ($change_log) {
  39.     file_put_contents($workspace_dir."/docs/NOTES", $change_log);
  40. }
  41.  
  42. // Build XML
  43. if (is_file($workspace_dir."/package.xml")) {
  44.     rename($workspace_dir."/package.xml", $workspace_dir."/package.xml.bak");
  45. }
  46. $cmd = "php ".$workspace_dir."/tools/package_gen.php make";
  47. exec($cmd, $o, $r);
  48. if ($r) {
  49.     print_r($o);
  50.     die("command: ".$cmd." failed!\n");
  51. }
  52.  
  53. $olddir = getcwd(); 
  54. chdir($workspace_dir);
  55.  
  56. // Build tgz
  57. $parts    = explode("-", trim(file_get_contents($workspace_dir."/docs/VERSION")));
  58. $packfile = $parts[0]."-".$parts[1].".tgz";
  59. if (is_file($workspace_dir."/".$packfile)) {
  60.     unlink($workspace_dir."/".$packfile);
  61. }
  62. $cmd = "pear package";
  63. exec($cmd, $o, $r);
  64. if ($r) {
  65.     print_r($o);
  66.     die("command: ".$cmd." failed!\n");
  67. }
  68. chdir($olddir);
  69. ?>