Commit:    d08783a49b58328c466647d58ce41ce6e198f675
Author:    Anatol Belski <[email protected]>         Tue, 5 May 2015 22:33:39 +0200
Parents:   a86febd3ce1b8f074ea44270529d59ce14ab0d4a
Branches:  master pecl_legacy

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

Log:
more for PickleExt

Changed paths:
  M  client/include/PickleExt.php
  M  client/script/pickle.php


Diff:
diff --git a/client/include/PickleExt.php b/client/include/PickleExt.php
index d87d67e..ef5468d 100644
--- a/client/include/PickleExt.php
+++ b/client/include/PickleExt.php
@@ -12,6 +12,7 @@ class PickleExt
        protected $unzip_cmd = 'c:\php-sdk\bin\unzip.exe';
        protected $deplister_cmd = 'c:\apps\bin\deplister.exe';
        protected $build;
+       protected $pkg_config;
 
        protected $pickle_cmd;
 
@@ -45,12 +46,17 @@ class PickleExt
                $this->version = $m[1];
        }
 
-       public function preparePackage()
+       public function getName()
        {
+               return $this->name;
+       }
 
+       public function getVersion()
+       {
+               return $this->version;
        }
 
-       public function packLogs()
+       public function preparePackage()
        {
 
        }
@@ -80,6 +86,90 @@ class PickleExt
        {
                // pass
        }
+
+       protected function complexPkgNameMatch($cnf_name) {
+               $full_set = array(
+                       $this->build->branch->config->getBranch(),
+                       ($this->build->thread_safe ? 'ts' : 'nts'),
+                       $this->build->compiler,
+                       $this->build->architecture,
+               );
+
+if (!function_exists('rmtools\combinations')) {
+               function combinations($arr, $level, &$result, $that, 
$curr=array()) {
+                       for($i = 0; $i < count($arr); $i++) {
+                               $new = array_merge($curr, array($arr[$i]));
+                               if($level == 1) {
+                                       /* preserve order */
+                                       sort($new);
+                                       /* no repititions */
+                                       $new = array_unique($new);
+                                       $name = $that->getName() . '-' . 
implode('-', $new);
+                                       if (!in_array($name, $result)) {
+                                               $result[] = $name;
+                                       }
+                               } else {
+                                       combinations($arr, $level - 1, $result, 
$that, $new);
+                               }
+                       }
+               }
+}
+
+               $names = array();
+               for ($i = 0; $i<count($full_set); $i++) {
+                       combinations($full_set, $i+1, $names, $this);
+               }
+
+               foreach ($names as $name) {
+                       if ($name === $cnf_name) {
+                               return true;
+                       }
+               }
+
+               return false;
+       }
+
+       public function getPackageConfig()
+       {
+               $config = NULL;
+
+               if ($this->pkg_config) {
+                       return $this->pkg_config;
+               }
+
+               $known_path = __DIR__ . '/../data/config/pickle/exts.ini';
+               $exts = parse_ini_file($known_path, true, INI_SCANNER_RAW);
+
+               /* Check for like myext-5.3-ts-vc9-x86 */
+               foreach ($exts as $name => $conf) {
+                       if ($this->complexPkgNameMatch($name)) {
+                               $config = $conf;
+                               break;
+                       }
+               }
+
+               /* XXX this here might be redundant */
+               if (!$config) {
+                       foreach ($exts as $name => $conf) {
+                               if ($name === $this->name) {
+                                       $config = $conf;
+                                       break;
+                               }
+                       }
+               }
+
+               $this->pkg_config = $config;
+
+               return $config;
+       }
+
+       /* ignore me */
+       public function sendToCoventry()
+       {
+               $config = $this->getPackageConfig();
+
+               return $config && isset($config['ignore']);
+       }
 }
 
 
diff --git a/client/script/pickle.php b/client/script/pickle.php
index 16f5547..cf31435 100644
--- a/client/script/pickle.php
+++ b/client/script/pickle.php
@@ -65,7 +65,16 @@ foreach ($builds as $build_name) {
                continue;
        }
 
-       $ext->init();
+       try {
+               $ext->init();
+               var_dump($ext->getPackageConfig());
+       } catch (Exception $e) {
+               echo 'Error: ' . $e->getMessage() . PHP_EOL;
+
+               /* send error mail*/
+
+               continue;
+       }
 
        echo "Running pickle build" . PHP_EOL;


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

Reply via email to