[packages/rpm/dev-5.4.17] - move php macros and dep generators to rpm-build-macros

qboosh qboosh at pld-linux.org
Wed Feb 5 17:22:25 CET 2020


commit ed9bd7f21d302290c068a062b231fe83418a0e65
Author: Jan Rękorajski <baggins at pld-linux.org>
Date:   Thu Jan 2 23:15:07 2020 +0900

    - move php macros and dep generators to rpm-build-macros
    
    - install cleanup

 rpm-php-macros.patch |  28 ---------
 rpm-php-provides     |  20 ------
 rpm-php-requires     |  82 ------------------------
 rpm-php-requires.php | 174 ---------------------------------------------------
 rpm.spec             |  36 +----------
 5 files changed, 2 insertions(+), 338 deletions(-)
---
diff --git a/rpm.spec b/rpm.spec
index e501848..224a1fd 100644
--- a/rpm.spec
+++ b/rpm.spec
@@ -74,8 +74,6 @@ Source4:	%{name}-find-spec-bcond
 Source5:	%{name}-hrmib-cache
 Source6:	%{name}-groups-po.awk
 Source7:	%{name}-compress-doc
-Source8:	%{name}-php-provides
-Source9:	%{name}-php-requires
 Source10:	%{name}.sysinfo
 Source11:	perl.prov
 Source12:	%{name}-user_group.sh
@@ -91,7 +89,6 @@ Source20:	%{name}.noautoprov
 Source21:	%{name}.noautoprovfiles
 Source22:	%{name}.noautoreq
 Source24:	%{name}.noautoreqfiles
-Source25:	%{name}-php-requires.php
 Source26:	%{name}db_checkversion.c
 Source27:	macros.lang
 Source28:	%{name}db_reset.c
@@ -103,7 +100,6 @@ Patch3:		%{name}-nosetproctitle.patch
 Patch4:		%{name}-perl-macros.patch
 Patch5:		%{name}-perl-req-perlfile.patch
 Patch6:		%{name}-scripts-closefds.patch
-Patch7:		%{name}-php-macros.patch
 Patch8:		%{name}-gettext-in-header.patch
 Patch9:		%{name}-lua.patch
 Patch10:	%{name}-php-deps.patch
@@ -765,22 +761,6 @@ software.
 Makra ułatwiające tworzenie pakietów RPM z programami napisanymi w
 Pythonie.
 
-%package php-pearprov
-Summary:	Additional utilities for checking PHP PEAR provides/requires in RPM packages
-Summary(pl.UTF-8):	Dodatkowe narzędzia do sprawdzania zależności skryptów php w RPM
-Group:		Applications/File
-Requires:	%{name} = %{version}-%{release}
-Requires:	sed >= 4.0
-Suggests:	php-pear-PHP_CompatInfo
-
-%description php-pearprov
-Additional utilities for checking PHP PEAR provides/requires in RPM
-packages.
-
-%description php-pearprov -l pl.UTF-8
-Dodatkowe narzędzia do sprawdzenia zależności skryptów PHP PEAR w
-pakietach RPM.
-
 %package -n python-rpm
 Summary:	Python interface to RPM library
 Summary(pl.UTF-8):	Pythonowy interfejs do biblioteki RPM-a
@@ -843,7 +823,6 @@ cd -
 %patch4 -p1
 %patch5 -p1
 %patch6 -p1
-%patch7 -p1
 %patch8 -p1
 %{?with_system_lua:%patch9 -p1}
 %patch10 -p1
@@ -983,8 +962,6 @@ cd -
 %patch1050 -p1
 
 install %{SOURCE2} macros/pld.in
-install %{SOURCE8} scripts/php.prov.in
-install %{SOURCE9} scripts/php.req.in
 install %{SOURCE11} scripts/perl.prov.in
 
 %{__rm} scripts/find-php*
@@ -1251,8 +1228,6 @@ install %{SOURCE3} $RPM_BUILD_ROOT%{_rpmlibdir}/install-build-tree
 install %{SOURCE4} $RPM_BUILD_ROOT%{_rpmlibdir}/find-spec-bcond
 install %{SOURCE7} $RPM_BUILD_ROOT%{_rpmlibdir}/compress-doc
 install %{SOURCE12} $RPM_BUILD_ROOT%{_rpmlibdir}/user_group.sh
