]> granicus.if.org Git - php/commitdiff
MFH
authorStig Bakken <ssb@php.net>
Wed, 27 Nov 2002 01:01:25 +0000 (01:01 +0000)
committerStig Bakken <ssb@php.net>
Wed, 27 Nov 2002 01:01:25 +0000 (01:01 +0000)
pear/PEAR/Common.php
pear/package-PEAR.xml
pear/package.dtd

index eeabe3c0a5be7844e6bb60115e30b87cd11d0d7c..03c47295bc14724959cc5bd4a3e619f36cbc6268 100644 (file)
@@ -119,6 +119,12 @@ class PEAR_Common extends PEAR
 
     var $current_path = null;
 
+    /**
+     * PEAR_SourceAnalyzer instance
+     * @var object
+     */
+    var $source_analyzer = null;
+
     // }}}
 
     // {{{ constructor
@@ -418,13 +424,6 @@ class PEAR_Common extends PEAR
                     $this->filelist[$this->current_path]['replacements'][] = $attribs;
                 }
                 break;
-
-            case 'libfile':
-                if (!$this->in_changelog) {
-                    $this->lib_atts = $attribs;
-                    $this->lib_atts['role'] = 'extsrc';
-                }
-                break;
             case 'maintainers':
                 $this->pkginfo['maintainers'] = array();
                 $this->m_i = 0; // maintainers array index
@@ -563,9 +562,6 @@ class PEAR_Common extends PEAR
             case 'license':
                 $this->pkginfo['release_license'] = $data;
                 break;
-            case 'sources':
-                $this->lib_sources[] = $data;
-                break;
             case 'dep':
                 if ($data && !$this->in_changelog) {
                     $this->pkginfo['release_deps'][$this->d_i]['name'] = $data;
@@ -602,37 +598,6 @@ class PEAR_Common extends PEAR
                     }
                 }
                 break;
-            case 'libfile':
-                if ($this->in_changelog) {
-                    break;
-                }
-                $path = '';
-                if (!empty($this->dir_names)) {
-                    foreach ($this->dir_names as $dir) {
-                        $path .= $dir . DIRECTORY_SEPARATOR;
-                    }
-                }
-                $path .= $this->lib_name;
-                $this->filelist[$path] = $this->lib_atts;
-                // Set the baseinstalldir only if the file don't have this attrib
-                if (!isset($this->filelist[$path]['baseinstalldir']) &&
-                    isset($this->dir_install))
-                {
-                    $this->filelist[$path]['baseinstalldir'] = $this->dir_install;
-                }
-                if (isset($this->lib_sources)) {
-                    $this->filelist[$path]['sources'] = implode(' ', $this->lib_sources);
-                }
-                unset($this->lib_atts);
-                unset($this->lib_sources);
-                unset($this->lib_name);
-                break;
-            case 'libname':
-                if ($this->in_changelog) {
-                    break;
-                }
-                $this->lib_name = $data;
-                break;
             case 'maintainer':
                 if (empty($this->pkginfo['maintainers'][$this->m_i]['role'])) {
                     $this->pkginfo['maintainers'][$this->m_i]['role'] = 'lead';
@@ -696,26 +661,28 @@ class PEAR_Common extends PEAR
     function infoFromTgzFile($file)
     {
         if (!@is_file($file)) {
-            return $this->raiseError("tgz :: could not open file \"$file\"");
+            return $this->raiseError("could not open file \"$file\"");
         }
         $tar = new Archive_Tar($file);
         $content = $tar->listContent();
         if (!is_array($content)) {
-            return $this->raiseError("tgz :: could not get contents of package \"$file\"");
+            return $this->raiseError("could not get contents of package \"$file\"");
         }
         $xml = null;
         foreach ($content as $file) {
             $name = $file['filename'];
             if ($name == 'package.xml') {
                 $xml = $name;
-            } elseif (ereg('^.*/package.xml$', $name, $match)) {
+                break;
+            } elseif (ereg('package.xml$', $name, $match)) {
                 $xml = $match[0];
+                break;
             }
         }
         $tmpdir = System::mkTemp('-d pear');
         $this->addTempFile($tmpdir);
         if (!$xml || !$tar->extractList($xml, $tmpdir)) {
-            return $this->raiseError('tgz :: could not extract the package.xml file');
+            return $this->raiseError('could not extract the package.xml file');
         }
         return $this->infoFromDescriptionFile("$tmpdir/$xml");
     }
@@ -805,6 +772,44 @@ class PEAR_Common extends PEAR
         }
         return $this->pkginfo;
     }
