Commit:    bdf1791834c3f2d55dd48a23f6afaa9bb5df8553
Author:    Anatol Belski <[email protected]>         Fri, 13 Sep 2013 18:11:19 +0200
Parents:   964e90816da0876f85db44ac173fbf6b7fa6369d
Branches:  master

Link:       
http://git.php.net/?p=web/rmtools.git;a=commitdiff;h=bdf1791834c3f2d55dd48a23f6afaa9bb5df8553

Log:
implemented force name and version

Changed paths:
  M  client/include/PeclExt.php


Diff:
diff --git a/client/include/PeclExt.php b/client/include/PeclExt.php
index 7ecd764..def0c16 100644
--- a/client/include/PeclExt.php
+++ b/client/include/PeclExt.php
@@ -24,7 +24,7 @@ class PeclExt
        protected $configure_data = NULL;
        protected $non_core_ext_deps = array();
 
-       public function __construct($pgk_path, $build)
+       public function __construct($pgk_path, $build, $force_name = NULL, 
$force_version = NULL)
        {
                if (!file_exists($pgk_path)) {
                        throw new \Exception("'$pgk_path' does not exist");
@@ -49,13 +49,19 @@ class PeclExt
                $this->unpack();
                $this->check();
 
+
+               $this->name = $force_name;
+               $this->version = $force_version;
+
                /* Setup some stuff */
-               if ($this->package_xml) {
+               if (!$this->name && $this->package_xml) {
                        $this->name = 
(string)$this->getPackageXmlProperty("name");
+               }
+               if (!$this->version && $this->package_xml) {
                        $this->version = 
(string)$this->getPackageXmlProperty("version", "release");
                }
 
-               if (!$this->name || !$this->version) {
+               if (!$this->name) {
                        /* This is the fallback if there's no package.xml  */
                        if (!$this->name) {
                                $config_w32_path = $this->tmp_extract_path . 
DIRECTORY_SEPARATOR . 'config.w32';
@@ -67,13 +73,13 @@ class PeclExt
                                }
                        }
 
+                       /* give up */
                        if (!$this->name) {
                                throw new \Exception("Couldn't reliably 
determine the package name, please fix or add package.xml");
                        }
-
-                       if (!$this->version) {
-                               $this->version = date('Ymd');
-                       }
+               }
+               if (!$this->version) {
+                       $this->version = date('Ymd');
                }
 
                $config = $this->getPackageConfig();


--
PHP Webmaster List Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to