-install scripts/php.{prov,req}	$RPM_BUILD_ROOT%{_rpmlibdir}
-cp -p %{SOURCE25} $RPM_BUILD_ROOT%{_rpmlibdir}/php.req.php
 install %{SOURCE17} $RPM_BUILD_ROOT%{_rpmlibdir}/mimetypedeps.sh
 install %{SOURCE5} $RPM_BUILD_ROOT%{_rpmlibdir}/hrmib-cache
 install %{SOURCE13} $RPM_BUILD_ROOT/etc/sysconfig/rpm
@@ -1281,7 +1256,7 @@ install tools/rpmdb_reset $RPM_BUILD_ROOT%{_rpmlibdir}/bin
 install %{SOURCE29} $RPM_BUILD_ROOT%{_rpmlibdir}/bin/dbupgrade.sh
 
 # create macro loading wrappers for backward compatibility
-for m in gstreamer mono perl php python; do
+for m in gstreamer mono perl python; do
 	echo "%%{load:%{_rpmlibdir}/macros.d/$m}" >$RPM_BUILD_ROOT%{_rpmlibdir}/macros.$m
 done
 
@@ -1290,6 +1265,7 @@ done
 # moved to rpm-build-macros 1.744
 %{__rm} $RPM_BUILD_ROOT%{_rpmlibdir}/{macros.d/java,javadeps.sh}
 %{__rm} $RPM_BUILD_ROOT%{_rpmlibdir}/{macros.d/ruby,{gem_helper,rubygems}.rb}
+%{__rm} $RPM_BUILD_ROOT%{_rpmlibdir}/{macros.d/php,php.{prov,req}}
 
 # for rpm -e|-U --repackage
 install -d $RPM_BUILD_ROOT/var/{spool/repackage,lock/rpm}
@@ -1569,7 +1545,6 @@ find %{_rpmlibdir} -name '*-linux' -type l | xargs rm -f
 %{_rpmlibdir}/macros.d/libtool
 %{_rpmlibdir}/macros.d/mono
 %{_rpmlibdir}/macros.d/perl
-%{_rpmlibdir}/macros.d/php
 %{_rpmlibdir}/macros.d/pkgconfig
 %{_rpmlibdir}/macros.d/python
 %{_rpmlibdir}/macros.d/selinux
@@ -1579,7 +1554,6 @@ find %{_rpmlibdir} -name '*-linux' -type l | xargs rm -f
 %{_rpmlibdir}/macros.gstreamer
 %{_rpmlibdir}/macros.mono
 %{_rpmlibdir}/macros.perl
-%{_rpmlibdir}/macros.php
 %{_rpmlibdir}/macros.python
 
 %attr(755,root,root) %{_rpmlibdir}/gstreamer.sh
@@ -1608,12 +1582,6 @@ find %{_rpmlibdir} -name '*-linux' -type l | xargs rm -f
 %attr(755,root,root) %{_rpmlibdir}/pythoneggs.py
 %attr(755,root,root) %{_rpmlibdir}/pythondeps.sh
 
-%files php-pearprov
-%defattr(644,root,root,755)
-%attr(755,root,root) %{_rpmlibdir}/php.prov
-%attr(755,root,root) %{_rpmlibdir}/php.req
-%attr(755,root,root) %{_rpmlibdir}/php.req.php
-
 %if %{with python}
 %files -n python-rpm
 %defattr(644,root,root,755)
