-#!/bin/sh
-if [ $# -lt 1 ]; then
- echo "You have to specify input file"
- exit 1
-fi
+#!/usr/bin/perl
+#####################################################################
+# #
+# Small script to generate provides for php-pear/php-pecl #
+# #
+# Adam Go³êbiowski <adamg@pld-linux.org> #
+# #
+# Somehow based on previous work by: #
+# Pawe³ Go³aszewski <blues@pld-linux.org> #
+# Micha³ Moskal <malekith@pld-linux.org> #
+#####################################################################
-filelist=`echo $@`
-for i in $filelist; do
- j=`cat $i |egrep -i "^Class" |cut -f 2 -d " "`
- if [ -n "$j" ]; then
- echo "Provides: pear($j)"
- fi
- j=""
-done
+# Contest: shrink this one to oneliner
+# Bonus : and fit in 80 columns ;)
+
+/package.xml/ and open(F, $_) foreach (@ARGV ? @ARGV : <> );
+/^\s+\<name\>([a-zA-Z0-9\_]+)\<\/name\>$/ and print "php-pear-$1" while (<F>);