+    // }}}
+    // {{{ infoFromAny()
+
+    /**
+     * Returns package information from different sources
+     *
+     * This method is able to extract information about a package
+     * from a .tgz archive or from a XML package definition file.
+     *
+     * @access public
+     * @param  string Filename of the source ('package.xml', '<package>.tgz')
+     * @return string
+     */
+    function infoFromAny($info)
+    {
+        if (is_string($info) && file_exists($info)) {
+            $tmp = substr($info, -4);
+            if ($tmp == '.xml') {
+                $info = $this->infoFromDescriptionFile($info);
+            } elseif ($tmp == '.tar' || $tmp == '.tgz') {
+                $info = $this->infoFromTgzFile($info);
+            } else {
+                $fp = fopen($info, "r");
+                $test = fread($fp, 5);
+                fclose($fp);
+                if ($test == "<?xml") {
+                    $info = $this->infoFromDescriptionFile($info);
+                } else {
+                    $info = $this->infoFromTgzFile($info);
+                }
+            }
+            if (PEAR::isError($info)) {
+                return $this->raiseError($info);
+            }
+        }
+        return $info;
+    }
+
     // }}}
     // {{{ xmlFromInfo()
 
@@ -923,41 +928,34 @@ class PEAR_Common extends PEAR
         if (isset($pkginfo['filelist'])) {
             $ret .= "$indent    <filelist>\n";
             foreach ($pkginfo['filelist'] as $file => $fa) {
-                if (@$fa['role'] == 'extsrc') {
-                    $ret .= "$indent      <libfile>\n";
-                    $ret .= "$indent        <libname>$file</libname>\n";
-                    $ret .= "$indent        <sources>$fa[sources]</sources>\n";
-                    $ret .= "$indent      </libfile>\n";
+                @$ret .= "$indent      <file role=\"$fa[role]\"";
+                if (isset($fa['baseinstalldir'])) {
+                    $ret .= ' baseinstalldir="' .
+                        htmlspecialchars($fa['baseinstalldir']) . '"';
+                }
+                if (isset($fa['md5sum'])) {
+                    $ret .= " md5sum=\"$fa[md5sum]\"";
+                }
+                if (isset($fa['platform'])) {
+                    $ret .= " platform=\"$fa[platform]\"";
+                }
+                if (!empty($fa['install-as'])) {
+                    $ret .= ' install-as="' .
+                        htmlspecialchars($fa['install-as']) . '"';
+                }
+                $ret .= ' name="' . htmlspecialchars($file) . '"';
+                if (empty($fa['replacements'])) {
+                    $ret .= "/>\n";
                 } else {
-                    @$ret .= "$indent      <file role=\"$fa[role]\"";
-                    if (isset($fa['baseinstalldir'])) {
-                        $ret .= ' baseinstalldir="' .
-                             htmlspecialchars($fa['baseinstalldir']) . '"';
-                    }
-                    if (isset($fa['md5sum'])) {
-                        $ret .= " md5sum=\"$fa[md5sum]\"";
-                    }
-                    if (isset($fa['platform'])) {
-                        $ret .= " platform=\"$fa[platform]\"";
-                    }
-                    if (!empty($fa['install-as'])) {
-                        $ret .= ' install-as="' .
-                             htmlspecialchars($fa['install-as']) . '"';
-                    }
-                    $ret .= ' name="' . htmlspecialchars($file) . '"';
-                    if (empty($fa['replacements'])) {
-                        $ret .= "/>\n";
-                    } else {
-                        $ret .= ">\n";
-                        foreach ($fa['replacements'] as $r) {
-                            $ret .= "$indent        <replace";
-                            foreach ($r as $k => $v) {
-                                $ret .= " $k=\"" . htmlspecialchars($v) .'"';
-                            }
-                            $ret .= "/>\n";
+                    $ret .= ">\n";
+                    foreach ($fa['replacements'] as $r) {
+                        $ret .= "$indent        <replace";
+                        foreach ($r as $k => $v) {
+                            $ret .= " $k=\"" . htmlspecialchars($v) .'"';
                         }
-                        @$ret .= "$indent      </file>\n";
+                        $ret .= "/>\n";
                     }
+                    @$ret .= "$indent      </file>\n";
                 }
             }
             $ret .= "$indent    </filelist>\n";
@@ -966,44 +964,6 @@ class PEAR_Common extends PEAR
         return $ret;
     }
 
-    // }}}
-    // {{{ infoFromAny()
-
-    /**
-     * Returns package information from different sources
-     *
-     * This method is able to extract information about a package
-     * from a .tgz archive or from a XML package definition file.
-     *
-     * @access public
-     * @param  string Filename of the source ('package.xml', '<package>.tgz')
-     * @return string
-     */
-    function infoFromAny($info)
-    {
-        if (is_string($info) && file_exists($info)) {
-            $tmp = substr($info, -4);
-            if ($tmp == '.xml') {
-                $info = $this->infoFromDescriptionFile($info);
-            } elseif ($tmp == '.tar' || $tmp == '.tgz') {
-                $info = $this->infoFromTgzFile($info);
-            } else {
-                $fp = fopen($info, "r");
-                $test = fread($fp, 5);
-                fclose($fp);
-                if ($test == "<?xml") {
-                    $info = $this->infoFromDescriptionFile($info);
-                } else {
-                    $info = $this->infoFromTgzFile($info);
-                }
-            }
-            if (PEAR::isError($info)) {
-                return $this->raiseError($info);
-            }
-        }
-        return $info;
-    }
-
     // }}}
     // {{{ validatePackageInfo()
 
@@ -1129,12 +1089,10 @@ class PEAR_Common extends PEAR
                     $errors[] = "file $file: missing role";
                 } elseif (!in_array($fa['role'], $_PEAR_Common_file_roles)) {
                     $errors[] = "file $file: invalid role, should be one of: ".implode(' ', $_PEAR_Common_file_roles);
-                } elseif ($fa['role'] == 'extsrc' && empty($fa['sources'])) {
-                    $errors[] = "file $file: no source files";
                 }
                 // (ssb) Any checks we can do for baseinstalldir?
-                // (cox) Perhaps checks that either the target dir and baseInstall
-                //       doesn't cointain "../../"
+                // (cox) Perhaps checks that either the target dir and
+                //       baseInstall doesn't cointain "../../"
             }
         }
         return true;
