X-Git-Url: http://git.pld-linux.org/?p=packages%2Frpm.git;a=blobdiff_plain;f=rpm-php-requires;h=330e49b2d17d300fa055f2c1da9d9d9a23996cf2;hp=31bf9bb73cbe6fa2d29b976eef8d5dfbea257f7e;hb=3bcc0bcada13eec095b51f7b55c4fb289c58e5a3;hpb=d5525bce1088e9477147d263c9af58c14afc69c1 diff --git a/rpm-php-requires b/rpm-php-requires index 31bf9bb..330e49b 100644 --- a/rpm-php-requires +++ b/rpm-php-requires @@ -1,46 +1,78 @@ -#!/bin/sh +#!/usr/bin/perl -W ##################################################################### # # -# Check system dependences between php-pear modules # +# Check system dependencies between php-pear/php-pecl modules # # # +# Adam Go³êbiowski # +# # +# based on previous work by: # # Pawe³ Go³aszewski # -# ------------------------------------------------------------------# -# TODO: # -# - extension_loaded - dependencies. # -# - some clean-up... # +# 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) # ##################################################################### -if [ $# -lt 1 ]; then - echo "You have to specify input file" - exit 1 -fi -for files in `echo $@`; do - files=`echo $files | grep "\.php$"` - if [ -n "$files" ]; then - # Requires trough new call: - j=`cat $files | grep -iw new | egrep "(=|return)" | egrep -v "^[[:space:]*]*(\/\/|#|\*|/\*)" | tr -d "\r" | egrep "[;|(|)|{|}|,][[:space:]*]*$" | awk -F "new " '{ print $2 }' | sed "s/[(|;|.]/ /g" | cut -f 1 -d " " | sed "s/^$.*//"` - if [ -n "$j" ]; then - for feature in $j; do - echo "pear($feature)" - done - j="" - fi - # requires trough class extension - k=`cat $files | egrep -i "(^Class.*extends)" | awk -F " extends " '{ print $2 }' | sed "s/{.*/ /" | cut -f 1 -d " " | tr -d "\r"` - if [ -n "$k" ]; then - for feature in $k; do - echo "pear($feature)" - done - k="" - fi - # requires trough class:: call - l=`cat $files | grep "::" | egrep -v "^[[:space:]*]*(\/\/|#|\*|/\*)" | sed "s/[(|)|'|!|\"|&|@|;]/ /g" | awk -F "::" '{ print $1 }' | sed "s/.*\ \([:alphanum:]*\)/\1/" | sed "s/^$.*//" | sed "s/[.]//g" | tr -d "\r"` - if [ -n "$l" ]; then - for feature in $l; do - echo "pear($feature)" - done - l="" - 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"; }