X-Git-Url: http://git.pld-linux.org/?p=packages%2Frpm.git;a=blobdiff_plain;f=rpm-php-requires;h=330e49b2d17d300fa055f2c1da9d9d9a23996cf2;hp=a8dad654d20c85071db9d00333888d73994c1799;hb=3bcc0bcada13eec095b51f7b55c4fb289c58e5a3;hpb=ce0971dd598bc1766ef80086cbc6fe44d6ecda3d diff --git a/rpm-php-requires b/rpm-php-requires index a8dad65..330e49b 100644 --- a/rpm-php-requires +++ b/rpm-php-requires @@ -1,19 +1,78 @@ -#!/bin/sh -if [ $# -lt 1 ]; then - echo "You have to specify input file" - exit 1 -fi +#!/usr/bin/perl -W +##################################################################### +# # +# Check system dependencies between php-pear/php-pecl modules # +# # +# Adam Go³êbiowski # +# # +# based on previous work by: # +# Pawe³ Go³aszewski # +# Micha³ Moskal # +# # +# ----------------------------------------------------------------- # +# ChangeLog: # +# 20031201: complete rewrite to use PEAR's package.xml, now handles # +# all dependencies, including PHP modules (like php-gmp), # +# and PECL extensions (adamg) # +##################################################################### -for i in `echo $@`; do - i=`echo $i | grep "\.php"` - if [ -n "$i" ]; then - j=`cat $i | grep -i ^require_once | egrep -v "^ \*" | sed -e "s/['|\"]//" | sed -e "s/(/ /" | cut -f 2 -d " " | sed -e "s/\//_/g" | cut -f 1 -d "."` - if [ -n "$j" ]; then - for p in $j; do - echo "pear($p)" - done - j="" - fi - fi -done +@req_arr = (); +$fname = '/dev/null'; +foreach ( @ARGV ? $ARGV : <> ) +{ + $fname = $_ if (/package.xml/) +} +open F, $fname; + +while () { + if ( /\s+\([a-zA-Z0-9\_\-]*)\=" if ( $rel eq "ge"); + $relation = ">" if ( $rel eq "gt"); + $relation = "=" if ( $rel eq "has"); + # die if we were unable to substitute relations + die "ERROR: Unexpected relation! ($rel)\n" if ( $relation eq ""); + + $req = ""; + $relver = ""; + $relver = "$relation $version" if ( $version !~ /^$/ ); + $req = "$name $relver" if ( $type =~ /(php|prog)/ ); + $req = "php-$name $relver" if ( $type =~ /ext/ ); + $req = "php-pear-$name" if ( $type =~ /pkg/ ); + + push @req_arr, $req + + } +} +for $r (@req_arr) { print "$r\n"; }