diff --git a/rpm-php-macros.patch b/rpm-php-macros.patch
deleted file mode 100644
index b66cc7e..0000000
--- a/rpm-php-macros.patch
+++ /dev/null
@@ -1,28 +0,0 @@
---- rpm-5.3.1/configure.ac.wiget	2010-05-30 16:43:06.000000000 +0200
-+++ rpm-5.3.1/configure.ac	2010-05-30 16:43:38.482725491 +0200
-@@ -2199,6 +2199,7 @@ AC_CONFIG_FILES([ po/Makefile.in
-     tools/Makefile
-     scripts/Makefile
-     scripts/perl.req scripts/perl.prov
-+    scripts/php.req scripts/php.prov
-     rpmdb/DB_CONFIG
-     macros/macros macros/macros.rpmbuild
-     macros/java macros/libtool macros/mono macros/perl 
---- rpm-5.4.10/macros/php.in	2012-09-05 18:12:29.474278958 +0200
-+++ rpm-5.4.15/macros/php.in	2015-09-03 11:16:04.928898067 +0300
-@@ -5,12 +5,9 @@
--%__php		@__PHP@
--
- # Path to scripts to autogenerate php package dependencies,
- #
- # Note: Used iff _use_internal_dependency_generator is non-zero. The
- # helpers are also used by %{_rpmhome}/rpmdeps {--provides|--requires}.
- #%__php_provides	%{_rpmhome}/phpdeps.sh --provides
- #%__php_requires	%{_rpmhome}/phpdeps.sh --requires
--#%__php_provides		%{_rpmhome}/php.prov
--#%__php_requires		%{_rpmhome}/php.req
--
--%php_pear_dir	%{_datadir}/pear
-+%__php_provides		%{_rpmhome}/php.prov
-+# define 'php_req_new' in ~/.rpmmacros to use php version of req finder
-+%__php_requires		env PHP_MIN_VERSION=%{?php_min_version} %{_rpmhome}/php.req%{?php_req_new:.php}
diff --git a/rpm-php-provides b/rpm-php-provides
deleted file mode 100644
index a094cba..0000000
--- a/rpm-php-provides
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/usr/bin/perl
-#####################################################################
-#                                                                   #
-# Check system dependences between php-pear modules                 #
-#                                                                   #
-# Pawe� Go�aszewski <blues at ds.pg.gda.pl>                            #
-# Micha� Moskal <malekith at 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";
-}
diff --git a/rpm-php-requires b/rpm-php-requires
deleted file mode 100644
index 2a3fb60..0000000
--- a/rpm-php-requires
+++ /dev/null
@@ -1,82 +0,0 @@
-#!/usr/bin/perl
-#####################################################################
-#                                                                   #
-# Check system dependences between php-pear modules                 #
-#                                                                   #
-# Pawe� Go�aszewski <blues at ds.pg.gda.pl>                            #
-# Micha� Moskal <malekith at pld-linux.org>                            #
-# ------------------------------------------------------------------#
-# TODO:                                                             #
-# - extension_loaded - dependencies.                                #
-# - some clean-up...                                                #
-#####################################################################
-
-$pear = "/usr/share/pear";
-
- at 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";
-}
diff --git a/rpm-php-requires.php b/rpm-php-requires.php
deleted file mode 100644
index b398029..0000000
--- a/rpm-php-requires.php
+++ /dev/null
@@ -1,174 +0,0 @@
-#!/usr/bin/php
-<?php
-/*
- * minify.spec does not see these: pear(HTTP/ConditionalGet.php) pear(HTTP/Encoder.php)
- * perl version does
- */
-/**
- *
- * Check system dependences between php-pear modules.
- *
- * Paweł Gołaszewski <blues at pld-linux.org> (Perl version)
- * Michał Moskal <malekith at pld-linux.org> (Perl version)
- * Elan Ruusamäe <glen at pld-linux.org>
- *
- * URL: <http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/rpm/rpm-php-requires.php>
- *
- * Requires: php-pear-PHP_CompatInfo
- * Requires: php-pcre
- */
-
-/**
- * Produce pear(Path/To/File.php) deps
- * Ported to PHP from Perl version of rpm-php-requires.
- *
- * @TODO: use tokenizer to parse php files.
- */
-function peardeps($files) {
-	// files inside php_pear_dir have this prefix
-	$prefix = RPM_BUILD_ROOT. PHP_PEAR_DIR . DIRECTORY_SEPARATOR;
-	$length = strlen($prefix);
-
-	$req = array();
-	foreach ($files as $f) {
-		// skip non-php files
-		if (substr($f, -4) != '.php') {
-			continue;
-		}
-
-		// subdir inside php_pear_dir
-		if (substr($f, 0, $length) == $prefix) {
-			$file_dir = dirname(substr($f, $length));
-		} else {
-			$file_dir = null;
-		}
-
-		foreach (file($f) as $line) {
-			// skip comments -- not perfect, matches "*" at start of line (very rare altho)
-			if (preg_match('/^\s*(#|\/\/|\*|\/\*)/', $line)) {
-				continue;
-			}
-
-			if (preg_match("/(\W|^)(require|include)(_once)?
-					\s* \(? \s*
-					(\"([^\"]*)\"|'([^']*)')
-					\s* \)? \s* ;/x", $line, $m)) {
-
-				if ($m[5]) {
-					$x = $m[5];
-				} else if ($m[6]) {
-					$x = $m[6];
-				} else {
-					continue 2;
-				}
-
-				if (substr($x, 0, 2) == './' || substr($x, -1) == '$') {  # XXX must be: CONTAINS DOLLAR
-					continue 2;
-				}
-
-				if (substr($x, -4) != '.php') {
-					continue 2;
-				}
-				$req[$x] = 1;
-				continue 2;
-			}
-
-			if (is_null($file_dir)) {
-				continue;
-			}
-
-			if (preg_match("/(\W|^)(require|include)(_once)?
-					\s* \(? \s* dirname \s* \( \s* __FILE__ \s* \) \s* \. \s*
-					(\"([^\"]*)\"|'([^']*)')
-					\s* \)? \s* ;/x", $line, $m)) {
-
-				if ($m[5]) {
-					$x = $m[5];
-				} else if ($m[6]) {
-					$x = $m[6];
-				} else {
-					continue 2;
-				}
-
-				if (substr($x, -1) == '$') { # XXX must be: CONTAINS DOLLAR
-					continue 2;
-				}
-				if (substr($x, -4) != '.php') {
-					continue 2;
-				}
-
-				$x = "$file_dir/$x";
-				// remove double slashes
-				// TODO: resolve simpletest/test/../socket.php -> simpletest/socket.php
-				$x = str_replace("//", "/", $x);
-				$req[$x] = 1;
-				continue;
-			}
-		}
-	}
-
-	foreach (array_keys($req) as $f) {
-		// skip self deps
-		if (array_key_exists($f, $files)) {
-			continue;
-		}
-		echo "pear($f)\n";
-	}
-}
-
-/**
- * Produce dependencies for extensions using PEAR PHP_CompatInfo package.
- */
-function extdeps($files) {
-	require_once 'PHP/CompatInfo.php';
-
-	$info = new PHP_CompatInfo('null');
-	$res = $info->parseData($files);
-
-	// minimum php version we accept
-	// "%define php_min_version 5.1.2" in spec to minimum version to be 5.1.2
-	$version = max(PHP_MIN_VERSION, $res['version']);
-
-	if (version_compare($version, '5.0.0', 'ge')) {
-		# force php-<name> only deps when php5
-		# XXX what about php-pecl-<name> virtual provides?
-		$fmt = 'php-%s';
-		$epoch = 4;
-	} else {
-		$fmt = 'php(%s)';
-		$epoch = 3;
-	}
-	echo "php-common >= ", $epoch, ":", $version, "\n";
-
-	// process extensions
-	foreach ($res['extensions'] as $ext) {
-		// bz2 ext is in php-bzip2 package
-		if ($ext == 'bz2') {
-			$ext = 'bzip2';
-		}
-		// libxml ext is in php-xml package
-		if ($ext == 'libxml') {
-			$ext = 'xml';
-		}
-
-		// these need to be lowercased
-		if (in_array($ext, array('SPL', 'PDO', 'SQLite', 'Reflection', 'SimpleXML'))) {
-			$ext = strtolower($ext);
-		}
-
-		printf("$fmt\n", $ext);
-	}
-}
-
-define('RPM_BUILD_ROOT', getenv('RPM_BUILD_ROOT'));
-define('PHP_PEAR_DIR', '/usr/share/pear');
-define('PHP_MIN_VERSION', getenv('PHP_MIN_VERSION'));
-
-if ($argc > 1) {
-	$files = array_splice($argv, 1);
-} else {
-	$files = explode(PHP_EOL, trim(file_get_contents('php://stdin')));
-}
-
-peardeps($files);
-extdeps($files);
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/rpm.git/commitdiff/cffb64ba2db7b311147604c09b2ed00ea8974d6d



More information about the pld-cvs-commit mailing list