mirror of
https://abf.rosa.ru/djam/rpm.git
synced 2025-02-23 10:23:04 +00:00
245 lines
8.6 KiB
Diff
245 lines
8.6 KiB
Diff
--- rpm-5.4.9/macros/mandriva.in.php_deps~ 2012-06-28 04:25:18.070035644 +0200
|
|
+++ rpm-5.4.9/macros/mandriva.in 2012-06-28 04:25:21.883987963 +0200
|
|
@@ -275,8 +275,6 @@ Group: %{group}\
|
|
# TODO: merge relevant changes into rpm version rather than using our own
|
|
%__perl_provides @USRLIBRPM@/@RPMCANONVENDOR@/perl.prov
|
|
%__perl_requires @USRLIBRPM@/@RPMCANONVENDOR@/perl.req
|
|
-%__php_provides @USRLIBRPM@/@RPMCANONVENDOR@/php.prov
|
|
-%__php_requires @USRLIBRPM@/@RPMCANONVENDOR@/php.req
|
|
|
|
%__find_provides @USRLIBRPM@/@RPMCANONVENDOR@/filter.sh '%{?_provides_exceptions:%{_provides_exceptions}}%{!?_provides_exceptions: }' '%{?_exclude_files_from_autoprov:%{_exclude_files_from_autoprov}}%{!?_exclude_files_from_autoprov: }' '%{buildroot}' @USRLIBRPM@/@RPMCANONVENDOR@/find-provides
|
|
%__find_requires @USRLIBRPM@/@RPMCANONVENDOR@/filter.sh '%{?_requires_exceptions:%{_requires_exceptions}}%{!?_requires_exceptions: }' '%{?_exclude_files_from_autoreq:%{_exclude_files_from_autoreq}}%{!?_exclude_files_from_autoreq: }' '%{buildroot}' @USRLIBRPM@/@RPMCANONVENDOR@/find-requires %{?buildroot:%{buildroot}} %{?_target_cpu:%{_target_cpu}}
|
|
--- rpm-5.4.9/scripts/php.prov.php_deps~ 2012-06-28 04:22:17.980287076 +0200
|
|
+++ rpm-5.4.9/scripts/php.prov 2012-06-28 04:22:33.725090237 +0200
|
|
@@ -1,17 +1,44 @@
|
|
#!/usr/bin/perl
|
|
#####################################################################
|
|
# #
|
|
-# Small script to generate provides for php-pear/php-pecl #
|
|
+# Check system dependences between php-pear modules #
|
|
# #
|
|
-# Adam Go³êbiowski <adamg@pld-linux.org> #
|
|
-# #
|
|
-# Somehow based on previous work by: #
|
|
-# Pawe³ Go³aszewski <blues@pld-linux.org> #
|
|
+# Pawe³ Go³aszewski <blues@ds.pg.gda.pl> #
|
|
# Micha³ Moskal <malekith@pld-linux.org> #
|
|
+# ------------------------------------------------------------------#
|
|
+# TODO: #
|
|
#####################################################################
|
|
|
|
-# Contest: shrink this one to oneliner
|
|
-# Bonus : and fit in 80 columns ;)
|
|
+$pear = "/usr/share/pear";
|
|
+@files = ();
|
|
+
|
|
+
|
|
+if ("@ARGV") {
|
|
+ foreach (@ARGV) {
|
|
+ process_file($_);
|
|
+ }
|
|
+} else {
|
|
+
|
|
+ # notice we are passed a list of filenames NOT as common in unix the
|
|
+ # contents of the file.
|
|
+
|
|
+ foreach (<>) {
|
|
+ chomp $_;
|
|
+ process_file($_);
|
|
+ }
|
|
+}
|
|
+
|
|
+f: for $f (sort keys %req) {
|
|
+ print "pear($f)\n";
|
|
+}
|
|
+
|
|
+exit(0);
|
|
+
|
|
+sub process_file() {
|
|
+ my ($f) = @_;
|
|
+ return unless ($f =~ /$pear.*\.php$/);
|
|
|
|
-/package.xml/ and open(F, $_) foreach (@ARGV ? @ARGV : <> );
|
|
-/^\s+\<name\>([a-zA-Z0-9\_]+)\<\/name\>$/ and print "php-pear-$1" while (<F>);
|
|
+ $f =~ s/.*$pear\///;
|
|
+ push @files, $f;
|
|
+ $req{$f} = 1;
|
|
+}
|
|
--- rpm-5.4.9/scripts/php.req.php_deps~ 2012-06-28 04:22:21.478243346 +0200
|
|
+++ rpm-5.4.9/scripts/php.req 2012-06-28 04:22:33.986086975 +0200
|
|
@@ -1,78 +1,108 @@
|
|
-#!/usr/bin/perl -W
|
|
+#!/usr/bin/perl
|
|
#####################################################################
|
|
# #
|
|
-# Check system dependencies between php-pear/php-pecl modules #
|
|
+# Check system dependences between php-pear modules #
|
|
# #
|
|
-# Adam Go³êbiowski <adamg@pld-linux.org> #
|
|
-# #
|
|
-# based on previous work by: #
|
|
# Pawe³ Go³aszewski <blues@ds.pg.gda.pl> #
|
|
-# Micha³ Moskal <malekith@pld-linux.org> #
|
|
-# #
|
|
-# ----------------------------------------------------------------- #
|
|
-# ChangeLog: #
|
|
-# 20031201: complete rewrite to use PEAR's package.xml, now handles #
|
|
-# all dependencies, including PHP modules (like php-gmp), #
|
|
-# and PECL extensions (adamg) #
|
|
+# Micha³ Moskal <malekith@pld-linux.org> #
|
|
+# ------------------------------------------------------------------#
|
|
+# TODO: #
|
|
+# - extension_loaded - dependencies. #
|
|
+# - some clean-up... #
|
|
#####################################################################
|
|
|
|
-@req_arr = ();
|
|
-$fname = '/dev/null';
|
|
-foreach ( @ARGV ? $ARGV : <> )
|
|
-{
|
|
- $fname = $_ if (/package.xml/)
|
|
+$pear = "/usr/share/pear";
|
|
+
|
|
+@files = ();
|
|
+%req = ();
|
|
+
|
|
+if ("@ARGV") {
|
|
+ foreach (@ARGV) {
|
|
+ process_file($_);
|
|
+ }
|
|
+} else {
|
|
+
|
|
+ # notice we are passed a list of filenames NOT as common in unix the
|
|
+ # contents of the file.
|
|
+
|
|
+ foreach (<>) {
|
|
+ chomp $_;
|
|
+ process_file($_);
|
|
+ }
|
|
}
|
|
|
|
-open F, $fname;
|
|
+f: for $f (keys %req) {
|
|
+ for $g (@files) { next f if ($g =~ /\Q$f\E$/); }
|
|
+ print "pear($f)\n";
|
|
+}
|
|
+
|
|
+exit(0);
|
|
+
|
|
+sub process_file() {
|
|
+ my ($f) = @_;
|
|
+ push @files, $f;
|
|
+
|
|
+ # skip non-php files
|
|
+ next unless ($f =~ /\.php$/);
|
|
+
|
|
+ if (!open(F, $f)) {
|
|
+ warn("$0: Warning: Could not open file '$f' for reading: $!\n");
|
|
+ return;
|
|
+ }
|
|
+
|
|
+ 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;
|
|
+ }
|
|
+ $x =~ s/\/\.?\//\//g while $x =~ /\/\.?\//;
|
|
+ $x =~ s/(\/|^)[^\/]*[^.]\/\.\.\//\1/g while $x =~ /(\/|^)[^\/]*[^.]\/\.\.\//;
|
|
+ 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 unless ($x =~ /\.php$/);
|
|
+
|
|
+ $x = "$file_dir/$x";
|
|
+ $x =~ s/\/\.?\//\//g while $x =~ /\/\.?\//;
|
|
+ $x =~ s/(\/|^)[^\/]*[^.]\/\.\.\//\1/g while $x =~ /(\/|^)[^\/]*[^.]\/\.\.\//;
|
|
+ $req{$x} = 1;
|
|
+ }
|
|
+ }
|
|
|
|
-while (<F>) {
|
|
- if ( /\s+\<dep\s+type\=\"([a-zA-z]*)\"/ ) {
|
|
- $type = $1;
|
|
- die ("ERROR: Unsupported type: $type\n") if ( $type !~ /^(pkg|ext|php|prog|os|sapi|zend)$/i);
|
|
- # Default relation (as suggested by PEAR manual) is has
|
|
- $rel = "has";
|
|
- $rel = $1 if ( /rel="([a-zA-Z]*)"/ );
|
|
- die ("ERROR: Unsupported relation: $rel\n") if ( $rel !~ /^(has|eq|lt|le|gt|ge)$/ );
|
|
-
|
|
- # Check if we don't have some unsupported connection betweend relation and type
|
|
- die ("ERROR: Cannot use lt/le/gt/ge relation with prog/os/sapi type!\n") if ( $rel =~ /^(lt|le|gt|ge)$/ && $type =~ /^(prog|os|sapi)$/ );
|
|
-
|
|
- # do we have version?
|
|
- $version = "";
|
|
- $version = $1 if ( /version="([a-zA-z0-9\.\+]*)"/ );
|
|
-
|
|
- # optional - actually this one is optional ;)
|
|
- # NOTE:
|
|
- # even though this attribute marks dependency as optional,
|
|
- # we will add it to Requires:
|
|
- $optional = "no";
|
|
- $optional = $1 if ( /optional="([a-zA-Z]*)"/ );
|
|
- die ("ERROR: Ambigous value of optional attribute: $optional\n") if ( $optional !~ /(yes|no)/i );
|
|
-
|
|
- # now, check if we need to pull out package/extension/whatever name
|
|
- $name = "";
|
|
- $name = "php" if ( $type =~ /php/ );
|
|
- $name = "$1" if ( $type !~ /php/ && /\>([a-zA-Z0-9\_\-]*)\</ );
|
|
-
|
|
- $relation = "";
|
|
- $relation = "<" if ( $rel eq "lt");
|
|
- $relation = "<=" if ( $rel eq "le");
|
|
- $relation = "=" if ( $rel eq "eq");
|
|
- $relation = ">=" 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
|
|
+ close(F) ||
|
|
+ die("$0: Could not close file: '$f' : $!\n");
|
|
|
|
- }
|
|
}
|
|
-for $r (@req_arr) { print "$r\n"; }
|