#!/usr/bin/perl
#####################################################################
# #
-# Check system dependences between php-pear modules #
+# Small script to generate provides for php-pear/php-pecl #
# #
-# Pawe³ Go³aszewski <blues@ds.pg.gda.pl> #
+# 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> #
-# ------------------------------------------------------------------#
-# TODO: #
#####################################################################
-die "You have to specify input files" if (@ARGV < 1);
-
-$pear = "/usr/share/pear";
+# Contest: shrink this one to oneliner
+# Bonus : and fit in 80 columns ;)
-while (@ARGV > 0) {
- $f = shift;
- next unless ($f =~ /$pear.*\.php$/);
- $f =~ s/.*$pear\///;
- print "pear($f)\n";
-}
+/package.xml/ and open(F, $_) foreach (@ARGV ? @ARGV : <> );
+/^\s+\<name\>([a-zA-Z0-9\_]+)\<\/name\>$/ and print "php-pear-$1" while (<F>);