| 1 |
lars |
1 |
#!/usr/bin/php -q
|
|
|
2 |
<?php
|
|
|
3 |
/* vim: set noai expandtab tabstop=4 softtabstop=4 shiftwidth=4: */
|
|
|
4 |
/**
|
|
|
5 |
* Script to generate package.xml file
|
|
|
6 |
*
|
|
|
7 |
* Parts taken from Limb PHP Framework http://limb-project.com
|
|
|
8 |
* More info
|
|
|
9 |
* http://www.developertutorials.com/pear-manual/developers.packagedef.html
|
|
|
10 |
* http://blog.astrumfutura.com/plugin/blogpdf
|
|
|
11 |
* http://trac.piece-framework.com/piece-unity/browser/trunk/package.php?rev=887
|
|
|
12 |
*
|
|
|
13 |
* PHP version 5
|
|
|
14 |
*
|
|
|
15 |
* @category System
|
|
|
16 |
* @package System_Daemon
|
|
|
17 |
* @author Kevin <kevin@vanzonneveld.net>
|
|
|
18 |
* @copyright 2008 Kevin van Zonneveld (http://kevin.vanzonneveld.net)
|
|
|
19 |
* @license http://www.opensource.org/licenses/bsd-license.php New BSD Licence
|
|
|
20 |
* @version SVN: Release: $Id: package_gen.php 169 2009-02-08 20:31:54Z kevin $
|
|
|
21 |
* @link http://trac.plutonia.nl/projects/system_daemon
|
|
|
22 |
*/
|
|
|
23 |
|
|
|
24 |
$workspace_dir = realpath(dirname(__FILE__)."/..");
|
|
|
25 |
|
|
|
26 |
list($name, $baseVersion, $state) = explode("-",
|
|
|
27 |
trim(file_get_contents($workspace_dir . "/docs/VERSION")));
|
|
|
28 |
|
|
|
29 |
$notes = file_get_contents($workspace_dir .
|
|
|
30 |
"/docs/NOTES");
|
|
|
31 |
$summary = file_get_contents($workspace_dir .
|
|
|
32 |
"/docs/SUMMARY");
|
|
|
33 |
$description = file_get_contents($workspace_dir .
|
|
|
34 |
"/docs/DESCRIPTION");
|
|
|
35 |
$maintainers = file($workspace_dir . "/docs/MAINTAINERS");
|
|
|
36 |
|
|
|
37 |
$version = $baseVersion . (isset($argv[3]) ? $argv[3] : "");
|
|
|
38 |
$dir = $workspace_dir;
|
|
|
39 |
|
|
|
40 |
$apiVersion = $baseVersion;
|
|
|
41 |
$apiStability = $state;
|
|
|
42 |
|
|
|
43 |
if (!include("PEAR/PackageFileManager2.php")) {
|
|
|
44 |
die("Please: pear install -f PEAR_PackageFileManager-2");
|
|
|
45 |
}
|
|
|
46 |
PEAR::setErrorHandling(PEAR_ERROR_DIE);
|
|
|
47 |
|
|
|
48 |
$options = array(
|
|
|
49 |
"package" => $name,
|
|
|
50 |
"summary" => $summary,
|
|
|
51 |
"version" => $version,
|
|
|
52 |
"state" => $state,
|
|
|
53 |
"description" => $description,
|
|
|
54 |
"notes" => $notes,
|
|
|
55 |
"filelistgenerator" => "svn",
|
|
|
56 |
"ignore" => array( "package2.php",
|
|
|
57 |
"package.php",
|
|
|
58 |
"package.xml",
|
|
|
59 |
"catalog.xml",
|
|
|
60 |
"*.tgz",
|
|
|
61 |
".svn",
|
|
|
62 |
".project",
|
|
|
63 |
"nbproject",
|
|
|
64 |
"docs",
|
|
|
65 |
"tools"
|
|
|
66 |
),
|
|
|
67 |
"simpleoutput" => true,
|
|
|
68 |
"clearcontents" => true,
|
|
|
69 |
"baseinstalldir" => "./",
|
|
|
70 |
"packagedirectory" => $workspace_dir,
|
|
|
71 |
"packagefile" => "package.xml",
|
|
|
72 |
"dir_roles" => array(
|
|
|
73 |
"docs" => "doc",
|
|
|
74 |
"examples" => "doc",
|
|
|
75 |
"tests" => "test",
|
|
|
76 |
"data" => "data"
|
|
|
77 |
),
|
|
|
78 |
"roles" => array(
|
|
|
79 |
"*" => "php"
|
|
|
80 |
)
|
|
|
81 |
);
|
|
|
82 |
|
|
|
83 |
|
|
|
84 |
$packagexml = new PEAR_PackageFileManager2;
|
|
|
85 |
$e = $packagexml->setOptions($options);
|
|
|
86 |
|
|
|
87 |
// Oddly enough, this is a PHP source code package...
|
|
|
88 |
$packagexml->setPackageType("php");
|
|
|
89 |
// Package name, summary and longer description
|
|
|
90 |
$packagexml->setPackage($name);
|
|
|
91 |
$packagexml->setSummary($summary);
|
|
|
92 |
$packagexml->setDescription($description);
|
|
|
93 |
// The channel where this package is hosted. Since we"re installing from a local
|
|
|
94 |
// downloaded file rather than a channel we"ll pretend it"s from PEAR.
|
|
|
95 |
$packagexml->setChannel("pear.php.net");
|
|
|
96 |
|
|
|
97 |
foreach ($maintainers as $line) {
|
|
|
98 |
list($role, $nick, $name, $email, $active) = explode(",", $line);
|
|
|
99 |
$packagexml->addMaintainer($role, $nick, $name, $email, $active);
|
|
|
100 |
}
|
|
|
101 |
|
|
|
102 |
$packagexml->setNotes($notes);
|
|
|
103 |
// Add any known dependencies such as PHP version, extensions, PEAR installer
|
|
|
104 |
$packagexml->setPhpDep("5.1.2"); // spl_autoload_register
|
|
|
105 |
$packagexml->setPearinstallerDep("1.4.0");
|
|
|
106 |
$packagexml->setOSInstallCondition("(*ix|*ux|darwin*|*BSD|SunOS*)");
|
|
|
107 |
$packagexml->addPackageDepWithChannel("optional", "Log", "pear.php.net", "1.0");
|
|
|
108 |
|
|
|
109 |
// Other info, like the Lead Developers. license, version details
|
|
|
110 |
// and stability type
|
|
|
111 |
$packagexml->setLicense("New BSD License",
|
|
|
112 |
"http://opensource.org/licenses/bsd-license.php");
|
|
|
113 |
$packagexml->setAPIVersion($baseVersion);
|
|
|
114 |
$packagexml->setAPIStability($state);
|
|
|
115 |
$packagexml->setReleaseVersion($baseVersion);
|
|
|
116 |
$packagexml->setReleaseStability($state);
|
|
|
117 |
// Add this as a release, and generate XML content
|
|
|
118 |
$packagexml->addRelease();
|
|
|
119 |
|
|
|
120 |
$packagexml->generateContents();
|
|
|
121 |
|
|
|
122 |
if (isset($_GET["make"])
|
|
|
123 |
|| (isset($_SERVER["argv"])
|
|
|
124 |
&& @$_SERVER["argv"][1] == "make")) {
|
|
|
125 |
$packagexml->writePackageFile();
|
|
|
126 |
} else {
|
|
|
127 |
$packagexml->debugPackageFile();
|
|
|
128 |
}
|
|
|
129 |
?>
|