Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
...
Checking mergeability… Don't worry, you can still create the pull request.
  • 9 commits
  • 4 files changed
  • 0 commit comments
  • 2 contributors
Commits on Sep 19, 2011
@ocubom added support for PEAR Optional Dependency Groups
Change the generation of deps.txt file when a package uses Optional Dependency Groups (http://pear.php.net/manual/en/guide.developers.package2.dependencies.php).
7991f36
@ocubom added optional dependency groups in index file
Shows how to install Optional Dependency Groups defined for each package in main index file.
2614d52
Commits on Sep 26, 2011
@fabpot fabpot added release notes in the feed (closes #32) 5e51d5d
Commits on Sep 29, 2011
@fabpot fabpot adde composer.json 74459b4
Commits on Oct 08, 2011
@fabpot fabpot merged branch ocubom/dependency-groups (PR #31)
Commits
-------

2614d52 added optional dependency groups in index file
7991f36 added support for PEAR Optional Dependency Groups

Discussion
----------

PEAR Optional Dependency Groups

Pirum does not support PEAR Optional Dependency Groups. When you try to install this kind of packages from a Pirum served channel, the PEAR installer fails to detect the group and aborts with an error. The patch generates the correct structure so the channels served by Pirum can hold dependency groups without problems.

PEAR allows an "optional dependency groups" that define blocks of optional packages. Each group provides some feature (usually "plugins" or drivers) and must be installed in a block.

This dependencies are almost indentical to normal dependencies but enclosed with <group> tags that defines the group name and provides a description ('hint'):

```xml
<group name="remoteshell" hint="Add support for Remote Shell Operations">
	<package>
		<name>SSH_RemoteShell</name>
		<channel>pear.php.net</channel>
	</package>
	<extension>
		<name>ssh2</name>
	</extension>
</group>
```

PEAR needs a "special format" in package deps.[version].txt file to hold this dependencies: The dependency array to be serialized must looks like (reverse engineering from http://pear.php.net/rest/r/mdb2/deps.2.5.0b3.txt, seems to be undocumented):

```PHP
<?php
array(
	'required' => array(...),
	'group' => array(
		array(
			'attribs' => array('hint' => '...', 'name' => 'grp1'),
			'package' => array('name' => 'dep1', 'channel' => '...', ...),
		),
		array(
			'attribs' => array('hint' => '...', 'name' => 'grp1'),
			'package' => array('name' => 'dep2', 'channel' => '...', ...),
		),
		array(
			'attribs' => array('hint' => '...', 'name' => 'grp2'),
			'package' => array('name' => 'dep3', 'channel' => '...', ...),
		),
	),
)
```

Each entry is a package, subpackage or extension that belongs to one group. The attribs key indicates the group the package belongs to and the dependency is defined as usual. If one package belongs to several groups or the group has more than one package, must to be duplicated.

The patch generates this array so the channels served by pirum holds dependency groups without problems.
65b615c
@fabpot fabpot fixed CS aefee60
@fabpot fabpot added CHANGELOG 3b31c22
@fabpot fabpot prepared 1.0.4 release e4cb39b
Commits on Oct 16, 2011
@fabpot fabpot fixed PHP 5.2 issue (count() method is only available as of PHP 5.3, …
…closes #33)
56e546f
Showing with 134 additions and 4 deletions.
  1. +70 −0 CHANGELOG
  2. +18 −0 composer.json
  3. +2 −2 package.xml
  4. +44 −2 pirum
View
70 CHANGELOG
@@ -0,0 +1,70 @@
+* 1.0.4 (2011-10-08)
+
+ * added support for optional dependency groups
+ * added support for channel mirrors
+ * added release notes in the feed
+
+* 1.0.3 (2011-09-15)
+
+ * added required dependencies in the main index HTML file
+ * tweaked main index HTML file
+ * added support for versions like 0.0.1a or 0.0.2b1
+
+* 1.0.2 (2011-07-25)
+
+ * added pirum.bat for Windows
+ * fixed Atom feed
+ * moved the creation of .tar when building the PEAR channel (this allows to put the .tgz in get/ and run build without running add)
+
+* 1.0.1 (2011-03-27)
+
+ * allowed development packages
+ * escaped variables in the main index HTML file
+ * Updating pirum to pick up the provides extension tag and to automatically mark the generated instructions to use pecl rather than pear to install
+ * added support for removing packages
+ * added support for valid snapshot stability
+ * added support for <validatepackage> tags in channel.xml
+
+* 1.0.0 (2010-09-03)
+
+ * added the PEAR channel main directory for templates
+ * fixed missing closing tag for root element in maintainers.xml/maintainers2.xml
+ * added an error when adding a package with a badly formatted name
+
+* 0.9.9 (2010-05-12)
+
+ * fixed ordering of files
+ * removed *nix requirement
+
+* 0.9.8 (2010-04-29)
+
+ * fixed package filename regular expression that reads name and version to be case-insensitive
+ * checked whether channel dir is a dir and package path is a file
+ * added an explicit error when the package to add does not exist
+ * split updateTargetDir into smaller parts to make it easier to extend class
+ * when decompressing original pear package .tar.gz, overwrites tar file if it already exists
+ * fixed minimal PHP version
+ * fixed channel.xml generation for channels without aliases
+ * added simple validation for pirum.xml
+ * added a way to override the pirum.css and index.html templates
+ * added support for latest.txt
+
+* 0.9.7 (2009-12-08)
+
+ * fixed typo
+
+* 0.9.6 (2009-12-07)
+
+ * fixed problem when the get/ directory does not exists (at initialization of a new repository for instance)
+ * fixed a small display bug for the build command
+ * fixed a bug when a package have several dependencies
+
+* 0.9.5 (2009-12-07)
+
+ * fixed version management
+
+...
+
+* 0.9.0 (2009-10-18)
+
+ * initial version
View
18 composer.json
@@ -0,0 +1,18 @@
+{
+ "name": "pirum/pirum",
+ "type": "library",
+ "description": "Pirum, the simple PEAR Channel Server Manager",
+ "keywords": ["PEAR"],
+ "homepage": "http://pirum.sensiolabs.org",
+ "version": "1.0.4",
+ "license": "MIT",
+ "authors": [
+ {
+ "name": "Fabien Potencier",
+ "email": "fabien@symfony.com"
+ }
+ ],
+ "require": {
+ "php": ">=5.2.4"
+ }
+}
View
4 package.xml
@@ -15,10 +15,10 @@
<email>fabien@symfony.com</email>
<active>yes</active>
</lead>
- <date>2011-09-15</date>
+ <date>2011-10-08</date>
<time>12:00:00</time>
<version>
- <release>1.0.3</release>
+ <release>1.0.4</release>
<api>1.0.0</api>
</version>
<stability>
View
46 pirum
@@ -359,7 +359,7 @@ class Pirum_Builder
</author>
<updated>$date</updated>
<content>
- {$package['description']}
+ {$release['notes']}
</content>
</entry>
EOF;
@@ -478,11 +478,25 @@ pear install <?php echo $this->server->alias ?>/package_name-beta</code></pre>
$deps = array($deps);
}
}
+
+ $grps = array();
+ if (isset($package['deps']['group'])) {
+ $grps = $package['deps']['group'];
+ }
?>
<h3><?php echo $package['name'] ?><small> - <?php echo $package['summary'] ?></small></h3>
<p><?php echo $package['description'] ?></p>
<table>
<tr><th>Install command</th><td><strong><?php echo $package['extension'] != null ? 'pecl' : 'pear' ?> install <?php echo $this->server->alias ?>/<?php echo $package['name'] ?></strong></td></tr>
+ <?php if ($grps): ?><?php
+ $groups = array();
+ foreach ($grps as $grp) {
+ $groups[] = ($package['extension'] != null ? 'pecl' : 'pear').' install '.$this->server->alias.'/'.$package['name'].'#'.$grp['attribs']['name'].'&nbsp;<small>('.$grp['attribs']['hint'].')</small>';
+ }
+ $groups = implode('<br/>', $groups);
+ ?>
+ <tr><th>Install groups:</th><td><?php echo $groups ?></td></tr>
+ <?php endif; ?>
<tr><th>License</th><td><?php echo $package['license'] ?></td></tr>
<?php if ($deps): ?>
<tr><th>Dependencies</th><td>
@@ -1203,7 +1217,12 @@ class Pirum_Package
public function getDeps()
{
- return serialize($this->XMLToArray($this->package->dependencies));
+ $deps = $this->XMLToArray($this->package->dependencies);
+ if ($this->package->dependencies->group->length > 0) {
+ $deps['group'] = $this->XMLGroupDepsToArray($this->package->dependencies->group);
+ }
+
+ return serialize($deps);
}
public function getMinPhp()
@@ -1323,6 +1342,29 @@ class Pirum_Package
return $array;
}
+
+ protected function XMLGroupDepsToArray($xml)
+ {
+ if ($xml->count() == 0) {
+ return array();
+ }
+
+ $deps = array();
+ foreach ($xml as $group) {
+ // Extract group attribs (shared by all children)
+ $attribs = array();
+ foreach ($group->attributes() as $key => $val) {
+ $attribs[$key] = (string) $val;
+ }
+
+ // Create one group dependency per childern
+ foreach ($group->children() as $type => $value) {
+ $deps[] = array('attribs' => $attribs, $type => $this->XMLToArray($value));
+ }
+ }
+
+ return $deps;
+ }
}
/**

No commit comments for this range

Something went wrong with that request. Please try again.