PHPonTrax
[ class tree: PHPonTrax ] [ index: PHPonTrax ] [ all elements ]

Source for file makepkg.php

Documentation is available at makepkg.php

  1. #!@PHP-BIN@
  2. <?php
  3. /**
  4.  *  Make a Pear installable package of the PHPonTrax distribution
  5.  *
  6.  *  (PHP 5)
  7.  *
  8.  *  To make a package, connect to the top directory and type
  9.  *  <b>php makepkg.php</b> (or on Unix-type systems, <b>./makepkg.php</b>).
  10.  *  Information about how to build the package and what to put in it
  11.  *  comes from two sources: this script, and the information
  12.  *  maintained by {@link http://subversion.tigris.org Subversion} in
  13.  *  the various .svn directories that identifies which files are part
  14.  *  of the distribution.
  15.  *  
  16.  *  Requires Pear package
  17.  *  {@link http://pear.php.net/package/PEAR_PackageFileManager PEAR_PackageFileManager} .
  18.  *  The Subversion plugin uses
  19.  *  {@link http://pear.php.net/package/XML_Tree XML_Tree} .
  20.  *  Unfortunately XML_Tree has a couple of methods named
  21.  *  {@link http://www.php.net/manual/en/language.oop5.cloning.php clone}
  22.  *  which is a reserved word in PHP 5.  The fix is
  23.  *  easy, just edit XML_Tree to change every use of 'clone' to 'clone4'.
  24.  *
  25.  *  PackageFileManager has several undocumented limitations that
  26.  *  seriously affect what you can do with it:
  27.  *  <ul>
  28.  *    <li>PackageFileManager will not add an empty directory to a
  29.  *      package.  Therefore you need to put at least one file in any
  30.  *      directory that is to go into a package.</li>
  31.  *    <li>The Pear Installer will not install an empty file. Therefore
  32.  *      you need to put at least one character into any file to be
  33.  *      installed as part of a package.</li>
  34.  *    <li>The PackageFileManager options 'include' and 'ignore' use a
  35.  *      regular expression match to identify the files and directories
  36.  *      that they affect.  For each file and directory managed by
  37.  *      Subversion, PackageFileManager first attempts to apply the
  38.  *      RE pattern as coded.  Then it appends leading and trailing '/'
  39.  *      to the pattern and tries again.  The results are hard to
  40.  *      predict.</li>
  41.  *  </ul>
  42.  *
  43.  *  @package PHPonTrax
  44.  *  @version $Id: makepkg.php 287 2007-04-09 07:26:43Z john $
  45.  */
  46.  
  47. require_once('PEAR/PackageFileManager2.php');
  48. require_once('PEAR/Packager.php');
  49.  
  50. $packagexml new PEAR_PackageFileManager2;
  51.  
  52. // Set package options
  53. $e $packagexml->setOptions(array(
  54.     'baseinstalldir' => 'PHPonTrax',
  55.     'packagedirectory' => '.',
  56.     'filelistgenerator' => 'svn'// generate from svn or file
  57.     'dir_roles' => array(
  58.         'doc' => 'doc',
  59.         'test' => 'test',
  60.         'data' => 'data'
  61.     ),
  62.     'exceptions' => array(
  63.         'pear-trax' => 'script',
  64.         'pear-trax.bat' => 'script',
  65.         'vendor/trax/templates/error.phtml' => 'php',
  66.         'vendor/trax/templates/view.phtml' => 'php',
  67.         'vendor/trax/templates/mailer_view.phtml' => 'php',
  68.         'vendor/trax/templates/scaffolds/add.phtml' => 'php',
  69.         'vendor/trax/templates/scaffolds/edit.phtml' => 'php',
  70.         'vendor/trax/templates/scaffolds/index.phtml' => 'php',
  71.         'vendor/trax/templates/scaffolds/layout.phtml' => 'php',
  72.         'vendor/trax/templates/scaffolds/show.phtml' => 'php',
  73.         'vendor/trax/templates/scaffolds/scaffold.css' => 'php',
  74.         'vendor/trax/templates/scaffolds/generator_templates/form_scaffolding.phtml' => 'php',
  75.         'vendor/trax/templates/scaffolds/generator_templates/layout.phtml' => 'php',
  76.         'vendor/trax/templates/scaffolds/generator_templates/view_add.phtml' => 'php',
  77.         'vendor/trax/templates/scaffolds/generator_templates/view_edit.phtml' => 'php',
  78.         'vendor/trax/templates/scaffolds/generator_templates/view_index.phtml' => 'php',
  79.         'vendor/trax/templates/scaffolds/generator_templates/view_show.phtml' => 'php',
  80.         'vendor/trax/templates/scaffolds/generator_templates/style.css' => 'php'
  81.     ),
  82.     'installexceptions' => array(
  83.         'pear-trax' => '/',
  84.         'dispatch.php' => 'public'
  85.     )
  86. ));
  87. $packagexml->setPackage('PHPonTrax');
  88. $packagexml->setSummary('Rapid Application Development Made Easy');
  89. $packagexml->setDescription('PHP port of Ruby on Rails');
  90. $packagexml->setNotes('We\'ve implemented many new and exciting features');
  91. $packagexml->setChannel('pear.phpontrax.com');
  92. $packagexml->setReleaseVersion('0.14.0');
  93. $packagexml->setAPIVersion('0.14.0');
  94. $packagexml->setReleaseStability('stable');
  95. $packagexml->setAPIStability('stable');
  96. $packagexml->setLicense('MIT License''http://www.opensource.org/licenses/mit-license.php');
  97. $packagexml->setPackageType('php')// this is a PEAR-style php script package
  98.  
  99. // Depends on PHP 5
  100. $packagexml->setPhpDep('5.0.3');
  101.  
  102. // Depends on Pear 1.4.0 or greater
  103. $packagexml->setPearinstallerDep('1.4.0');
  104.  
  105. // Depends on these PEAR packages
  106. $packagexml->addPackageDepWithChannel('required''MDB2''pear.php.net''2.0');
  107. $packagexml->addPackageDepWithChannel('required''Mail''pear.php.net''1.0');
  108. $packagexml->addPackageDepWithChannel('required''Mail_Mime''pear.php.net''1.0');
  109.  
  110. // Who maintains this package
  111. $packagexml->addMaintainer('lead''john''John Peterson''john@mytechsupport.com');
  112. $packagexml->addMaintainer('developer''haas''Walt Haas''haas@xmission.com');
  113.  
  114. // Substitute local configuration values for these symbols
  115. $packagexml->addGlobalReplacement('pear-config''@BIN-DIR@''bin_dir');
  116. $packagexml->addGlobalReplacement('pear-config''@DOC-DIR@''doc_dir');
  117. $packagexml->addGlobalReplacement('pear-config''@PHP-DIR@''php_dir');
  118. $packagexml->addGlobalReplacement('pear-config''@DATA-DIR@''data_dir');
  119. $packagexml->addGlobalReplacement('pear-config''@PHP-BIN@''php_bin');
  120. $packagexml->addGlobalReplacement('pear-config''@TEST-DIR@''test_dir');
  121.  
  122. // Platform-dependent command lines
  123. $packagexml->addRelease()// set up a release section
  124. $packagexml->setOSInstallCondition('windows');
  125. $packagexml->addInstallAs('pear-trax.bat''trax');
  126. $packagexml->addIgnoreToRelease('pear-trax');
  127. $packagexml->addRelease()// add another release section for all other OSes
  128. $packagexml->addInstallAs('pear-trax''trax');
  129. $packagexml->addIgnoreToRelease('pear-trax.bat');
  130.  
  131. // create the <contents> tag
  132. $packagexml->generateContents();
  133.  
  134. // Study the Subversion .svn directories to see what goes in the
  135. // package, then write package.xml
  136. $e $packagexml->writePackageFile();
  137. if(PEAR::isError($e)) {
  138.     die($e->getMessage());
  139. }
  140.  
  141. // Make a tarball of the files listed in package.xml
  142. $packager new PEAR_Packager;
  143. $e $packager->package();
  144. if(PEAR::isError($e)) {
  145.     die($e->getMessage());
  146. }
  147.  
  148. // -- set Emacs parameters --
  149. // Local variables:
  150. // tab-width: 4
  151. // c-basic-offset: 4
  152. // c-hanging-comment-ender-p: nil
  153. // indent-tabs-mode: nil
  154. // End:
  155.  
  156. ?>

Documentation generated on Mon, 21 May 2007 22:28:44 -0600 by phpDocumentor 1.3.2