fixed #LOG4PHP-44 (initial version of PEAR packaging)
authorKnut Urdalen <kurdalen@apache.org>
Tue, 19 May 2009 07:57:10 +0000 (07:57 +0000)
committerKnut Urdalen <kurdalen@apache.org>
Tue, 19 May 2009 07:57:10 +0000 (07:57 +0000)
git-svn-id: https://svn.apache.org/repos/asf/incubator/log4php/trunk@776223 13f79535-47bb-0310-9956-ffa450edef68

CHANGELOG
build.xml
package-config.php [new file with mode: 0644]
package.php [new file with mode: 0644]

index ba25e19..5c8bacd 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -31,6 +31,7 @@ Version 2.0 to be released
 - Enh #38: Replace is_a() with instanceof (Knut Urdalen)
 - Enh #39: Remove deprecated methods (Knut Urdalen)
 - Enh #40: Merge LoggerAppender and LoggerAppenderSkeleton (Christian Grobmeier)
+- Enh #44: PEAR package (Knut Urdalen)
 - Enh: Initial port to PHP 5 (Knut Urdalen)
 - Enh: Established new unit test suite (Knut Urdalen)
 - Enh: Added a range of examples (Knut Urdalen)
index 26a79c7..0ab1f42 100644 (file)
--- a/build.xml
+++ b/build.xml
                    <arg value="commit"/>
                </exec>
        </target>
-        
+       
+       <target name="pear-package">
+               <delete dir="target/pear"/>
+               <mkdir dir="target/pear/log4php"/>
+               <copy file="package.php" todir="target/pear"/>
+               <copy file="package-config.php" todir="target/pear"/>
+               <copy file="CHANGELOG" todir="target/pear"/>
+               <copy file="LICENSE" todir="target/pear"/>
+               <copy file="README" todir="target/pear"/>
+               <copy todir="target/pear">
+                       <fileset dir="src">
+                               <include name="examples/**/*"/>
+                       </fileset>
+               </copy>
+               <copy todir="target/pear/log4php">
+                       <fileset dir="src/main/php">
+                               <include name="**/*.php"/>
+                       </fileset>
+               </copy>
+               <exec executable="php" dir="target/pear" output="package.xml">
+                       <arg line="package.php"/>
+               </exec>
+               <exec executable="pear" dir="target/pear">
+                       <arg line="package"/>
+               </exec>
+       </target>
+
 </project>
diff --git a/package-config.php b/package-config.php
new file mode 100644 (file)
index 0000000..693bb66
--- /dev/null
@@ -0,0 +1,82 @@
+<?php
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+$name = 'log4php';
+$summary = 'log4Php is a PHP port of log4j framework';
+$version = '2.0.0';
+$versionBuild = 'b1';
+$apiVersion = '2.0.0';
+$state = 'beta';
+$apiStability = 'stable';
+
+$description = <<<EOT
+log4Php is a PHP port of log4j framework. It supports XML configuration, 
+logging to files, stdout/err, syslog, socket, configurable output layouts 
+and logging levels.
+EOT;
+
+$notes = <<<EOT
+Changes since 0.9:
+ - 
+EOT;
+
+$options = array(
+       'license' => 'Apache License 2.0',
+       //'filelistgenerator' => 'svn',
+       'ignore' => array('package.php', 'package-config.php'),
+       'simpleoutput' => true,
+       'baseinstalldir' => '/',
+       'packagedirectory' => '.',
+       'dir_roles' => array(
+               'examples' => 'doc',
+       ),
+       'exceptions' => array(
+               'CHANGELOG' => 'doc',
+               'LICENSE' => 'doc',
+               'README' => 'doc',
+       ),
+);
+
+$license = array(
+       'name' => 'Apache License 2.0',
+       'url' => 'http://www.apache.org/licenses/LICENSE-2.0'
+);
+
+$maintainer = array();
+$maintainer[]  =   array(
+       'role' => 'lead',
+       'handle' => 'kurdalen',
+       'name' => 'Knut Urdalen',
+       'email' => 'kurdalen@apache.org',
+       'active' => 'yes'
+);
+$maintainer[]   =   array(
+       'role' => 'lead',
+       'handle' => 'grobmeier',
+       'name' => 'Christian Grobmeier',
+       'email' => 'grobmeier@gmail.com',
+       'active' => 'yes'
+);
+
+$dependency = array();
+
+$channel = 'pear.php.net';
+$require = array(
+       'php' => '5.2.0',
+       'pear_installer' => '1.8.0',
+);
diff --git a/package.php b/package.php
new file mode 100644 (file)
index 0000000..1ce1b28
--- /dev/null
@@ -0,0 +1,71 @@
+<?php
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+@include 'PEAR/PackageFileManager2.php';
+if(!class_exists('PEAR_PackageFileManager2')) {
+       echo "\nYou need to install PEAR_PackageFileManager2 in order to run this script\n\n";
+       echo "Installation tips:\n\n";
+       echo "  $ sudo pear upgrade PEAR\n";
+       echo "  $ sudo pear install XML_Serializer-0.19.2\n";
+       echo "  $ sudo pear install --alldeps PEAR_PackageFileManager2\n\n";
+       exit(0);
+}
+
+include dirname(__FILE__).'/package-config.php';
+
+$package = new PEAR_PackageFileManager2();
+$result = $package->setOptions($options);
+if(PEAR::isError($result)) {
+    echo $result->getMessage();
+    die( __LINE__ . "\n" );
+}
+
+$package->setPackage($name);
+$package->setSummary($summary);
+$package->setDescription($description);
+
+$package->setChannel($channel);
+$package->setAPIVersion($apiVersion);
+$package->setReleaseVersion($version);
+$package->setReleaseStability($state);
+$package->setAPIStability($apiStability);
+$package->setNotes($notes);
+$package->setPackageType('php'); // this is a PEAR-style php script package
+$package->setLicense($license['name'], $license['url']);
+
+foreach($maintainer as $m) {
+       $package->addMaintainer($m['role'], $m['handle'], $m['name'], $m['email'], $m['active']);
+}
+
+foreach($dependency as $d) {
+    $package->addPackageDepWithChannel($d['type'], $d['package'], $d['channel'], $d['version']);
+}
+
+$package->setPhpDep( $require['php'] );
+$package->setPearinstallerDep($require['pear_installer']);
+
+$package->generateContents();
+
+$package->debugPackageFile();
+
+$result = $package->writePackageFile();
+if(PEAR::isError($result)) {
+    echo $result->getMessage();
+    die();
+}
+exit(0);