From 84075475222d896bc30bf83aaa7caeee19bedaea Mon Sep 17 00:00:00 2001 From: Marcin Krol Date: Thu, 25 Oct 2012 18:44:48 +0000 Subject: [PATCH] - merger changes from rpm-4_5 branch @ PLD --- macros.php | 3 + rpm-am.patch | 39 +++++ rpm-automake_1.12.patch | 12 ++ rpm-changelog_order_check_nonfatal.patch | 13 ++ rpm-debugedit-dwarf4.patch | 124 ++++++++++++++++ rpm-helperEVR-noassert.patch | 14 ++ rpm-php-requires.php | 174 +++++++++++++++++++++++ rpm.spec | 44 ++++-- 8 files changed, 410 insertions(+), 13 deletions(-) create mode 100644 macros.php create mode 100644 rpm-am.patch create mode 100644 rpm-automake_1.12.patch create mode 100644 rpm-changelog_order_check_nonfatal.patch create mode 100644 rpm-debugedit-dwarf4.patch create mode 100644 rpm-helperEVR-noassert.patch create mode 100644 rpm-php-requires.php diff --git a/macros.php b/macros.php new file mode 100644 index 0000000..81064f1 --- /dev/null +++ b/macros.php @@ -0,0 +1,3 @@ +%define __php_provides /usr/lib/rpm/php.prov +# define 'php_req_new' in ~/.rpmmacros to use php version of req finder +%define __php_requires env PHP_MIN_VERSION=%{?php_min_version} /usr/lib/rpm/php.req%{?php_req_new:.php} diff --git a/rpm-am.patch b/rpm-am.patch new file mode 100644 index 0000000..ae05199 --- /dev/null +++ b/rpm-am.patch @@ -0,0 +1,39 @@ +diff -ur rpm-4.5/Makefile.am rpm-4.5-ac/Makefile.am +--- rpm-4.5/Makefile.am 2012-01-26 22:11:55.875577134 +0100 ++++ rpm-4.5-ac/Makefile.am 2012-01-26 22:10:47.855842412 +0100 +@@ -45,7 +45,8 @@ + bin_PROGRAMS = rpm rpmbuild + + pkglibdir = @USRLIBRPM@ +-pkglib_DATA = rpmpopt macros ++pkgdatadir = @USRLIBRPM@ ++pkgdata_DATA = rpmpopt macros + + noinst_HEADERS = build.h debug.h system.h + +diff -ur rpm-4.5/scripts/Makefile.am rpm-4.5-ac/scripts/Makefile.am +--- rpm-4.5/scripts/Makefile.am 2012-01-26 22:11:55.752244281 +0100 ++++ rpm-4.5-ac/scripts/Makefile.am 2012-01-26 22:07:08.238669872 +0100 +@@ -27,7 +27,8 @@ + bin_SCRIPTS = gendiff rpm2cpio + + pkglibdir = @USRLIBRPM@ +-pkglib_SCRIPTS = \ ++pkgbindir = @USRLIBRPM@ ++pkgbin_SCRIPTS = \ + brp-compress brp-python-bytecompile brp-java-gcjcompile \ + brp-strip brp-strip-comment-note brp-nobuildrootpath \ + brp-strip-shared brp-strip-static-archive brp-sparc64-linux \ +diff -ur rpm-4.5/tools/Makefile.am rpm-4.5-ac/tools/Makefile.am +--- rpm-4.5/tools/Makefile.am 2012-01-26 22:11:55.748910960 +0100 ++++ rpm-4.5-ac/tools/Makefile.am 2012-01-26 22:11:02.329119298 +0100 +@@ -23,7 +23,8 @@ + bin_PROGRAMS = rpmdigest rpmmtree rpmrepo + + pkglibdir = @USRLIBRPM@ +-pkglib_PROGRAMS = rpmdeps @WITH_LIBDWARF_DEBUGEDIT@ ++pkgbindir = @USRLIBRPM@ ++pkgbin_PROGRAMS = rpmdeps @WITH_LIBDWARF_DEBUGEDIT@ + + convertdb1_SOURCES = convertdb1.c + diff --git a/rpm-automake_1.12.patch b/rpm-automake_1.12.patch new file mode 100644 index 0000000..17d1a35 --- /dev/null +++ b/rpm-automake_1.12.patch @@ -0,0 +1,12 @@ +diff -dur rpm-4.5.orig/configure.ac rpm-4.5/configure.ac +--- rpm-4.5.orig/configure.ac 2012-06-19 15:52:36.000000000 +0200 ++++ rpm-4.5/configure.ac 2012-06-19 15:54:29.000000000 +0200 +@@ -211,7 +211,6 @@ + dnl This test must precede tests of compiler characteristics like + dnl that for the inline keyword, since it may change the degree to + dnl which the compiler supports such features. +-AM_C_PROTOTYPES + AC_C_INLINE + AC_C_BIGENDIAN + +Only in rpm-4.5.orig: configure.ac.orig diff --git a/rpm-changelog_order_check_nonfatal.patch b/rpm-changelog_order_check_nonfatal.patch new file mode 100644 index 0000000..bf2ef04 --- /dev/null +++ b/rpm-changelog_order_check_nonfatal.patch @@ -0,0 +1,13 @@ +--- rpm-4.5/build/parseChangelog.c.orig 2012-07-24 14:46:12.856158625 +0200 ++++ rpm-4.5/build/parseChangelog.c 2012-07-24 14:47:55.293158624 +0200 +@@ -181,9 +181,8 @@ + return RPMERR_BADSPEC; + } + if (lastTime && lastTime < time) { +- rpmError(RPMERR_BADSPEC, ++ rpmMessage(RPMMESS_WARNING, + _("%%changelog not in descending chronological order\n")); +- return RPMERR_BADSPEC; + } + lastTime = time; + diff --git a/rpm-debugedit-dwarf4.patch b/rpm-debugedit-dwarf4.patch new file mode 100644 index 0000000..66045e9 --- /dev/null +++ b/rpm-debugedit-dwarf4.patch @@ -0,0 +1,124 @@ +--- rpm-4.5/tools/debugedit.c.orig 2012-06-23 20:54:51.748542754 +0200 ++++ rpm-4.5/tools/debugedit.c 2012-06-23 20:56:12.045612104 +0200 +@@ -70,6 +70,10 @@ + #include "hashtab.h" + + #define DW_TAG_partial_unit 0x3c ++#define DW_FORM_sec_offset 0x17 ++#define DW_FORM_exprloc 0x18 ++#define DW_FORM_flag_present 0x19 ++#define DW_FORM_ref_sig8 0x20 + + char *base_dir = NULL; + char *dest_dir = NULL; +@@ -250,6 +254,7 @@ static struct + #define DEBUG_STR 8 + #define DEBUG_FRAME 9 + #define DEBUG_RANGES 10 ++#define DEBUG_TYPES 11 + { ".debug_info", NULL, NULL, 0, 0, 0 }, + { ".debug_abbrev", NULL, NULL, 0, 0, 0 }, + { ".debug_line", NULL, NULL, 0, 0, 0 }, +@@ -261,6 +266,7 @@ static struct + { ".debug_str", NULL, NULL, 0, 0, 0 }, + { ".debug_frame", NULL, NULL, 0, 0, 0 }, + { ".debug_ranges", NULL, NULL, 0, 0, 0 }, ++ { ".debug_types", NULL, NULL, 0, 0, 0 }, + { NULL, NULL, NULL, 0, 0, 0 } + }; + +@@ -353,7 +359,8 @@ no_memory: + goto no_memory; + } + form = read_uleb128 (ptr); +- if (form == 2 || form > DW_FORM_indirect) ++ if (form == 2 ++ || (form > DW_FORM_flag_present && form != DW_FORM_ref_sig8)) + { + error (0, 0, "%s: Unknown DWARF DW_FORM_%d", dso->filename, form); + htab_delete (h); +@@ -382,7 +389,6 @@ static char * + canonicalize_path (const char *s, char *d) + { + char *rv = d; +- const char *sroot; + char *droot; + + if (IS_DIR_SEPARATOR (*s)) +@@ -398,7 +404,6 @@ canonicalize_path (const char *s, char * + s++; + } + droot = d; +- sroot = s; + + while (*s) + { +@@ -517,7 +522,7 @@ edit_dwarf2_line (DSO *dso, rpmuint32_t + } + + value = read_16 (ptr); +- if (value != 2 && value != 3) ++ if (value != 2 && value != 3 && value != 4) + { + error (0, 0, "%s: DWARF version %d unhandled", dso->filename, + value); +@@ -533,8 +538,8 @@ edit_dwarf2_line (DSO *dso, rpmuint32_t + return 1; + } + +- opcode_base = ptr[4]; +- ptr = dir = ptr + 4 + opcode_base; ++ opcode_base = ptr[4 + (value >= 4)]; ++ ptr = dir = ptr + 4 + (value >= 4) + opcode_base; + + /* dir table: */ + value = 1; +@@ -762,7 +767,8 @@ edit_attributes (DSO *dso, unsigned char + { + if (t->attr[i].attr == DW_AT_stmt_list) + { +- if (form == DW_FORM_data4) ++ if (form == DW_FORM_data4 ++ || form == DW_FORM_sec_offset) + { + list_offs = do_read_32_relocated (ptr); + found_list_offs = 1; +@@ -868,6 +874,8 @@ edit_attributes (DSO *dso, unsigned char + else + ptr += 4; + break; ++ case DW_FORM_flag_present: ++ break; + case DW_FORM_addr: + ptr += ptr_size; + break; +@@ -882,10 +890,12 @@ edit_attributes (DSO *dso, unsigned char + break; + case DW_FORM_ref4: + case DW_FORM_data4: ++ case DW_FORM_sec_offset: + ptr += 4; + break; + case DW_FORM_ref8: + case DW_FORM_data8: ++ case DW_FORM_ref_sig8: + ptr += 8; + break; + case DW_FORM_sdata: +@@ -914,6 +924,7 @@ edit_attributes (DSO *dso, unsigned char + form = DW_FORM_block1; + break; + case DW_FORM_block: ++ case DW_FORM_exprloc: + len = read_uleb128 (ptr); + form = DW_FORM_block1; + assert (len < UINT_MAX); +@@ -1217,7 +1228,7 @@ edit_dwarf2 (DSO *dso) + } + + cu_version = read_16 (ptr); +- if (cu_version != 2 && cu_version != 3) ++ if (cu_version != 2 && cu_version != 3 && cu_version != 4) + { + error (0, 0, "%s: DWARF version %d unhandled", dso->filename, + cu_version); diff --git a/rpm-helperEVR-noassert.patch b/rpm-helperEVR-noassert.patch new file mode 100644 index 0000000..fff4a84 --- /dev/null +++ b/rpm-helperEVR-noassert.patch @@ -0,0 +1,14 @@ +--- rpm-4.5/lib/rpmfc.c.orig 2012-02-13 20:28:52.564758176 +0100 ++++ rpm-4.5/lib/rpmfc.c 2012-02-14 19:01:50.810809655 +0100 +@@ -472,7 +472,10 @@ + } + i++; + EVR = pav[i]; +-assert(EVR != NULL); ++ if(EVR == NULL) { ++ rpmMessage(RPMMESS_ERROR, _("%s helper returned empty version info for %s, omitting\n"), nsdep, N); ++ continue; ++ } + } + /*@=branchstate@*/ + diff --git a/rpm-php-requires.php b/rpm-php-requires.php new file mode 100644 index 0000000..b398029 --- /dev/null +++ b/rpm-php-requires.php @@ -0,0 +1,174 @@ +#!/usr/bin/php + (Perl version) + * Michał Moskal (Perl version) + * Elan Ruusamäe + * + * URL: + * + * 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- only deps when php5 + # XXX what about php-pecl- 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); diff --git a/rpm.spec b/rpm.spec index d5fa02c..dc7d79a 100644 --- a/rpm.spec +++ b/rpm.spec @@ -34,6 +34,7 @@ #%%define force_cpp '%{_target_cpu}-tld-linux-gcc -E' # versions of required libraries +%define reqdb_pkg db4.5 %define reqdb_ver 4.5.20 %define reqpopt_ver 1.10.8 %define beecrypt_ver 2:4.1.2-4 @@ -48,7 +49,7 @@ Summary(ru.UTF-8): Менеджер пакетов от RPM Summary(uk.UTF-8): Менеджер пакетів від RPM Name: rpm Version: 4.5 -Release: 61 +Release: 62 License: LGPL Group: Base Source0: %{name}-%{version}.tar.gz @@ -71,6 +72,8 @@ Source17: %{name}-java-requires # http://svn.pld-linux.org/banner.sh/ Source18: banner.sh Source19: %{name}-macros.gstreamer +Source20: macros.php +Source21: %{name}-php-requires.php Patch1000: %{name}-new-debuginfo.patch #Patch1067: %{name}-disable-features.patch #Patch1070: %{name}-rpmrc-ac.patch @@ -109,6 +112,7 @@ Patch35: %{name}-disable-features-ti.patch Patch36: %{name}-debuginfo.patch Patch37: %{name}-doxygen_hack.patch Patch39: %{name}-popt-coreutils.patch +Patch40: %{name}-helperEVR-noassert.patch Patch42: %{name}-old-fileconflicts-behaviour.patch Patch43: %{name}-rpm5-patchset-8637.patch Patch44: %{name}-no-neon.patch @@ -167,6 +171,10 @@ Patch101: %{name}-builddir-readlink.patch Patch102: pythondeps-speedup.patch Patch103: %{name}-lua-exit-chroot-correctly.patch Patch104: %{name}-glob.patch +Patch105: %{name}-am.patch +Patch106: %{name}-automake_1.12.patch +Patch107: %{name}-debugedit-dwarf4.patch +Patch108: %{name}-changelog_order_check_nonfatal.patch URL: http://rpm5.org/ BuildRequires: autoconf >= 2.57 BuildRequires: automake >= 1.4 @@ -205,7 +213,7 @@ BuildRequires: tetex-pdftex # Require static library only for static build BuildRequires: beecrypt-static >= %{beecrypt_ver} BuildRequires: bzip2-static >= 1.0.2-17 -%{!?with_internal_db:BuildRequires: db-static >= %{reqdb_ver}} +%{!?with_internal_db:BuildRequires: %{reqdb_pkg}-static >= %{reqdb_ver}} BuildRequires: elfutils-static BuildRequires: glibc-static >= 2.2.94 %{?with_system_libmagic:BuildRequires: libmagic-static} @@ -323,7 +331,7 @@ Summary: RPMs library Summary(pl.UTF-8): Biblioteki RPM-a Group: Libraries Requires: beecrypt >= %{beecrypt_ver} -%{!?with_internal_db:Requires: db >= %{reqdb_ver}} +%{!?with_internal_db:Requires: %{reqdb_pkg} >= %{reqdb_ver}} %{?with_system_libmagic:Requires: libmagic >= 1.15-2} %{?with_selinux:Requires: libselinux >= 1.18} Requires: ossp-uuid >= 1.6.2-4 @@ -356,7 +364,7 @@ Group: Development/Libraries Requires: %{name}-lib = %{version}-%{release} Requires: beecrypt-devel >= %{beecrypt_ver} Requires: bzip2-devel -%{!?with_internal_db:Requires: db-devel >= %{reqdb_ver}} +%{!?with_internal_db:Requires: %{reqdb_pkg}-devel >= %{reqdb_ver}} Requires: elfutils-devel Requires: keyutils-devel %{?with_system_libmagic:Requires: libmagic-devel} @@ -421,7 +429,7 @@ Group: Development/Libraries Requires: %{name}-devel = %{version}-%{release} Requires: beecrypt-static >= %{beecrypt_ver} Requires: bzip2-static -%{!?with_internal_db:Requires: db-static >= %{reqdb_ver}} +%{!?with_internal_db:Requires: %{reqdb_pkg}-static >= %{reqdb_ver}} Requires: elfutils-static Requires: keyutils-static %{?with_system_libmagic:Requires: libmagic-static} @@ -513,7 +521,7 @@ Summary(ru.UTF-8): Скрипты и утилиты, необходимые дл Summary(uk.UTF-8): Скрипти та утиліти, необхідні для побудови пакетів Group: Applications/File Requires(pretrans): findutils -Requires: %{name}-build-macros >= 1.514 +Requires: %{name}-build-macros >= 1.636 Requires: %{name}-utils = %{version}-%{release} Requires: /bin/id Requires: awk @@ -702,8 +710,7 @@ sed -e 's/^/@tld@/' %{SOURCE2} >>platform.in echo '%%define __perl_provides %%{__perl} /usr/lib/rpm/perl.prov' > macros.perl echo '%%define __perl_requires %%{__perl} /usr/lib/rpm/perl.req' >> macros.perl echo '# obsoleted file' > macros.python -echo '%%define __php_provides /usr/lib/rpm/php.prov' > macros.php -echo '%%define __php_requires /usr/lib/rpm/php.req' >> macros.php +cp -p %{SOURCE20} macros.php echo '%%define __mono_provides /usr/lib/rpm/mono-find-provides' > macros.mono echo '%%define __mono_requires /usr/lib/rpm/mono-find-requires' >> macros.mono install %{SOURCE10} scripts/php.prov @@ -725,6 +732,7 @@ install %{SOURCE13} scripts/perl.prov %patch36 -p1 %patch37 -p1 %patch39 -p1 +%patch40 -p1 %patch42 -p1 %patch43 -p1 %patch82 -p1 @@ -783,6 +791,10 @@ install %{SOURCE13} scripts/perl.prov %patch102 -p1 %patch103 -p1 %patch104 -p1 +%patch105 -p1 +%patch106 -p1 +%patch107 -p1 +%patch108 -p1 mv -f po/{sr,sr@Latn}.po rm -rf sqlite zlib popt @@ -851,7 +863,7 @@ sed -i \ # pass CC and CXX too in case of building with some older configure macro # disable perl-RPM2 build, we have it in separate spec -CPPFLAGS="%{rpmcppflags} -I/usr/include/ossp-uuid" +CPPFLAGS="%{rpmcppflags} -I/usr/include/ossp-uuid -I/usr/include/%{reqdb_pkg}" %configure \ CC="%{__newcc}" \ CXX="%{__newcxx}" \ @@ -871,7 +883,7 @@ CPPFLAGS="%{rpmcppflags} -I/usr/include/ossp-uuid" CC="%{__cc}" \ CXX="%{__cxx}" \ CPP="%{__cpp}" \ - libdb_la=%{_libdir}/libdb.la \ + libdb_la=%{_libdir}/libdb-%(echo %{reqdb_pkg} | sed -e 's/^db//').la \ pylibdir=%{py_libdir} \ myLDFLAGS="%{rpmldflags}" \ staticLDFLAGS=%{?with_static:-all-static} @@ -883,8 +895,7 @@ install -d $RPM_BUILD_ROOT{/%{_lib},/etc/{sysconfig,tmpwatch},%{_sysconfdir}/rpm %{__make} install \ DESTDIR=$RPM_BUILD_ROOT \ staticLDFLAGS=%{?with_static:-all-static} \ - pylibdir=%{py_libdir} \ - pkgbindir="%{_bindir}" + pylibdir=%{py_libdir} cat <<'EOF' > $RPM_BUILD_ROOT/etc/tmpwatch/rpm.conf # Cleanup 90-days old repackage files. @@ -965,6 +976,9 @@ sparcv9-[^-]*-[Ll]inux(-gnu)? %ifarch sparc sparcv9 sparc64 sparc-[^-]*-[Ll]inux(-gnu)? %endif +%ifarch armv6l +armv6l-[^-]*-[Ll]inux(-gnu)? +%endif %ifarch armv5tel armv5tel-[^-]*-[Ll]inux(-gnu)? %endif @@ -1006,6 +1020,7 @@ install -p %{SOURCE7} $RPM_BUILD_ROOT%{_rpmlibdir}/compress-doc install -p %{SOURCE14} $RPM_BUILD_ROOT%{_rpmlibdir}/user_group.sh install -p %{SOURCE17} $RPM_BUILD_ROOT%{_rpmlibdir}/java-find-requires install -p scripts/php.{prov,req} $RPM_BUILD_ROOT%{_rpmlibdir} +cp -p %{SOURCE21} $RPM_BUILD_ROOT%{_rpmlibdir}/php.req.php install -p %{SOURCE5} $RPM_BUILD_ROOT%{_rpmlibdir}/hrmib-cache install -p %{SOURCE18} $RPM_BUILD_ROOT%{_bindir}/banner.sh cp -a %{SOURCE15} $RPM_BUILD_ROOT/etc/sysconfig/rpm @@ -1037,6 +1052,9 @@ cat > $RPM_BUILD_ROOT%{_sysconfdir}/rpm/macros < $RPM_BUILD_ROOT%{_sysconfdir}/rpm/macros.lang <