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. * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  45. * @copyright (c) Walter O. Haas 2006
  46. * @version $Id$
  47. * @author Walt Haas <haas@xmission.com>
  48. */
  49.  
  50. require_once('PEAR/PackageFileManager.php');
  51. require_once('PEAR/Packager.php');
  52.  
  53. $packagexml = new PEAR_PackageFileManager;
  54.  
  55. $e = $packagexml->setOptions(
  56. array('package' => 'PHPonTrax',
  57. 'summary' => 'Rapid Application Development Made Easy',
  58. 'description' => 'PHP port of Ruby on Rails',
  59. 'baseinstalldir' => 'PHPonTrax',
  60. 'version' => '199svn',
  61. 'packagedirectory' => '.',
  62. 'state' => 'alpha',
  63. 'filelistgenerator' => 'svn', // generate from svn
  64. 'notes' => 'We\'ve implemented many new and exciting features',
  65. 'dir_roles' => array('doc' => 'doc',
  66. 'test' => 'test',
  67. 'data' => 'data'),
  68. 'exceptions' => array('pear-trax' => 'script',
  69. 'pear-trax.bat' => 'script',
  70. 'vendor/trax/templates/error.phtml' => 'php',
  71. 'vendor/trax/templates/view.phtml' => 'php',
  72. 'vendor/trax/templates/scaffolds/add.phtml' => 'php',
  73. 'vendor/trax/templates/scaffolds/edit.phtml' => 'php',
  74. 'vendor/trax/templates/scaffolds/index.phtml' => 'php',
  75. 'vendor/trax/templates/scaffolds/layout.phtml' => 'php',
  76. 'vendor/trax/templates/scaffolds/show.phtml' => 'php',
  77. 'vendor/trax/templates/scaffolds/scaffold.css' => 'php',
  78. 'vendor/trax/templates/scaffolds/generator_templates/form_scaffolding.phtml' => 'php',
  79. 'vendor/trax/templates/scaffolds/generator_templates/layout.phtml' => 'php',
  80. 'vendor/trax/templates/scaffolds/generator_templates/view_add.phtml' => 'php',
  81. 'vendor/trax/templates/scaffolds/generator_templates/view_edit.phtml' => 'php',
  82. 'vendor/trax/templates/scaffolds/generator_templates/view_index.phtml' => 'php',
  83. 'vendor/trax/templates/scaffolds/generator_templates/view_show.phtml' => 'php',
  84. 'vendor/trax/templates/scaffolds/generator_templates/style.css' => 'php',
  85. ),
  86. 'installexceptions' => array('pear-trax' => '/',
  87. 'dispatch.php' => 'public'),
  88. 'installas' => array('pear-trax' => 'trax',
  89. 'pear-trax.bat' => 'trax')
  90. ));
  91. if (PEAR::isError($e)) {
  92. echo $e->getMessage();
  93. die();
  94.  
  95. }
  96.  
  97. // Depends on PHP 5
  98. $e = $packagexml->addDependency('php','5.0.3','ge','php','no');
  99. if (PEAR::isError($e)) {
  100. echo $e->getMessage();
  101. die();
  102.  
  103. }
  104.  
  105. // Depends on these PEAR modules
  106. $e = $packagexml->addDependency('DB','1.0');
  107. if (PEAR::isError($e)) {
  108. echo $e->getMessage();
  109. die();
  110.  
  111. }
  112. $e = $packagexml->addDependency('Mail','1.0');
  113. if (PEAR::isError($e)) {
  114. echo $e->getMessage();
  115. die();
  116.  
  117. }
  118. $e = $packagexml->addDependency('Mail_Mime','1.0');
  119. if (PEAR::isError($e)) {
  120. echo $e->getMessage();
  121. die();
  122.  
  123. }
  124. $e = $packagexml->addDependency('PHPUnit2','1.0');
  125. if (PEAR::isError($e)) {
  126. echo $e->getMessage();
  127. die();
  128.  
  129. }
  130.  
  131. // Optionally uses these PEAR modules
  132. $e = $packagexml->addDependency('PhpDocumentor','1.3.0RC4','ge','pkg','yes');
  133. if (PEAR::isError($e)) {
  134. echo $e->getMessage();
  135. die();
  136.  
  137. }
  138.  
  139. // Who maintains this package
  140. $e = $packagexml->addMaintainer('john','lead','John Peterson',
  141. 'john@mytechsupport.com');
  142. if (PEAR::isError($e)) {
  143. echo $e->getMessage();
  144. die();
  145.  
  146. }
  147.  
  148. $e = $packagexml->addMaintainer('haas','developer','Walt Haas',
  149. 'haas@xmission.com');
  150. if (PEAR::isError($e)) {
  151. echo $e->getMessage();
  152. die();
  153.  
  154. }
  155.  
  156. // Substitute local configuration values for these symbols
  157. $e = $packagexml->addGlobalReplacement('pear-config', '@BIN-DIR@',
  158. 'bin_dir');
  159. if (PEAR::isError($e)) {
  160. echo $e->getMessage();
  161. die();
  162.  
  163. }
  164.  
  165. $e = $packagexml->addGlobalReplacement('pear-config', '@DOC-DIR@',
  166. 'doc_dir');
  167. if (PEAR::isError($e)) {
  168. echo $e->getMessage();
  169. die();
  170.  
  171. }
  172.  
  173. $e = $packagexml->addGlobalReplacement('pear-config', '@PHP-DIR@',
  174. 'php_dir');
  175. if (PEAR::isError($e)) {
  176. echo $e->getMessage();
  177. die();
  178.  
  179. }
  180.  
  181. $e = $packagexml->addGlobalReplacement('pear-config', '@DATA-DIR@',
  182. 'data_dir');
  183. if (PEAR::isError($e)) {
  184. echo $e->getMessage();
  185. die();
  186.  
  187. }
  188.  
  189. $e = $packagexml->addGlobalReplacement('pear-config', '@PHP-BIN@',
  190. 'php_bin');
  191. if (PEAR::isError($e)) {
  192. echo $e->getMessage();
  193. die();
  194.  
  195. }
  196.  
  197. $e = $packagexml->addGlobalReplacement('pear-config', '@TEST-DIR@',
  198. 'test_dir');
  199. if (PEAR::isError($e)) {
  200. echo $e->getMessage();
  201. die();
  202.  
  203. }
  204.  
  205. // Platform-dependent command lines
  206. $e = $packagexml->addPlatformException('pear-trax.bat', 'windows');
  207. if (PEAR::isError($e)) {
  208. echo $e->getMessage();
  209. exit;
  210. }
  211.  
  212. $e = $packagexml->addPlatformException('pear-trax', '*ix|*ux|*BSD|Darwin');
  213. if (PEAR::isError($e)) {
  214. echo $e->getMessage();
  215. exit;
  216. }
  217.  
  218. // Study the Subversion .svn directories to see what goes in the
  219. // package, then write package.xml
  220. // (Needs: XML_Tree with patch s/clone/clone4/g)
  221. $e = $packagexml->writePackageFile();
  222. if (PEAR::isError($e)) {
  223. echo $e->getMessage();
  224. die();
  225. }
  226.  
  227. // Make a tarball of the files listed in package.xml
  228. $packager = new PEAR_Packager;
  229. $e = $packager->package();
  230. if (PEAR::isError($e)) {
  231. echo $e->getMessage();
  232. die();
  233. }
  234.  
  235. // -- set Emacs parameters --
  236. // Local variables:
  237. // tab-width: 4
  238. // c-basic-offset: 4
  239. // c-hanging-comment-ender-p: nil
  240. // indent-tabs-mode: nil
  241. // End:
  242.  
  243. ?>

Documentation generated on Thu, 04 May 2006 19:47:51 -0600 by phpDocumentor 1.3.0RC4