aboutsummaryrefslogtreecommitdiffstats
path: root/php.req
diff options
context:
space:
mode:
authorOlivier Thauvin <nanardon@mandriva.org>2005-08-07 08:00:54 +0000
committerOlivier Thauvin <nanardon@mandriva.org>2005-08-07 08:00:54 +0000
commitc59084bb06e91ea858d80262ef47dc9c54e14b82 (patch)
tree10d9f837e6eee91de1dce4359f4ea03e9ab78e96 /php.req
parentba0b7b7637e29319ddfb807dfafed74be97ecb8b (diff)
downloadrpm-setup-c59084bb06e91ea858d80262ef47dc9c54e14b82.tar
rpm-setup-c59084bb06e91ea858d80262ef47dc9c54e14b82.tar.gz
rpm-setup-c59084bb06e91ea858d80262ef47dc9c54e14b82.tar.bz2
rpm-setup-c59084bb06e91ea858d80262ef47dc9c54e14b82.tar.xz
rpm-setup-c59084bb06e91ea858d80262ef47dc9c54e14b82.zip
- add php-pear auto req/prov from pld (suggested by oden)
Diffstat (limited to 'php.req')
-rwxr-xr-xphp.req82
1 files changed, 82 insertions, 0 deletions
diff --git a/php.req b/php.req
new file mode 100755
index 0000000..2a3fb60
--- /dev/null
+++ b/php.req
@@ -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";
+}