index 01003e515131687a8fe4470ef5975ba56d923d56..5532498a1448929ffbbbd37de82aa1e8769c9e34 100644 (file)
     </maintainer>
   </maintainers>
   <release>
-    <version>1.0b2</version>
+    <version>1.0b3-dev</version>
     <state>stable</state>
-    <date>2002-11-26</date>
+    <date>2002-12-01</date>
     <notes>
-Changes, Installer:
-* --force option no longer ignores errors, use
-  --ignore-errors instead
-* installer transactions: failed installs abort
-  cleanly, without leaving half-installed packages
-  around
+* fixed "info" shortcut (conflicted with "install")
 </notes>
     <filelist>
       <file role="data" name="package.dtd"/>
@@ -91,6 +86,19 @@ Changes, Installer:
     </deps>
   </release>
   <changelog>
+   <release>
+     <version>1.0b2</version>
+     <state>stable</state>
+     <date>2002-11-26</date>
+     <notes>
+Changes, Installer:
+* --force option no longer ignores errors, use
+  --ignore-errors instead
+* installer transactions: failed installs abort
+  cleanly, without leaving half-installed packages
+  around
+</notes>
+   </release>
    <release>
      <version>1.0b1</version>
      <state>stable</state>
index ddeb70237197a886ebf9346818cadb480951777f..7d1f469d8fcdfba38ddd87933cb59c42364c40c6 100644 (file)
@@ -1,10 +1,10 @@
 <!--
-     $Id: package.dtd,v 1.27 2002-07-21 07:06:56 ssb Exp $
+     $Id: package.dtd,v 1.27.4.1 2002-11-27 01:01:25 ssb Exp $
 
      This is the PEAR package description, version 1.0b9.
      It should be used with the informal public identifier:
 
-         "-//PHP Group//DTD PEAR Package 1.0b9//EN//XML"
+         "-//PHP Group//DTD PEAR Package 1.0b10//EN//XML"
 
      Copyright (c) 1997-2002 The PHP Group             
 
@@ -55,9 +55,9 @@
 
 <!ELEMENT notes (#PCDATA)>
 
-<!ELEMENT filelist (dir|file|libfile)+>
+<!ELEMENT filelist (dir|file)+>
 
-<!ELEMENT dir (dir|file|libfile)+>
+<!ELEMENT dir (dir|file)+>
 <!ATTLIST dir name           CDATA #REQUIRED
               baseinstalldir CDATA #IMPLIED>
 
                   to          CDATA              #REQUIRED
                   type        CDATA              #REQUIRED>
 
-<!ELEMENT libfile (libname|sources|includes|libadd)+>
-
-<!ELEMENT libname (#PCDATA)>
-
-<!ELEMENT sources (#PCDATA)>
-
-<!ELEMENT libadd (#PCDATA)>
-
 <!ELEMENT deps (dep)+>
 
 <!ELEMENT dep (#PCDATA)>