diff options
-rw-r--r-- | Makefile.am | 4 | ||||
-rwxr-xr-x | find-provides.in | 6 | ||||
-rwxr-xr-x | find-requires.in | 5 | ||||
-rwxr-xr-x | php.prov | 20 | ||||
-rwxr-xr-x | php.req | 82 |
5 files changed, 116 insertions, 1 deletions
diff --git a/Makefile.am b/Makefile.am index a324928..f6da878 100644 --- a/Makefile.am +++ b/Makefile.am @@ -23,7 +23,9 @@ pkg_scripts = \ magic.prov \ magic.req \ perl.prov \ - perl.req + perl.req \ + php.prov \ + php.req pkg_gscripts = \ find-provides \ diff --git a/find-provides.in b/find-provides.in index 8af59b4..8f32dad 100755 --- a/find-provides.in +++ b/find-provides.in @@ -59,6 +59,12 @@ done | sort -u echo "$tcllist" | tr '[:blank:]' \\n | @RPMVENDORDIR@/tcl.prov | sort -u # +# --- Php modules. +[ -x @RPMVENDORDIR@/php.prov ] && + echo "$filelist" | tr '[:blank:]' \\n | @RPMVENDORDIR@/php.prov | sort -u + + +# # --- .so files. for i in `echo $filelist | tr '[:blank:]' "\n" | egrep '(/usr(/X11R6)?)?/lib(|64)(/gcc(-lib)?/.+)?/[^/]+\.so$'`; do objd=`objdump -p ${i} | grep SONAME` diff --git a/find-requires.in b/find-requires.in index 9038276..a926a3b 100755 --- a/find-requires.in +++ b/find-requires.in @@ -173,6 +173,11 @@ fi echo $tcllist | tr '[:blank:]' \\n | @RPMVENDORDIR@/tcl.req | sort -u # +# --- Php modules. +[ -x @RPMVENDORDIR@/php.req ] && \ + echo $filelist | tr '[:blank:]' \\n | @RPMVENDORDIR@/php.req | sort -u + +# # --- .so files. for i in `echo $filelist | tr '[:blank:]' "\n" | egrep "(/usr(/X11R6)?)?/lib(|64)/[^/]+\.so$"`; do objd=`objdump -p ${i} | grep SONAME` diff --git a/php.prov b/php.prov new file mode 100755 index 0000000..a094cba --- /dev/null +++ b/php.prov @@ -0,0 +1,20 @@ +#!/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: # +##################################################################### + +$pear = "/usr/share/pear"; + +foreach (@ARGV ? @ARGV : <>) { + chomp; + $f = $_; + next unless ($f =~ /$pear.*\.php$/); + $f =~ s/.*$pear\///; + print "pear($f)\n"; +} @@ -0,0 +1,82 @@ +#!/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... # +##################################################################### + +$pear = "/usr/share/pear"; + +@files = (); +%req = (); + +foreach (@ARGV ? $ARGV : <> ) { + chomp; + $f = $_; + push @files, $f; + # skip non-php files + next unless ($f =~ /\.php$/); + open(F, "< $f") or die; + + if ($f =~ /$pear/) { + $file_dir = $f; + $file_dir =~ s|.*$pear/||; + $file_dir =~ s|/[^/]*$||; + } else { + $file_dir = undef; + } + + 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 =~ /\$/); + next unless ($x =~ /\.php$/); + $req{$x} = 1; + } + + next unless (defined $file_dir); + + while (/(\W|^)(require|include)(_once)? + \s* \(? \s* dirname \s* \( \s* __FILE__ \s* \) \s* \. \s* + ("([^"]*)"|'([^']*)') + \s* \)? \s* ;/xg) { + if ($5 ne "") { + $x = $5; + } elsif ($6 ne "") { + $x = $6; + } else { + next; + } + + next if ($x =~ /\$/); + next unless ($x =~ /\.php$/); + + $x = "$file_dir/$x"; + $x =~ s|/+|/|g; + $req{$x} = 1; + } + } +} + +f: for $f (keys %req) { + for $g (@files) { next f if ($g =~ /\Q$f\E$/); } + print "pear($f)\n"; +} |