cvs: peardoc /en/guide/developers/package2 dependencies.xml

From: Date: Sun, 20 Mar 2005 01:05:13 +0000
Subject: cvs: peardoc /en/guide/developers/package2 dependencies.xml
Groups: php.pear.doc 
Request: Send a blank email to pear-doc+get-5702@lists.php.net to get a copy of this message
cellog Sat Mar 19 20:05:13 2005 EDT Modified files: /peardoc/en/guide/developers/package2 dependencies.xml Log: finish dependencies docs (Whew)

http://cvs.php.net/diff.php/peardoc/en/guide/developers/package2/dependencies.xml?r1=1.2&r2=1.3&ty=u Index: peardoc/en/guide/developers/package2/dependencies.xml diff -u peardoc/en/guide/developers/package2/dependencies.xml:1.2 peardoc/en/guide/developers/package2/dependencies.xml:1.3 --- peardoc/en/guide/developers/package2/dependencies.xml:1.2 Fri Mar 18 22:00:57 2005 +++ peardoc/en/guide/developers/package2/dependencies.xml Sat Mar 19 20:05:12 2005 @@ -1,4 +1,4 @@ -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <refentry id="guide.developers.package2.dependencies"> <refnamediv> <refname>&lt;dependencies&gt;</refname> @@ -232,80 +232,329 @@ </listitem> </orderedlist> </para> - <para> - Let's look at the third kind of package dependency first. Here is a simple example: - </para> - <para> - <programlisting role="xml"> - <![CDATA[ + <refsect3 id="guide.developers.package2.dependencies.package.channel"> + <title>channel-based &lt;package&gt; depedendencies</title> + <para> + The most common kind of package dependency is a channel-based dependency. This dependency + from package.xml version 1.0: + </para> + <para> + <programlisting role="xml"> + <![CDATA[ +<deps> + <dep type="pkg" rel="has">PEAR</dep> +</deps> + ]]> + </programlisting> + </para> + <para> + translates to this dependency in package.xml version 2.0: + </para> + <para> + <programlisting role="xml"> + <![CDATA[ +<dependencies> + <required> +<!-- ... --> + <package> + <name>PEAR</name> + <channel>pear.php.net</channel> + </package> + </required> +</dependencies> + ]]> + </programlisting> + </para> + <para> + Note that &lt;channel&gt; is a required tag for all typical package dependencies. Use pear.php.net + for all packages that were packaged using package.xml 1.0, regardless of where they are downloaded + from. + </para> + <para> + As with all dependency tags that support versioning, these 4 tags are supported to define + versioning: + </para> + <para> + <itemizedlist> + <listitem> + <para> + &lt;min&gt; - minimum version of a dependency. If the dependency package is installed, and + is older than this version, installation will fail. + </para> + </listitem> + <listitem> + <para> + &lt;max&gt; - maximum version of a dependency. If the dependency package is installed, and + is newer than this version, installation will fail. + </para> + </listitem> + <listitem> + <para> + &lt;recommended&gt; - recommended version of a dependency. This tag is used for strict + version control. The installer will refuse to install a package without the --force + option unless the version exactly matches recommended. This can be used to provide a level + of extra security, as a package can be set to install using a version that is known to work + without limiting future upgrades. + </para> + <para> + Note that use of the <link linkend="guide.developers.package2.compatible">&lt;compatible&gt;</link> + tag in the dependency's package.xml can be used + to circumvent the installer's strictness. In essence, the &lt;compatible&gt; tag tells the + installer that a dependent package is compatible with the current package, even though + it is not the recommended version. + </para> + </listitem> + <listitem> + <para> + &lt;exclude&gt; - incompatible versions of a package. Multiple + &lt;exclude&gt; tags may be used to exclude more than one version of a dependency. + </para> + </listitem> + </itemizedlist> + </para> + <para> + Here is a rough chart describing how to convert from package.xml 1.0 &quot;rel&quot; attributes + to a package.xml 2.0 equivalent. + </para> + <para> + <table id="guide.developers.package2.dependencies.package.convert"> + <title>Converting package.xml 1.0 package dependencies to package.xml 2.0</title> + <tgroup cols="2"> + <thead> + <row> + <entry>1.0</entry> + <entry>2.0 equivalent</entry> + </row> + </thead> + <tbody> + <row> + <entry> + <programlisting role="xml"> + <![CDATA[<dep type="pkg" rel="has">Foo</dep>]]> + </programlisting> + </entry> + <entry> + <programlisting role="xml"> + <![CDATA[ +<package> + <name>Foo</name> + <channel>pear.php.net</channel> +</package> + ]]> + </programlisting> + </entry> + </row> + <row> + <entry> + <programlisting role="xml"> + <![CDATA[<dep type="pkg" rel="ge" version="1.0.0">Foo</dep>]]> + </programlisting> + </entry> + <entry> + <programlisting role="xml"> + <![CDATA[ +<package> + <name>Foo</name> + <channel>pear.php.net</channel> + <min>1.0.0</min> +</package> + ]]> + </programlisting> + </entry> + </row> + <row> + <entry> + <programlisting role="xml"> + <![CDATA[<dep type="pkg" rel="gt" version="1.0.0">Foo</dep>]]> + </programlisting> + </entry> + <entry> + <programlisting role="xml"> + <![CDATA[ +<package> + <name>Foo</name> + <channel>pear.php.net</channel> + <min>1.0.0</min> + <exclude>1.0.0</exclude> +</package> + ]]> + </programlisting> + </entry> + </row> + <row> + <entry> + <programlisting role="xml"> + <![CDATA[<dep type="pkg" rel="le" version="1.0.0">Foo</dep>]]> + </programlisting> + </entry> + <entry> + <programlisting role="xml"> + <![CDATA[ +<package> + <name>Foo</name> + <channel>pear.php.net</channel> + <max>1.0.0</max> +</package> + ]]> + </programlisting> + </entry> + </row> + <row> + <entry> + <programlisting role="xml"> + <![CDATA[<dep type="pkg" rel="ge" version="1.0.0">Foo</dep>]]> + </programlisting> + </entry> + <entry> + <programlisting role="xml"> + <![CDATA[ +<package> + <name>Foo</name> + <channel>pear.php.net</channel> + <max>1.0.0</max> + <exclude>1.0.0</exclude> +</package> + ]]> + </programlisting> + </entry> + </row> + <row> + <entry> + <programlisting role="xml"> + <![CDATA[ +<dep type="pkg" rel="ge" version="1.0.0">Foo</dep> +<dep type="pkg" rel="le" version="1.9.0">Foo</dep> + ]]> + </programlisting> + </entry> + <entry> + <programlisting role="xml"> + <![CDATA[ +<package> + <name>Foo</name> + <channel>pear.php.net</channel> + <min>1.0.0</min> + <max>1.9.0</max> +</package> + ]]> + </programlisting> + </entry> + </row> + <row> + <entry> + <programlisting role="xml"> + <![CDATA[ +<dep type="pkg" rel="not">Foo</dep> + ]]> + </programlisting> + </entry> + <entry> + <programlisting role="xml"> + <![CDATA[ +<package> + <name>Foo</name> + <channel>pear.php.net</channel> + <conflicts/> +</package> + ]]> + </programlisting> + </entry> + </row> + </tbody> + </tgroup> + </table> + </para> + </refsect3> + <refsect3 id="guide.developers.package2.dependencies.package.uri"> + <title>uri-based &lt;package&gt; dependencies</title> + <para> + Let's look at uri-based package dependencies. Here is a simple example: + </para> + <para> + <programlisting role="xml"> + <![CDATA[ <package> <name>Foo<name> <uri>http://www.example.com/Foo-1.3.0</uri> </package> - ]]> - </programlisting> - </para> - <para> - This dependency tells the installer to fetch http://www.example.com/Foo-1.3.0.tgz or - http://www.example.com/Foo-1.3.0.tar (both must be available!) if the package Foo - is not installed. All uri packages must contain a - <link linkend="guide.developers.package2.uri">&lt;uri&gt;</link> tag rather than a - <link linkend="guide.developers.package2.channel">&lt;channel&gt;</link> tag and will - automatically belong to the pseudo-channel &quot;__uri&quot;, but that is not important to - the discussion of how to format the xml to create the uri-based package dependency. - </para> - <para> - uri-based package dependencies cannot contain any versioning information, as this is irrelevant: - there is only one version possible with a static uri. uri-based dependencies can contain the - &lt;conflicts/&gt; tag to specify an absolute conflict with the package, and the - &lt;providesextension&gt; tag to specify an extension provided by the static package. - </para> - <para> - The channel server-based packages and PHP extension dependency documentation is not yet - finished, but will be soon. - </para> - <para> - As with all dependency tags that support - versioning, these 4 tags are supported to define versioning: - </para> - <para> - <itemizedlist> - <listitem> - <para> - &lt;min&gt; - minimum version of a dependency. If the dependency package is installed, and - is older than this version, installation will fail. - </para> - </listitem> - <listitem> - <para> - &lt;max&gt; - maximum version of a dependency. If the dependency package is installed, and - is newer than this version, installation will fail. - </para> - </listitem> - <listitem> - <para> - &lt;recommended&gt; - recommended version of a dependency. This tag is used for strict - version control. The installer will refuse to install a package without the --force - option unless the version exactly matches recommended. This can be used to provide a level - of extra security, as a package can be set to install using a version that is known to work - without limiting future upgrades. - </para> - <para> - Note that use of the <link linkend="guide.developers.package2.compatible">&lt;compatible&gt;</link> - tag in the dependency's package.xml can be used - to circumvent the installer's strictness. In essence, the &lt;compatible&gt; tag tells the - installer that a dependent package is compatible with the current package, even though - it is not the recommended version. - </para> - </listitem> - <listitem> - <para> - &lt;exclude&gt; - incompatible versions of a package. Multiple - &lt;exclude&gt; tags may be used to exclude more than one version of a dependency. - </para> - </listitem> - </itemizedlist> - </para> + ]]> + </programlisting> + </para> + <para> + This dependency tells the installer to fetch http://www.example.com/Foo-1.3.0.tgz or + http://www.example.com/Foo-1.3.0.tar (both must be available!) if the package Foo + is not installed. All uri packages must contain a + <link linkend="guide.developers.package2.uri">&lt;uri&gt;</link> tag rather than a + <link linkend="guide.developers.package2.channel">&lt;channel&gt;</link> tag and will + automatically belong to the pseudo-channel &quot;__uri&quot;, but that is not important to + the discussion of how to format the xml to create the uri-based package dependency. + </para> + <para> + uri-based package dependencies cannot contain any versioning information, as this is irrelevant: + there is only one version possible with a static uri. uri-based dependencies can contain the + &lt;conflicts/&gt; tag to specify an absolute conflict with the package, and the + &lt;providesextension&gt; tag to specify an extension provided by the static package. + </para> + </refsect3> + <refsect3 id="guide.developers.package2.dependencies.package.phporext"> + <title>PEAR-style &lt;package&gt; dependencies vs. PECL-style &lt;package&gt; dependencies</title> + <para> + package.xml 2.0 supports differentiating + <link linkend="guide.developers.package2.release">release types</link>, and as such also + supports dependencies on PECL-style packages that use the extbinrelease or extsrcrelease type. + </para> + <para> + To specify a dependency on a PHP extension that <emphasis>can be</emphasis> distributed as + a PECL package, but could also be bundled with PHP by default, such as the PDO extension, + use this dependency style: + </para> + <para> + <programlisting role="xml"> + <![CDATA[ +<package> + <name>PDO</name> + <channel>pecl.php.net</channel> + <min>0.3.1</min> + <providesextension>PDO</providesextension> +</package> + ]]> + </programlisting> + </para> + <para> + The magic is in the &lt;providesextension&gt; tag. This tag tells the installer to take this + process when validating the dependency: + <orderedlist> + <listitem> + <para> + Is the extension &quot;PDO&quot; present in memory? If so, is it version 0.3.1 or higher? + </para> + </listitem> + <listitem> + <para> + If not, is the user also installing pecl.php.net/PDO at the same time as this package? If + so, is it version 0.3.1 or higher? + </para> + </listitem> + <listitem> + <para> + If not, is pecl.php.net/PDO installed, and is the version 0.3.1 or higher? + </para> + </listitem> + </orderedlist> + </para> + <para> + If any of the three conditions above validate in the order specified, the dependency will be + satisfied and installation will continue. This system allows users to use a different php.ini + to install PHP extensions and also provides a fail-safe system to depend on extensions. + </para> + <warning> + <simpara> + &lt;providesextension&gt;, like all other extension-related functions in PHP, is case-sensitive. + Do not use &quot;pdo&quot; for the &quot;PDO&quot; extension, or your dependency will always + fail. + </simpara> + </warning> + </refsect3> </refsect2> <refsect2 id="guide.developers.package2.dependencies.extension"> <title>&lt;extension&gt; dependencies</title>
« previous php.pear.doc (#5702) next »