4 date_default_timezone_set('UTC');
9 foreach($argv as $index=>$arg) {
10 if ($index==0) continue;
19 if (is_null($packageName)) {
20 echo "A packagename is required\n";
24 if (!is_dir('build/' . $packageName)) {
25 echo "Could not find package directory: build/$packageName\n";
29 // We'll figure out something better for this one day
31 $dependencies = array(
37 'type' => 'pearinstaller',
43 switch($packageName) {
46 $summary = 'Sabretooth base package.';
47 $description = <<<TEXT
48 The base package provides some functionality used by all packages.
50 Currently this is only an autoloader
53 $stability = 'stable';
57 $summary = 'Sabre_DAV is a WebDAV framework for PHP.';
58 $description = <<<TEXT
59 SabreDAV allows you to easily integrate WebDAV access into your existing PHP application.
62 * Fully WebDAV (class 1, 2, 3) compliant
63 * Supports Windows clients, OS/X, DavFS, Cadaver, and pretty much everything we've come accross
64 * Custom property support
66 * Authentication support
69 $dependencies[] = array(
72 'channel' => 'pear.sabredav.org',
75 $dependencies[] = array(
77 'name' => 'Sabre_HTTP',
78 'channel' => 'pear.sabredav.org',
85 $summary = 'Sabre_HTTP provides various HTTP helpers, for input and output and authentication';
86 $description = <<<TEXT
87 Sabre_HTTP effectively wraps around \$_SERVER, php://input, php://output and the headers method,
88 allowing for a central interface to deal with this as well as easier unittesting.
90 In addition Sabre_HTTP provides classes for Basic, Digest and Amazon AWS authentication.
92 $dependencies[] = array(
95 'channel' => 'pear.sabredav.org',
100 case 'Sabre_DAVACL' :
101 $summary = 'Sabre_DAVACL provides rfc3744 support.';
102 $description = <<<TEXT
103 Sabre_DAVACL is the RFC3744 implementation for SabreDAV. It provides principals
104 (users and groups) and access control.
106 $dependencies[] = array(
109 'channel' => 'pear.sabredav.org',
112 $dependencies[] = array(
114 'name' => 'Sabre_DAV',
115 'channel' => 'pear.sabredav.org',
120 case 'Sabre_CalDAV' :
121 $summary = 'Sabre_CalDAV provides CalDAV extensions to SabreDAV';
122 $description = <<<TEXT
123 Sabre_CalDAV provides RFC4791 (CalDAV) support to Sabre_DAV.
126 * Multi-user Calendar Server
127 * Support for Apple iCal, Evolution, Sunbird, Lightning
130 $dependencies[] = array(
133 'channel' => 'pear.sabredav.org',
136 $dependencies[] = array(
138 'name' => 'Sabre_HTTP',
139 'channel' => 'pear.sabredav.org',
142 $dependencies[] = array(
144 'name' => 'Sabre_DAV',
145 'channel' => 'pear.sabredav.org',
148 $dependencies[] = array(
150 'name' => 'Sabre_DAVACL',
151 'channel' => 'pear.sabredav.org',
154 $dependencies[] = array(
156 'name' => 'Sabre_VObject',
157 'channel' => 'pear.sabredav.org',
162 case 'Sabre_CardDAV' :
163 $summary = 'Sabre_CardDAV provides CardDAV extensions to SabreDAV';
164 $description = <<<TEXT
165 Sabre_CardDAV provides CardDAV support to Sabre_DAV.
168 * Multi-user addressbook server
170 * Support for OS/X, iOS, Evolution and probably more
171 * Hook-ins for creating a global \'directory\'.
174 $dependencies[] = array(
177 'channel' => 'pear.sabredav.org',
180 $dependencies[] = array(
182 'name' => 'Sabre_HTTP',
183 'channel' => 'pear.sabredav.org',
186 $dependencies[] = array(
188 'name' => 'Sabre_DAV',
189 'channel' => 'pear.sabredav.org',
192 $dependencies[] = array(
194 'name' => 'Sabre_DAVACL',
195 'channel' => 'pear.sabredav.org',
198 $dependencies[] = array(
200 'name' => 'Sabre_VObject',
201 'channel' => 'pear.sabredav.org',
206 case 'Sabre_VObject' :
207 $summary = 'Sabre_VObject is a natural-interface iCalendar and vCard reader';
208 $description = <<<TEXT
209 Sabre_VObject is an intuitive reader for iCalendar and vCard objects.
211 It provides a natural array/object accessor interface to the parsed tree, much like
212 simplexml for XML files.
214 $dependencies[] = array(
217 'channel' => 'pear.sabredav.org',
225 if (!isset($version)) {
226 include 'lib/' . str_replace('_','/',$packageName) . '/Version.php';
227 $versionClassName = $packageName . '_Version';
228 $version = $versionClassName::VERSION;
229 $stability = $versionClassName::STABILITY;
233 $lead_email = 'evert@rooftopsolutions.nl';
234 $date = date('Y-m-d');
236 $license = 'Modified BSD';
237 $licenseuri = 'http://code.google.com/p/sabredav/wiki/License';
238 $notes = 'New release. Read the ChangeLog and announcement for more details';
239 $channel = 'pear.sabredav.org';
241 /* This function is intended to generate the full file list */
242 function parsePath($fullPath, $role, $padding = 4) {
245 $file = basename($fullPath);
246 if (is_dir($fullPath)) {
247 $fileList .= str_repeat(' ', $padding) . "<dir name=\"{$file}\">\n";
248 foreach(scandir($fullPath) as $subPath) {;
249 if ($subPath==='.' || $subPath==='..') continue;
250 $fileList .= parsePath($fullPath. '/' . $subPath,$role, $padding+2);
252 $fileList .= str_repeat(' ', $padding) . "</dir><!-- {$file} -->\n";
253 } elseif (is_file($fullPath)) {
254 $fileList .= str_repeat(' ', $padding) . "<file name=\"{$file}\" role=\"{$role}\" />\n";
261 $rootDir = realpath('build/' . $packageName);
263 $fileList = parsePath($rootDir . '/Sabre', 'php');
264 $fileList .= parsePath($rootDir . '/examples', 'doc');
265 $fileList .= parsePath($rootDir . '/ChangeLog', 'doc');
266 $fileList .= parsePath($rootDir . '/LICENSE', 'doc');
268 $dependenciesXML = "\n";
269 foreach($dependencies as $dep) {
271 $dependenciesXML.=str_repeat(' ',$pad) . '<' . $dep['type'] . ">\n";
272 foreach($dep as $key=>$value) {
273 if ($key=='type') continue;
274 $dependenciesXML.=str_repeat(' ',$pad+2) . "<$key>$value</$key>\n";
276 $dependenciesXML.=str_repeat(' ',$pad) . '</' . $dep['type'] . ">\n";
280 <?xml version="1.0"?>
281 <package version="2.0"
282 xmlns="http://pear.php.net/dtd/package-2.0">
284 <name>{$packageName}</name>
285 <channel>{$channel}</channel>
286 <summary>{$summary}</summary>
287 <description>{$description}</description>
291 <email>{$lead_email}</email>
292 <active>true</active>
296 <release>{$version}</release>
297 <api>{$version}</api>
300 <release>{$stability}</release>
301 <api>{$stability}</api>
303 <license uri="{$licenseuri}">{$license}</license>
304 <notes>{$notes}</notes>
306 <dir name="/">{$fileList}
310 <required>{$dependenciesXML}
317 if (isset($argv) && in_array('make',$argv)) {
318 file_put_contents($rootDir . '/package.xml',$package);