]> git.pld-linux.org Git - packages/rpm.git/commitdiff
- merged with branch NEW_PEAR_REQUIRES (new rpm pear req/prov scripts)
authormisto <misto@pld-linux.org>
Mon, 14 Oct 2002 19:38:16 +0000 (19:38 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    rpm-php-provides -> 1.7
    rpm-php-requires -> 1.12

rpm-php-provides
rpm-php-requires

index 91baf9cabef1b992bd5ee1794c244c18919ff395..2750cbd6065b6842c1fc8c0dad5b8affb963ce6a 100644 (file)
@@ -1,28 +1,21 @@
-#!/bin/sh
+#!/usr/bin/perl
 #####################################################################
 #                                                                   #
 # Check system dependences between php-pear modules                 #
 #                                                                   #
 # Pawe³ Go³aszewski <blues@ds.pg.gda.pl>                            #
+# Micha³ Moskal <malekith@pld-linux.org>                            #
 # ------------------------------------------------------------------#
 # TODO:                                                             #
 #####################################################################
 
-if [ $# -lt 1 ]; then
-       echo "You have to specify input file"
-       exit 1
-fi
+die "You have to specify input files" if (@ARGV < 1);
 
-filelist=`echo $@`
-for i in $filelist; do
-       i=`echo $i | grep "\.php$"`
-       if [ -n "$i" ]; then
-               j=`cat $i | egrep  -i "^Class" | cut -f 2 -d " " |  sed "s/{/ /" | tr -d "\r"`
-               if [ -n "$j" ]; then
-                       for p in $j; do
-                               echo "pear($p)"
-                       done
-                       j=""
-               fi
-       fi
-done
+$pear = "/usr/share/pear";
+
+while (@ARGV > 0) {
+       $f = shift;
+       next unless ($f =~ /$pear.*\.php$/);
+       $f =~ s/.*$pear\///;
+       print "pear($f)\n";
+}
index 31bf9bb73cbe6fa2d29b976eef8d5dfbea257f7e..5a0fd12a60852ed60efdaa6124300281b8b655db 100644 (file)
@@ -1,46 +1,50 @@
-#!/bin/sh
+#!/usr/bin/perl
 #####################################################################
 #                                                                   #
 # Check system dependences between php-pear modules                 #
 #                                                                   #
 # Pawe³ Go³aszewski <blues@ds.pg.gda.pl>                            #
+# Micha³ Moskal <malekith@pld-linux.org>                            #
 # ------------------------------------------------------------------#
 # TODO:                                                             #
 # - extension_loaded - dependencies.                                #
 # - some clean-up...                                                #
 #####################################################################
-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
+die "You have to specify input files" if (@ARGV < 1);
 
+@files = ();
+%req = ();
+
+while (@ARGV > 0) {
+       $f = shift;
+       push @files, $f;
+       # skip non-php files
+       next unless ($f =~ /\.php$/);
+       open(F, "< $f") or die;
+
+       while (<F>) {
+               # skip comments
+               next if (/^\s*(#|\/\/|\*|\/\*)/);
+
+               while (/(\W|^)(require|include)(_once)?
+                         \s* \(? \s* ("([^"]*)"|'([^']*)') 
+                         \s* \)? \s* ;/xg) {
+                       if ($5 ne "") {
+                               $x = $5;
+                       } elsif ($6 ne "") {
+                               $x = $6;
+                       } else {
+                               next;
+                       }
+
+                       next if ($x =~ m|^\./| or $x =~ /\$/);
+                       $req{$x} = 1;
+               }
+       }
+}
+
+f: for $f (keys %req) {
+       for $g (@files) { next f if ($g =~ /\Q$f\E$/); }
+       print "pear($f)\n";
+}
This page took 0.060122 seconds and 4 git commands to generate.