logo       
Google Custom Search
    AddThis Social Bookmark Button

cvs: pear-core /PEAR/PackageFile/v2 Validator.php: msg#00244

Subject: cvs: pear-core /PEAR/PackageFile/v2 Validator.php
cellog          Sat May 28 18:31:04 2005 EDT

  Modified files:              
    /pear-core/PEAR/PackageFile/v2      Validator.php 
  Log:
  fix Bug #4458: packaging error message better description
  
http://cvs.php.net/diff.php/pear-core/PEAR/PackageFile/v2/Validator.php?r1=1.64&r2=1.65&ty=u
Index: pear-core/PEAR/PackageFile/v2/Validator.php
diff -u pear-core/PEAR/PackageFile/v2/Validator.php:1.64 
pear-core/PEAR/PackageFile/v2/Validator.php:1.65
--- pear-core/PEAR/PackageFile/v2/Validator.php:1.64    Fri May 20 18:15:32 2005
+++ pear-core/PEAR/PackageFile/v2/Validator.php Sat May 28 18:31:03 2005
@@ -17,7 +17,7 @@
 // |                                                                      |
 // +----------------------------------------------------------------------+
 //
-// $Id: Validator.php,v 1.64 2005/05/20 22:15:32 cellog Exp $
+// $Id: Validator.php,v 1.65 2005/05/28 22:31:03 cellog Exp $
 /**
  * Private validation class used by PEAR_PackageFile_v2 - do not use directly, 
its
  * sole purpose is to split up the PEAR/PackageFile/v2.php file to make it 
smaller
@@ -950,6 +950,20 @@
                 '*dir->name->?baseinstalldir',
                 '*file->name->role->?baseinstalldir->?md5sum'
             );
+            // do a quick test for better error message
+            if (isset($list['dir']) && isset($list['file'])) {
+                $first = false;
+                foreach ($list as $key => $tag) {
+                    if ($key == 'attribs') {
+                        continue;
+                    }
+                    $first = $key;
+                    break;
+                }
+                if ($first == 'file') {
+                    $this->_dirMustBeFirst($dirs);
+                }
+            }
         }
         if (!isset($list['attribs']) || !isset($list['attribs']['name'])) {
             $unknown = $allowignore ? '<filelist>' : '<dir name="*unknown*">';
@@ -1564,6 +1578,15 @@
             '%tag% cannot conflict with all OSes');
     }
 
+    function _dirsMustBeFirst($dir)
+    {
+        if (!$dir) {
+            $dir = '/';
+        }
+        $this->_stack->push(__FUNCTION__, 'error', array('dir' => $dir),
+            'In <dir name="%dir%">, child <dir> tags must precede child <file> 
tags');
+    }
+
     function _analyzeBundledPackages()
     {
         if (!$this->_isValid) {




Try Searching:
servers, voip, java, networking, microsoft ...
<Prev in Thread] Current Thread [Next in Thread>