[packages/rpm] - add fixes and useful features from Mandriva
baggins
baggins at pld-linux.org
Wed Sep 5 22:24:13 CEST 2012
commit 70f8787d9a6faa68bee6b810a53198c50a9ad760
Author: Jan Rękorajski <baggins at pld-linux.org>
Date: Wed Sep 5 22:22:02 2012 +0200
- add fixes and useful features from Mandriva
...enerate-rpmfc-dependencies-from-doc-files.patch | 51 +++++++
rpm-5.4.10-duplicate_files_terminate_build.patch | 67 +++++++++
....4.10-files-listed-twice-terminates-build.patch | 74 ++++++++++
...ix-neon-saving-error-pages-as-target-file.patch | 56 +++++++
rpm-5.4.10-support-ignore-arch-and-os-again.patch | 45 ++++++
...5.4.10-unpackaged_subdirs_terminate_build.patch | 67 +++++++++
rpm-5.4.4-add-_specfile-macro.patch | 10 ++
...4.4-allow-installation-of-repackaged-rpms.patch | 11 ++
...eless-auto-generated-pkgconfig-dependency.patch | 23 +++
...always-use-LC_CTYPE-C-for-case-conversion.patch | 20 +++
....4-glob-wildcards-for-loading-macro-files.patch | 24 +++
...pass-_builddir-properly-to-find-debuginfo.patch | 23 +++
rpm-5.4.4-pkgconfigdeps-check-path.patch | 76 ++++++++++
rpm-5.4.4-rpmbuild-withoutclean.patch | 10 ++
rpm-5.4.5-python-export-spec-macros.patch | 70 +++++++++
....5-rpmfc-apply-python-coloring-from-magic.patch | 10 ++
rpm-5.4.5-rpmfc-use-strlen-not-sizeof.patch | 11 ++
rpm-5.4.5-rubygems-add-missing-newline.patch | 16 ++
...5-skip-dependencies-for-character-devices.patch | 13 ++
...sider-trigger-dependencies-as-overlapping.patch | 12 ++
...5.4.7-fix-generation-of-ruby-abi-provides.patch | 48 ++++++
rpm-5.4.7-fix-minor-memleaks.patch | 25 ++++
...5.4.7-hdrfmt-fix-unitialized-argv-element.patch | 14 ++
rpm-5.4.7-kmod-dependencies.patch | 66 +++++++++
rpm-5.4.7-no-seqid_init-on-rdonly-database.patch | 11 ++
...ix-invalid-free-if-not-_defaultdocdir-set.patch | 11 ++
rpm-5.4.8-dont-show-suggests-with-requires.patch | 62 ++++++++
rpm-5.4.9-avoid-dependencies-on-self.patch | 85 +++++++++++
...-in-path-for-dirname-filetrigger-matching.patch | 23 +++
rpm-5.4.9-fix-typo-in-rpmtag-header.patch | 11 ++
rpm-5.4.9-fix-verify-segfault.patch | 26 ++++
rpm-5.4.9-font-provides.patch | 60 ++++++++
rpm-5.4.9-keep-loading-script-macros.patch | 80 ++++++++++
...-mire-fix-strings-lacking-null-terminator.patch | 32 ++++
...-rpmfc-extract-dependencies-for-all-files.patch | 11 ++
rpm-5.4.9-rpmpython-fix-input.patch | 11 ++
rpm-5.4.9-ruby1.9-fixes.patch | 114 ++++++++++++++
...-buildroot-away-from-duplicate-files-list.patch | 97 ++++++++++++
...-rpmfc-when-removing-dependencies-on-self.patch | 140 ++++++++++++++++++
rpm.spec | 163 +++++++++++++++++++--
40 files changed, 1767 insertions(+), 12 deletions(-)
---
diff --git a/rpm.spec b/rpm.spec
index fda1614..0da76b6 100644
--- a/rpm.spec
+++ b/rpm.spec
@@ -44,7 +44,7 @@ ERROR
%define reqdb_ver 5.3
%define reqpopt_ver 1.15
%define beecrypt_ver 2:4.1.2-4
-%define sover 5.4
+%define sover 5.4
Summary: RPM Package Manager
Summary(de.UTF-8): RPM Packet-Manager
@@ -141,6 +141,108 @@ Patch82: %{name}-libmagic-locale.patch
Patch83: %{name}-namespace-probe.patch
Patch84: %{name}-popt-coreutils.patch
Patch85: %{name}-postun-nofail.patch
+
+# Patches imported from Mandriva
+
+# status: ready to merge, it's already been merged on HEAD, so commiting it to rpm-5_4
+# would basically just mean backporting it..
+Patch1000: rpm-5.4.4-add-_specfile-macro.patch
+# status: needs to be cleaned up and properly reviewed together with rest
+# of the patches related to dependency generation
+Patch1001: rpm-5.4.9-avoid-dependencies-on-self.patch
+# status: probably ready to merge
+Patch1002: rpm-5.4.4-pkgconfigdeps-check-path.patch
+# status: probably okay to merge, but discuss on rpm-devel first
+Patch1003: rpm-5.4.4-glob-wildcards-for-loading-macro-files.patch
+# status: needs to be discussed
+Patch1004: rpm-5.4.4-allow-installation-of-repackaged-rpms.patch
+# status: ready to merge
+Patch1005: rpm-5.4.8-dont-show-suggests-with-requires.patch
+# status: ready for merge
+Patch1006: rpm-5.4.9-strip-buildroot-away-from-duplicate-files-list.patch
+# status: probably okay to merge, but discuss on rpm-devel first
+Patch1007: rpm-5.4.10-duplicate_files_terminate_build.patch
+# status: same as above
+Patch1008: rpm-5.4.10-unpackaged_subdirs_terminate_build.patch
+# mdvbz#64898
+# status: uncertain, might be okay to merge, discuss on rpm-devel first
+Patch1009: rpm-5.4.4-rpmbuild-withoutclean.patch
+# no sense in having an additional dependency on 'pkgconfig' on all packages that
+# have a pkgconfig file, it's not needed for them to be made useful and anything
+# actuallly using pkgconfig for this purpose will pull it in as a dependency anyways...
+# status: might be okay to merge, but discuss on rpm-devel first
+Patch1010: rpm-5.4.4-drop-useless-auto-generated-pkgconfig-dependency.patch
+# status: ready for merge
+Patch1011: rpm-5.4.4-fix-rpmconstant-to-always-use-LC_CTYPE-C-for-case-conversion.patch
+# $RPM_BUILD_DIR isn't necessarily the same as $PWD, it's %%{_builddir}, not
+# %%{_builddir}/%%{?buildsubdir}, messing up paths in debug packages created..
+# status: needs to be discussed and investigated a bit better..
+Patch1012: rpm-5.4.4-pass-_builddir-properly-to-find-debuginfo.patch
+# status: probably okay to merge, but discuss on rpm-devel first
+Patch1013: rpm-5.4.10-files-listed-twice-terminates-build.patch
+# status: probably okay to merge
+Patch1014: rpm-5.4.9-ruby1.9-fixes.patch
+# status: keep locally
+Patch1015: rpm-5.4.9-keep-loading-script-macros.patch
+# status: same as for other dep gen patches
+Patch1016: rpm-5.4.9-update-rpmfc-when-removing-dependencies-on-self.patch
+# status: idem
+Patch1017: rpm-5.4.9-rpmfc-extract-dependencies-for-all-files.patch
+# status: ready for merge
+Patch1018: rpm-5.4.5-rubygems-add-missing-newline.patch
+# status: probably okay to merge
+Patch1019: rpm-5.4.5-python-export-spec-macros.patch
+# status: idem
+Patch1020: rpm-5.4.9-font-provides.patch
+# stauus: idem
+Patch1021: rpm-5.4.7-kmod-dependencies.patch
+# status: probably okay to merge, discuss on rpm-devel first
+Patch1022: rpm-5.4.5-skip-dependencies-for-character-devices.patch
+# status: ready to merge
+Patch1023: rpm-5.4.5-rpmfc-use-strlen-not-sizeof.patch
+# status: probably okay to merge
+Patch1024: rpm-5.4.5-rpmfc-apply-python-coloring-from-magic.patch
+# status: ready to merge
+Patch1025: rpm-5.4.7-rpmfc-fix-invalid-free-if-not-_defaultdocdir-set.patch
+# status: probably okay to merge
+Patch1026: rpm-5.4.10-dont-try-generate-rpmfc-dependencies-from-doc-files.patch
+# status: ready
+Patch1027: rpm-5.4.7-fix-generation-of-ruby-abi-provides.patch
+# crash reproducable with 'rpm -qa --triggers'
+# status: ready
+Patch1028: rpm-5.4.7-hdrfmt-fix-unitialized-argv-element.patch
+# status: same as for other dep gen patches
+Patch1029: rpm-5.4.7-dont-consider-trigger-dependencies-as-overlapping.patch
+# status: ready
+Patch1030: rpm-5.4.7-fix-minor-memleaks.patch
+# status: ready
+Patch1031: rpm-5.4.9-mire-fix-strings-lacking-null-terminator.patch
+# status: ready
+Patch1032: rpm-5.4.9-rpmpython-fix-input.patch
+# status: ready
+Patch1033: rpm-5.4.7-no-seqid_init-on-rdonly-database.patch
+# status: probably ready for merging
+Patch1034: rpm-5.4.9-avoid-double-slash-in-path-for-dirname-filetrigger-matching.patch
+# status: probably ready to merge, discuss on rpm-devel first
+Patch1035: rpm-5.4.9-fix-verify-segfault.patch
+# status: ready and should be merged
+Patch1036: rpm-5.4.9-fix-typo-in-rpmtag-header.patch
+# Due to rpmdav/neon being written in a different fashion than other rpmio clients,
+# the inconsistent behaviour affects code elsewhere which expects consistent behaviour,
+# with the result being that when unable to download files, neon will save error
+# page as the target file.
+# status: should go upstream, but uncertain about "correct" fix, ie. this is
+# more of a workaround, while rewriting rpmdav code to behave consistently
+# would be "the right thing to do". Yet I'm not fully able to grasp all of the
+# code and don't want to spend more time just to get the API..
+Patch1037: rpm-5.4.10-fix-neon-saving-error-pages-as-target-file.patch
+# As the transaction flags for ignoring arch & os are no longer used, there's
+# currently no way to ignore arch & os of packages anymore. This patch adds
+# support for doing this again by defining rpm variables and overriding
+# --ignorearch & --ignoreos to set these.
+# status: needs to be discussed upstream before thinking about merging
+Patch1038: rpm-5.4.10-support-ignore-arch-and-os-again.patch
+
URL: http://rpm5.org/
BuildRequires: autoconf >= 2.60
BuildRequires: automake >= 1.4
@@ -667,10 +769,6 @@ Dokumentacja API RPM-a oraz przewodniki w formacie HTML generowane ze
# CHECK ME - macrofiles: ~/etc could be used
#%%patch14 -p1
%patch16 -p1
-install %{SOURCE9} scripts/php.prov.in
-install %{SOURCE10} scripts/php.req.in
-install %{SOURCE12} scripts/perl.prov
-
%ifarch i386 i486
# disable TSC
%patch26 -p1
@@ -679,7 +777,7 @@ install %{SOURCE12} scripts/perl.prov
%patch34 -p1
%patch35 -p0
%patch36 -p1
-%patch37 -p1
+####%patch37 -p1
%patch41 -p1
%patch42 -p1
%patch47 -p1
@@ -692,7 +790,7 @@ install %{SOURCE12} scripts/perl.prov
%patch61 -p1
%endif
%patch62 -p1
-%patch70 -p1
+####%patch70 -p1
%patch72 -p1 -b .wiget
%patch73 -p1
%patch74 -p1
@@ -708,12 +806,52 @@ install %{SOURCE12} scripts/perl.prov
%patch84 -p1
%patch85 -p1
-cp -p %{SOURCE2} macros/pld.in
+%patch1000 -p1
+%patch1001 -p1
+%patch1002 -p1
+%patch1003 -p1
+%patch1004 -p1
+%patch1005 -p1
+%patch1006 -p1
+%patch1007 -p1
+%patch1008 -p1
+%patch1009 -p1
+%patch1010 -p1
+%patch1011 -p1
+%patch1012 -p1
+%patch1013 -p1
+%patch1014 -p1
+%patch1015 -p1
+%patch1016 -p1
+%patch1017 -p1
+%patch1018 -p1
+%patch1019 -p1
+%patch1020 -p1
+%patch1021 -p1
+%patch1022 -p1
+%patch1023 -p1
+%patch1024 -p1
+%patch1025 -p1
+%patch1026 -p1
+%patch1027 -p1
+%patch1028 -p1
+%patch1029 -p1
+%patch1030 -p1
+%patch1031 -p1
+%patch1032 -p1
+%patch1033 -p1
+%patch1034 -p1
+%patch1035 -p1
+%patch1036 -p1
+%patch1037 -p1
+%patch1038 -p1
+
+install %{SOURCE2} macros/pld.in
+install %{SOURCE9} scripts/php.prov.in
+install %{SOURCE10} scripts/php.req.in
+install %{SOURCE12} scripts/perl.prov.in
-cd scripts
-mv -f perl.req perl.req.in
-mv -f perl.prov perl.prov.in
-cd ..
+%{__mv} -f scripts/perl.req{,.in}
# generate Group translations to *.po
awk -f %{SOURCE6} %{SOURCE1}
@@ -1170,6 +1308,7 @@ find %{_rpmlibdir} -name '*-linux' -type l | xargs rm -f
%attr(755,root,root) %{_rpmlibdir}/http.req
%attr(755,root,root) %{_rpmlibdir}/mono*
+%attr(755,root,root) %{_rpmlibdir}/fontconfig.prov
# must be here for "Requires: rpm-*prov" to work
%{_rpmlibdir}/macros.d/cmake
%{_rpmlibdir}/macros.d/gstreamer
diff --git a/rpm-5.4.10-dont-try-generate-rpmfc-dependencies-from-doc-files.patch b/rpm-5.4.10-dont-try-generate-rpmfc-dependencies-from-doc-files.patch
new file mode 100644
index 0000000..72faa1f
--- /dev/null
+++ b/rpm-5.4.10-dont-try-generate-rpmfc-dependencies-from-doc-files.patch
@@ -0,0 +1,51 @@
+--- rpm-5.4.10/lib/rpmfc.c.skip_doc~ 2012-07-28 17:19:43.136069278 +0200
++++ rpm-5.4.10/lib/rpmfc.c 2012-07-28 17:25:16.778898168 +0200
+@@ -818,7 +818,17 @@ static int rpmfcSCRIPT(rpmfc fc)
+ int i;
+ int is_executable;
+ int xx;
+- const char * defaultdocdir = NULL;
++
++ /* Don't generate dependencies from files shipped as documentation */
++ if (!rpmExpandNumeric("%{_generate_dependencies_from_docdir}")) {
++ const char * defaultdocdir = rpmExpand("%{?_defaultdocdir}", NULL);
++ if (defaultdocdir == NULL || *defaultdocdir == '\0')
++ defaultdocdir = strdup("/usr/share/doc");
++ xx = !strncmp(fn+fc->brlen, defaultdocdir, strlen(defaultdocdir));
++ defaultdocdir = _free(defaultdocdir) ;
++ if (xx)
++ return 0;
++ }
+
+ /* Extract dependencies only from files with executable bit set. */
+ { struct stat sb, * st = &sb;
+@@ -904,16 +914,10 @@ static int rpmfcSCRIPT(rpmfc fc)
+ (void) fclose(fp);
+
+ if (fc->fcolor->vals[fc->ix] & RPMFC_PERL) {
+- defaultdocdir = rpmExpand("%{?_defaultdocdir}", NULL);
+- if (defaultdocdir == NULL || *defaultdocdir == '\0')
+- defaultdocdir = strdup("/usr/share/doc");
+-
+- if (strncmp(fn, defaultdocdir, strlen(defaultdocdir))) {
+- if (fc->fcolor->vals[fc->ix] & RPMFC_MODULE)
+- xx = rpmfcHelper(fc, 'P', "perl");
+- if (is_executable || (fc->fcolor->vals[fc->ix] & RPMFC_MODULE))
+- xx = rpmfcHelper(fc, 'R', "perl");
+- }
++ if (fc->fcolor->vals[fc->ix] & RPMFC_MODULE)
++ xx = rpmfcHelper(fc, 'P', "perl");
++ if (is_executable || (fc->fcolor->vals[fc->ix] & RPMFC_MODULE))
++ xx = rpmfcHelper(fc, 'R', "perl");
+ } else
+ if (fc->fcolor->vals[fc->ix] & RPMFC_PYTHON) {
+ xx = rpmfcHelper(fc, 'P', "python");
+@@ -1009,8 +1013,6 @@ static int rpmfcSCRIPT(rpmfc fc)
+ #endif
+ }
+
+-/*@-observertrans@*/
+- defaultdocdir = _free(defaultdocdir) ;
+ /*@=observertrans@*/
+ return 0;
+ }
diff --git a/rpm-5.4.10-duplicate_files_terminate_build.patch b/rpm-5.4.10-duplicate_files_terminate_build.patch
new file mode 100644
index 0000000..8f4574b
--- /dev/null
+++ b/rpm-5.4.10-duplicate_files_terminate_build.patch
@@ -0,0 +1,67 @@
+--- rpm-5.4.10/build/files.c.dups_terminate~ 2012-07-10 20:09:01.125249185 +0200
++++ rpm-5.4.10/build/files.c 2012-07-10 20:09:01.135249061 +0200
+@@ -2917,7 +2917,8 @@ exit:
+
+ /* auxiliary function for checkDuplicateFiles() */
+ /* XXX need to pass Header because fi->h is NULL */
+-static int fiIntersect(/*@null@*/ rpmfi fi1, /*@null@*/ rpmfi fi2, size_t buildrootL)
++static int fiIntersect(/*@null@*/ rpmfi fi1, /*@null@*/ rpmfi fi2,
++ size_t buildrootL, int _duplicate_files_terminate_build)
+ /*@globals internalState @*/
+ /*@modifies fi1, fi2, internalState @*/
+ {
+@@ -2955,7 +2956,7 @@ static int fiIntersect(/*@null@*/ rpmfi
+ he->tag = RPMTAG_NVRA;
+ N2 = (headerGet(fi2->h, he, 0) ? he->p.str : NULL);
+
+- rpmlog(RPMLOG_WARNING,
++ rpmlog(_duplicate_files_terminate_build ? RPMLOG_ERR : RPMLOG_WARNING,
+ _("File(s) packaged into both %s and %s:\n%s"),
+ N1, N2, rpmiobStr(dups));
+
+@@ -2972,7 +2973,8 @@ static int fiIntersect(/*@null@*/ rpmfi
+ * @param spec spec file control structure
+ * @return number of duplicate files
+ */
+-static int checkDuplicateFiles(Spec spec, size_t buildrootL)
++static int checkDuplicateFiles(Spec spec, size_t buildrootL,
++ int _duplicate_files_terminate_build)
+ /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
+ /*@modifies *spec->packages,
+ rpmGlobalMacroContext, fileSystem, internalState @*/
+@@ -2997,7 +2999,7 @@ static int checkDuplicateFiles(Spec spec
+ #endif
+ if (fi2 == NULL) continue;
+ (void) rpmfiSetHeader(fi2, pkg2->header);
+- n += fiIntersect(fi1, fi2, buildrootL);
++ n += fiIntersect(fi1, fi2, buildrootL, _duplicate_files_terminate_build);
+ (void) rpmfiSetHeader(fi2, NULL);
+ fi2 = rpmfiFree(fi2);
+ }
+@@ -3181,9 +3183,13 @@ rpmRC processBinaryFiles(Spec spec, int
+ }
+
+ if (res == RPMRC_OK) {
++ int _duplicate_files_terminate_build =
++ rpmExpandNumeric("%{?_duplicate_files_terminate_build}");
+ if (checkUnpackagedFiles(spec) > 0)
+ res = RPMRC_FAIL;
+- (void) checkDuplicateFiles(spec, buildrootL);
++ if (checkDuplicateFiles(spec, buildrootL, _duplicate_files_terminate_build) > 0 &&
++ _duplicate_files_terminate_build)
++ res = RPMRC_FAIL;
+ (void) checkUnpackagedSubdirs(spec, buildrootL);
+ }
+
+--- rpm-5.4.10/macros/mandriva.in.dups_terminate~ 2012-05-19 22:35:44.000000000 +0200
++++ rpm-5.4.10/macros/mandriva.in 2012-07-10 20:13:41.582742985 +0200
+@@ -126,6 +126,9 @@ end\
+ # use XZ to compress binary packages:
+ %_binary_payload w5.xzdio
+
++%_duplicate_files_terminate_build 1
++
++
+ %_build_pkgcheck_set /usr/bin/rpmlint -T -f %{_sourcedir}/%{name}.rpmlintrc
+ %_build_pkgcheck_srpm /usr/bin/rpmlint -T -f %{_sourcedir}/%{name}.rpmlintrc
+ %_nonzero_exit_pkgcheck_terminate_build 1
diff --git a/rpm-5.4.10-files-listed-twice-terminates-build.patch b/rpm-5.4.10-files-listed-twice-terminates-build.patch
new file mode 100644
index 0000000..9fd555c
--- /dev/null
+++ b/rpm-5.4.10-files-listed-twice-terminates-build.patch
@@ -0,0 +1,74 @@
+--- rpm-5.4.10/build/files.c.twice_terminate~ 2012-07-10 20:18:14.613329633 +0200
++++ rpm-5.4.10/build/files.c 2012-07-10 20:18:14.677328833 +0200
+@@ -1329,7 +1329,7 @@ static rpmuint32_t getDigestAlgo(Header
+ * @param h
+ * @param isSrc
+ */
+-static void genCpioListAndHeader(/*@partial@*/ FileList fl,
++static rpmRC genCpioListAndHeader(/*@partial@*/ FileList fl,
+ rpmfi * fip, Header h, int isSrc)
+ /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
+ /*@modifies h, *fip, fl->processingFailed, fl->fileList,
+@@ -1349,6 +1349,7 @@ static void genCpioListAndHeader(/*@part
+ rpmuint32_t dalgo = getDigestAlgo(h, isSrc);
+ char buf[BUFSIZ];
+ int i, xx;
++ rpmRC rc = RPMRC_OK;
+
+ memset(buf, 0, sizeof(buf)); /* XXX valgrind on rhel6 beta pickier */
+
+@@ -1377,9 +1378,14 @@ memset(buf, 0, sizeof(buf)); /* XXX valg
+ /* file flags */
+ flp[1].flags |= flp->flags;
+
+- if (!(flp[1].flags & RPMFILE_EXCLUDE))
+- rpmlog(RPMLOG_WARNING, _("File listed twice: %s\n"),
++ if (!(flp[1].flags & RPMFILE_EXCLUDE)) {
++ int terminate = rpmExpandNumeric("%{?_files_listed_twice_terminate_build}");
++
++ rpmlog(terminate ? RPMLOG_ERR : RPMLOG_WARNING, _("File listed twice: %s\n"),
+ flp->fileURL);
++ if (terminate)
++ rc = RPMRC_FAIL;
++ }
+
+ /* file mode */
+ if (S_ISDIR(flp->fl_mode)) {
+@@ -1792,6 +1798,8 @@ if (_rpmbuildFlags & 4) {
+ fi = rpmfiFree(fi);
+ /*@=compdef@*/
+ }
++
++ return rc;
+ }
+
+ /**
+@@ -2514,7 +2522,8 @@ static rpmRC processPackageFiles(Spec sp
+ "PartialHardlinkSets", "4.0.4-1");
+
+ /* XXX should tags be added if filelist is empty? */
+- genCpioListAndHeader(&fl, &pkg->fi, pkg->header, 0);
++ if (genCpioListAndHeader(&fl, &pkg->fi, pkg->header, 0) != RPMRC_OK)
++ fl.processingFailed = 1;
+
+ if (spec->timeCheck)
+ timeCheck(spec->timeCheck, pkg->header);
+@@ -2828,7 +2837,7 @@ int processSourceFiles(Spec spec)
+
+ /* XXX should tags be added if filelist is empty? */
+ spec->fi = NULL;
+- genCpioListAndHeader(&fl, &spec->fi, spec->sourceHeader, 1);
++ rc = genCpioListAndHeader(&fl, &spec->fi, spec->sourceHeader, 1);
+
+ exit:
+ *sfp = rpmiobFree(*sfp);
+--- rpm-5.4.10/macros/mandriva.in.twice_terminate~ 2012-07-10 20:18:14.000000000 +0200
++++ rpm-5.4.10/macros/mandriva.in 2012-07-10 20:18:32.060111516 +0200
+@@ -128,6 +128,7 @@ end\
+
+ %_duplicate_files_terminate_build 1
+ %_unpackaged_subdirs_terminate_build 0
++%_files_listed_twice_terminate_build 1
+
+ %_build_pkgcheck_set /usr/bin/rpmlint -T -f %{_sourcedir}/%{name}.rpmlintrc
+ %_build_pkgcheck_srpm /usr/bin/rpmlint -T -f %{_sourcedir}/%{name}.rpmlintrc
diff --git a/rpm-5.4.10-fix-neon-saving-error-pages-as-target-file.patch b/rpm-5.4.10-fix-neon-saving-error-pages-as-target-file.patch
new file mode 100644
index 0000000..b2adfcd
--- /dev/null
+++ b/rpm-5.4.10-fix-neon-saving-error-pages-as-target-file.patch
@@ -0,0 +1,56 @@
+--- rpm-5.4.10/rpmio/rpmdav.c.dl_error~ 2012-07-06 17:39:19.000000000 +0200
++++ rpm-5.4.10/rpmio/rpmdav.c 2012-07-11 19:49:00.504968365 +0200
+@@ -1722,6 +1722,7 @@ int davReq(FD_t ctrl, const char * httpC
+ {
+ urlinfo u;
+ int rc = 0;
++ const ne_status *status;
+
+ assert(ctrl != NULL);
+ u = (urlinfo) ctrl->u;
+@@ -1789,10 +1790,24 @@ assert(ctrl->req != NULL);
+ }
+
+ /* XXX somewhere else instead? */
+-if (_dav_debug) {
+- const ne_status *status = ne_get_status((ne_request *)ctrl->req);
+-fprintf(stderr, "HTTP request sent, awaiting response... %d %s\n", status->code, status->reason_phrase);
+-}
++ status = ne_get_status((ne_request *)ctrl->req);
++ if (_dav_debug)
++ fprintf(stderr, "HTTP request sent, awaiting response... %d %s\n", status->code, status->reason_phrase);
++
++ switch (status->code) {
++ case 200:
++ case 201: /* 201 Created. */
++ break;
++ case 204: /* HACK: if overwriting, 204 No Content. */
++ case 403: /* 403 Forbidden. */
++ rc = FTPERR_UNKNOWN;
++ break;
++ default:
++ rc = FTPERR_FILE_NOT_FOUND;
++ break;
++ }
++ if (rc || _dav_debug)
++ fprintf(stderr, "HTTP request sent, awaiting response... %d %s\n", status->code, status->reason_phrase);
+
+ if (rc)
+ goto errxit;
+--- rpm-5.4.10/rpmio/rpmio.c.dl_error~ 2012-07-06 17:39:19.000000000 +0200
++++ rpm-5.4.10/rpmio/rpmio.c 2012-07-11 19:47:59.396732322 +0200
+@@ -2306,9 +2306,12 @@ fprintf(stderr, "*** ufdOpen(%s,0x%x,0%o
+ u->openError = httpReq(fd, cmd, path);
+ #endif
+ if (u->openError < 0) {
++ /* XXX rpmdav doesn't behave consistently with the rest...*/
++#ifndef WITH_NEON
+ /* XXX make sure that we can exit through ufdClose */
+- fd = fdLink(fd, "error ctrl (ufdOpen HTTP)");
+- fd = fdLink(fd, "error data (ufdOpen HTTP)");
++ fd = u->ctrl = fdLink(fd, "error ctrl (ufdOpen HTTP)");
++ fd = u->data fdLink(fd, "error data (ufdOpen HTTP)");
++#endif
+ } else {
+ fd->bytesRemain = ((!strcmp(cmd, "GET"))
+ ? fd->contentLength : -1);
diff --git a/rpm-5.4.10-support-ignore-arch-and-os-again.patch b/rpm-5.4.10-support-ignore-arch-and-os-again.patch
new file mode 100644
index 0000000..0708d04
--- /dev/null
+++ b/rpm-5.4.10-support-ignore-arch-and-os-again.patch
@@ -0,0 +1,45 @@
+--- rpm-5.4.10/lib/depends.c.ignore_arch~ 2012-07-27 21:11:47.463139875 +0200
++++ rpm-5.4.10/lib/depends.c 2012-07-27 21:29:21.811958701 +0200
+@@ -587,11 +587,24 @@ int rpmtsAddInstallElement(rpmts ts, Hea
+ if (nplatpat > 1) {
+ const char * platform = NULL;
+
+- he->tag = RPMTAG_PLATFORM;
+- xx = headerGet(h, he, 0);
+- platform = he->p.str;
+- if (!xx || platform == NULL)
+- platform = rpmExpand(arch, "-unknown-", os, NULL);
++ /*
++ * If ignore arch, we just set the arch in package platform string to
++ * same as on system so that we're sure that it'll match, same goes for
++ * os as well.
++ */
++ if (rpmExpandNumeric("%{__ignore_arch}") || rpmExpandNumeric("%{__ignore_os}")) {
++ platform = rpmExpand(
++ rpmExpandNumeric("%{__ignore_arch}") ? "%{_target_cpu}" : arch,
++ "-unknown-",
++ rpmExpandNumeric("%{__ignore_os}") ? "%{_target_os}" : os,
++ NULL);
++ } else {
++ he->tag = RPMTAG_PLATFORM;
++ xx = headerGet(h, he, 0);
++ platform = he->p.str;
++ if (!xx || platform == NULL)
++ platform = rpmExpand(arch, "-unknown-", os, NULL);
++ }
+
+ rc = rpmPlatformScore(platform, platpat, nplatpat);
+ #if defined(RPM_VENDOR_MANDRIVA)
+--- rpm-5.4.10/rpmpopt.in.ignore_arch~ 2012-07-27 21:29:07.687135285 +0200
++++ rpm-5.4.10/rpmpopt.in 2012-07-27 21:29:35.399788829 +0200
+@@ -431,6 +431,10 @@ rpm alias --without --define "_without_
+
+ rpm alias --arch --qf '%-34{=NAME}\t%{ARCH}\n' \
+ --POPTdesc=$"list package architecture"
++
++rpm alias --ignorearch --define '__ignore_arch 1'
++rpm alias --ignoreos --define '__ignore_os 1'
++
+ #==============================================================================
+ rpmbuild alias --dbpath --define '_dbpath !#:+' \
+ --POPTdesc=$"use database in DIRECTORY" \
diff --git a/rpm-5.4.10-unpackaged_subdirs_terminate_build.patch b/rpm-5.4.10-unpackaged_subdirs_terminate_build.patch
new file mode 100644
index 0000000..2e7c5b8
--- /dev/null
+++ b/rpm-5.4.10-unpackaged_subdirs_terminate_build.patch
@@ -0,0 +1,67 @@
+--- rpm-5.4.10/build/files.c.subdir_terminate~ 2012-07-10 20:14:36.357058212 +0200
++++ rpm-5.4.10/build/files.c 2012-07-10 20:14:36.367058087 +0200
+@@ -3025,7 +3025,7 @@ static inline int packagedDir(Package pk
+ * /A/B/C/D
+ * Now directories "/A/B" and "/A/B/C" should also be packaged.
+ */
+-static int pkgUnpackagedSubdirs(Package pkg, size_t buildrootL)
++static int pkgUnpackagedSubdirs(Package pkg, size_t buildrootL, int _unpackaged_subdirs_terminate_build)
+ /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
+ /*@modifies pkg->header,
+ rpmGlobalMacroContext, fileSystem, internalState @*/
+@@ -3103,7 +3103,7 @@ static int pkgUnpackagedSubdirs(Package
+ }
+ unpackaged = _free(unpackaged);
+
+- rpmlog(RPMLOG_WARNING,
++ rpmlog(_unpackaged_subdirs_terminate_build ? RPMLOG_ERR : RPMLOG_WARNING,
+ _("Unpackaged subdir(s) in %s:\n%s"),
+ N, rpmiobStr(list));
+
+@@ -3119,7 +3119,7 @@ static int pkgUnpackagedSubdirs(Package
+ * @param spec spec file control structure
+ * @return number of unpackaged subdirectories
+ */
+-static int checkUnpackagedSubdirs(Spec spec, size_t buildrootL)
++static int checkUnpackagedSubdirs(Spec spec, size_t buildrootL, int _unpackaged_subdirs_terminate_build)
+ /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
+ /*@modifies *spec->packages,
+ rpmGlobalMacroContext, fileSystem, internalState @*/
+@@ -3128,7 +3128,7 @@ static int checkUnpackagedSubdirs(Spec s
+ Package pkg;
+
+ for (pkg = spec->packages; pkg; pkg = pkg->next)
+- n += pkgUnpackagedSubdirs(pkg, buildrootL);
++ n += pkgUnpackagedSubdirs(pkg, buildrootL, _unpackaged_subdirs_terminate_build);
+ return n;
+ }
+
+@@ -3185,12 +3185,16 @@ rpmRC processBinaryFiles(Spec spec, int
+ if (res == RPMRC_OK) {
+ int _duplicate_files_terminate_build =
+ rpmExpandNumeric("%{?_duplicate_files_terminate_build}");
++ int _unpackaged_subdirs_terminate_build =
++ rpmExpandNumeric("%{?_unpackaged_subdirs_terminate_build}");
+ if (checkUnpackagedFiles(spec) > 0)
+ res = RPMRC_FAIL;
+ if (checkDuplicateFiles(spec, buildrootL, _duplicate_files_terminate_build) > 0 &&
+ _duplicate_files_terminate_build)
+ res = RPMRC_FAIL;
+- (void) checkUnpackagedSubdirs(spec, buildrootL);
++ if (checkUnpackagedSubdirs(spec, buildrootL, _unpackaged_subdirs_terminate_build) > 0 &&
++ _unpackaged_subdirs_terminate_build)
++ res = RPMRC_FAIL;
+ }
+
+ return res;
+--- rpm-5.4.10/macros/mandriva.in.subdir_terminate~ 2012-07-10 20:14:36.000000000 +0200
++++ rpm-5.4.10/macros/mandriva.in 2012-07-10 20:14:57.333795967 +0200
+@@ -127,7 +127,7 @@ end\
+ %_binary_payload w5.xzdio
+
+ %_duplicate_files_terminate_build 1
+-
++%_unpackaged_subdirs_terminate_build 0
+
+ %_build_pkgcheck_set /usr/bin/rpmlint -T -f %{_sourcedir}/%{name}.rpmlintrc
+ %_build_pkgcheck_srpm /usr/bin/rpmlint -T -f %{_sourcedir}/%{name}.rpmlintrc
diff --git a/rpm-5.4.4-add-_specfile-macro.patch b/rpm-5.4.4-add-_specfile-macro.patch
new file mode 100644
index 0000000..723a17a
--- /dev/null
+++ b/rpm-5.4.4-add-_specfile-macro.patch
@@ -0,0 +1,10 @@
+--- rpm-5.4.4/build/parseSpec.c.specfile~ 2011-11-11 13:41:29.137827186 +0100
++++ rpm-5.4.4/build/parseSpec.c 2011-11-11 13:42:12.938874762 +0100
+@@ -542,6 +542,7 @@ int parseSpec(rpmts ts, const char *spec
+ * /.././../usr/../bin//./sh (XXX FIXME: dots not handled yet)
+ */
+ spec->specFile = rpmGetPath(specFile, NULL);
++ addMacro(spec->macros, "_specfile", NULL, spec->specFile, RMIL_SPEC);
+ spec->fileStack = newOpenFileInfo();
+ spec->fileStack->fileName = xstrdup(spec->specFile);
+
diff --git a/rpm-5.4.4-allow-installation-of-repackaged-rpms.patch b/rpm-5.4.4-allow-installation-of-repackaged-rpms.patch
new file mode 100644
index 0000000..545929a
--- /dev/null
+++ b/rpm-5.4.4-allow-installation-of-repackaged-rpms.patch
@@ -0,0 +1,11 @@
+--- rpm-5.4.4/rpmdb/rpmdb.c.repackage~ 2011-11-24 16:28:22.436460713 +0100
++++ rpm-5.4.4/rpmdb/rpmdb.c 2011-11-24 16:28:30.107464575 +0100
+@@ -2758,7 +2758,7 @@ int rpmdbAdd(rpmdb db, int iid, Header h
+ if (_rpmdb_debug)
+ fprintf(stderr, "--> %s(%p, %u, %p, %p) h# %u\n", __FUNCTION__, db, (unsigned)iid, h, ts, (unsigned)hdrNum);
+
+-assert(headerIsEntry(h, RPMTAG_REMOVETID) == 0); /* XXX sanity */
++//assert(headerIsEntry(h, RPMTAG_REMOVETID) == 0); /* XXX sanity */
+
+ /* Add the install transaction id. */
+ if (iid != 0 && iid != -1) {
diff --git a/rpm-5.4.4-drop-useless-auto-generated-pkgconfig-dependency.patch b/rpm-5.4.4-drop-useless-auto-generated-pkgconfig-dependency.patch
new file mode 100644
index 0000000..1da18fe
--- /dev/null
+++ b/rpm-5.4.4-drop-useless-auto-generated-pkgconfig-dependency.patch
@@ -0,0 +1,23 @@
+--- rpm-5.4.4/scripts/pkgconfigdeps.sh.oneshot~ 2011-12-11 01:40:12.599487103 +0100
++++ rpm-5.4.4/scripts/pkgconfigdeps.sh 2011-12-11 01:40:14.418488230 +0100
+@@ -37,12 +37,10 @@ case $1 in
+ done
+ ;;
+ -R|--requires)
+- oneshot="pkgconfig"
+ while read filename ; do
+ case "${filename}" in
+ *.pc)
+ if [[ "$(dirname ${filename})" =~ pkgconfig ]]; then
+- [ -n "$oneshot" ] && echo "$oneshot"; oneshot=""
+ # Query the dependencies of the package.
+ DIR=`dirname ${filename}`
+ PKG_CONFIG_PATH="$DIR:$DIR/../../share/pkgconfig"
+@@ -54,7 +52,6 @@ case $1 in
+ else
+ echo "pkgconfig($n)"
+ fi
+- oneshot=""
+ done
+ fi
+ ;;
diff --git a/rpm-5.4.4-fix-rpmconstant-to-always-use-LC_CTYPE-C-for-case-conversion.patch b/rpm-5.4.4-fix-rpmconstant-to-always-use-LC_CTYPE-C-for-case-conversion.patch
new file mode 100644
index 0000000..ce1e804
--- /dev/null
+++ b/rpm-5.4.4-fix-rpmconstant-to-always-use-LC_CTYPE-C-for-case-conversion.patch
@@ -0,0 +1,20 @@
+--- rpm-5.4.4/rpmconstant/rpmconstant.c.locale~ 2008-08-18 12:57:58.000000000 +0200
++++ rpm-5.4.4/rpmconstant/rpmconstant.c 2011-12-16 16:41:27.721549143 +0100
+@@ -89,7 +89,7 @@ int rpmconstInitToContext(rpmconst c, co
+ int rc = 0;
+ if (!context) return 0; /* programmer error */
+ for (ptr = lccontext; *ptr != 0; ptr++)
+- *ptr = (char)tolower(*ptr);
++ *ptr = (char)xtolower(*ptr);
+ rpmconstInitL(c);
+ while (rpmconstNextL(c)) {
+ if (!strcmp(lccontext, rpmconstContext(c))) {
+@@ -108,7 +108,7 @@ int rpmconstNameMatch(rpmconst c, const
+ char * ucname = strdup(name);
+
+ for (uc = ucname; *uc != 0; uc++)
+- *uc = (char)toupper(*uc);
++ *uc = (char)xtoupper(*uc);
+
+ if (!prefixed) prefixed = ALLCASE_PREFIX;
+ if (prefixed & WITH_PREFIX)
diff --git a/rpm-5.4.4-glob-wildcards-for-loading-macro-files.patch b/rpm-5.4.4-glob-wildcards-for-loading-macro-files.patch
new file mode 100644
index 0000000..67a1c2b
--- /dev/null
+++ b/rpm-5.4.4-glob-wildcards-for-loading-macro-files.patch
@@ -0,0 +1,24 @@
+--- rpm-5.4.4/rpmio/macro.c.glob~ 2011-09-30 20:40:18.000000000 +0200
++++ rpm-5.4.4/rpmio/macro.c 2011-11-17 16:49:16.870465121 +0100
+@@ -2798,6 +2798,9 @@ rpmLoadMacroFile(MacroContext mc, const
+ /* Parse %{load:...} immediately recursively. */
+ if (s[1] == '{' && !strncmp(s+2, "load:", sizeof("load:")-1)) {
+ char * se = (char *) matchchar(s, '{', '}');
++ const char ** argv = NULL;
++ int argc = 0;
++ int i;
+ if (se == NULL) {
+ rpmlog(RPMLOG_WARNING,
+ _("%s:%u Missing '}' in \"%s\", skipping.\n"),
+@@ -2814,7 +2817,10 @@ rpmLoadMacroFile(MacroContext mc, const
+ continue;
+ }
+ se = rpmMCExpand(mc, s, NULL);
+- rc = rpmLoadMacroFile(mc, se, nesting - 1);
++ rc = rpmGlob(se, &argc, &argv);
++ for(i = 0; i < argc; i++)
++ rc |= rpmLoadMacroFile(mc, argv[i], nesting - 1);
++ argv = _free(argv);
+ se = _free(se);
+ if (rc != 0)
+ goto exit;
diff --git a/rpm-5.4.4-pass-_builddir-properly-to-find-debuginfo.patch b/rpm-5.4.4-pass-_builddir-properly-to-find-debuginfo.patch
new file mode 100644
index 0000000..3bc3643
--- /dev/null
+++ b/rpm-5.4.4-pass-_builddir-properly-to-find-debuginfo.patch
@@ -0,0 +1,23 @@
+--- rpm-5.4.4/macros/macros.rpmbuild.in.builddir~ 2011-12-20 15:36:20.813852241 +0100
++++ rpm-5.4.4/macros/macros.rpmbuild.in 2011-12-20 15:37:43.385806877 +0100
+@@ -326,8 +326,9 @@ echo "Patch #%{__patch_number} (%{basena
+ %___build_args -e
+ %___build_cmd %{?_sudo:%{_sudo} }%{?_remsh:%{_remsh} %{_remhost} }%{?_remsudo:%{_remsudo} }%{?_remchroot:%{_remchroot} %{_remroot} }%{___build_shell} %{___build_args}
+ %___build_pre \
++ RPM_BUILD_DIR=\"%{u2p:%{_builddir}}\"\
+ RPM_OPT_FLAGS=\"%{optflags}\"\
+- export RPM_OPT_FLAGS\
++ export RPM_BUILD_DIR RPM_OPT_FLAGS\
+ %{?buildroot:RPM_BUILD_ROOT=\"%{u2p:%{buildroot}}\"\
+ export RPM_BUILD_ROOT}\
+ %{?_javaclasspath:CLASSPATH=\"%{_javaclasspath}\"\
+--- rpm-5.4.4/scripts/find-debuginfo.sh.builddir~ 2011-12-20 15:36:31.962846125 +0100
++++ rpm-5.4.4/scripts/find-debuginfo.sh 2011-12-20 15:36:49.492836503 +0100
+@@ -32,7 +32,6 @@ strip_r=false
+ # Barf on missing build IDs.
+ strict=false
+
+-RPM_BUILD_DIR="`pwd`"
+ # canon RPM_BUILD_DIR, the DW_AT_comp_dir in ELF objects is real a real path
+ # and debugedit will ignore them as they are out of build dir.
+ RPM_BUILD_DIR=$(readlink -f "$RPM_BUILD_DIR")
diff --git a/rpm-5.4.4-pkgconfigdeps-check-path.patch b/rpm-5.4.4-pkgconfigdeps-check-path.patch
new file mode 100644
index 0000000..39858fe
--- /dev/null
+++ b/rpm-5.4.4-pkgconfigdeps-check-path.patch
@@ -0,0 +1,76 @@
+--- rpm-5.4.4/scripts/pkgconfigdeps.sh.pc_path~ 2011-11-17 15:08:42.400054348 +0100
++++ rpm-5.4.4/scripts/pkgconfigdeps.sh 2011-11-17 15:08:44.380056984 +0100
+@@ -16,20 +16,22 @@ case $1 in
+ while read filename ; do
+ case "${filename}" in
+ *.pc)
+- # Query the dependencies of the package.
+- DIR=`dirname ${filename}`
+- PKG_CONFIG_PATH="$DIR:$DIR/../../share/pkgconfig"
+- export PKG_CONFIG_PATH
+- $pkgconfig --print-provides "$filename" 2> /dev/null | while read n r v ; do
+- [ -n "$n" ] || continue
+- # We have a dependency. Make a note that we need the pkgconfig
+- # tool for this package.
+- if [ -n "$r" ] && [ -n "$v" ]; then
+- echo "pkgconfig($n) $r $v"
+- else
+- echo "pkgconfig($n)"
+- fi
+- done
++ if [[ "$(dirname ${filename})" =~ pkgconfig ]]; then
++ # Query the dependencies of the package.
++ DIR=`dirname ${filename}`
++ PKG_CONFIG_PATH="$DIR:$DIR/../../share/pkgconfig"
++ export PKG_CONFIG_PATH
++ $pkgconfig --print-provides "$filename" 2> /dev/null | while read n r v ; do
++ [ -n "$n" ] || continue
++ # We have a dependency. Make a note that we need the pkgconfig
++ # tool for this package.
++ if [ -n "$r" ] && [ -n "$v" ]; then
++ echo "pkgconfig($n) $r $v"
++ else
++ echo "pkgconfig($n)"
++ fi
++ done
++ fi
+ ;;
+ esac
+ done
+@@ -39,20 +41,22 @@ case $1 in
+ while read filename ; do
+ case "${filename}" in
+ *.pc)
+- [ -n "$oneshot" ] && echo "$oneshot"; oneshot=""
+- # Query the dependencies of the package.
+- DIR=`dirname ${filename}`
+- PKG_CONFIG_PATH="$DIR:$DIR/../../share/pkgconfig"
+- export PKG_CONFIG_PATH
+- $pkgconfig --print-requires "$filename" 2> /dev/null | while read n r v ; do
+- [ -n "$n" ] || continue
+- if [ -n "$r" ] && [ -n "$v" ]; then
+- echo "pkgconfig($n) $r $v"
+- else
+- echo "pkgconfig($n)"
+- fi
+- oneshot=""
+- done
++ if [[ "$(dirname ${filename})" =~ pkgconfig ]]; then
++ [ -n "$oneshot" ] && echo "$oneshot"; oneshot=""
++ # Query the dependencies of the package.
++ DIR=`dirname ${filename}`
++ PKG_CONFIG_PATH="$DIR:$DIR/../../share/pkgconfig"
++ export PKG_CONFIG_PATH
++ $pkgconfig --print-requires "$filename" 2> /dev/null | while read n r v ; do
++ [ -n "$n" ] || continue
++ if [ -n "$r" ] && [ -n "$v" ]; then
++ echo "pkgconfig($n) $r $v"
++ else
++ echo "pkgconfig($n)"
++ fi
++ oneshot=""
++ done
++ fi
+ ;;
+ esac
+ done
diff --git a/rpm-5.4.4-rpmbuild-withoutclean.patch b/rpm-5.4.4-rpmbuild-withoutclean.patch
new file mode 100644
index 0000000..7dae678
--- /dev/null
+++ b/rpm-5.4.4-rpmbuild-withoutclean.patch
@@ -0,0 +1,10 @@
+--- rpm-5.4.4/rpmpopt.in.clean~ 2011-12-05 20:52:18.544053402 +0100
++++ rpm-5.4.4/rpmpopt.in 2011-12-05 20:53:51.520325674 +0100
+@@ -454,5 +454,7 @@ rpmbuild alias --lsb --noautoreq --noaut
+
+ rpmbuild alias --withoutcheck --define 'check exit 0' \
+ --POPTdesc=$"disable %check stanza for build"
++rpmbuild alias --withoutclean --define '__spec_clean_body %{nil}' \
++ --POPTdesc=$"disable %clean stanza for build"
+ # \endverbatim
+ #*/
diff --git a/rpm-5.4.5-python-export-spec-macros.patch b/rpm-5.4.5-python-export-spec-macros.patch
new file mode 100644
index 0000000..081deee
--- /dev/null
+++ b/rpm-5.4.5-python-export-spec-macros.patch
@@ -0,0 +1,70 @@
+--- rpm-5.4.5/python/spec-py.c.py_macros~ 2012-03-01 22:55:19.592995392 +0100
++++ rpm-5.4.5/python/spec-py.c 2012-03-01 22:56:02.081016570 +0100
+@@ -6,6 +6,8 @@
+
+ #include <rpmiotypes.h>
+ #include <rpmio.h>
++#define _MACRO_INTERNAL
++#include <rpmmacro.h>
+ #include "spec-py.h"
+
+ /** \ingroup python
+@@ -146,6 +148,50 @@ spec_get_sources(specObject *s)
+
+ }
+
++static PyObject *
++spec_get_macros(specObject *s)
++ /*@*/
++{
++ MacroContext mc;
++ PyObject *macroDict;
++ Spec spec;
++
++ macroDict = PyDict_New();
++ if (!macroDict) {
++ return NULL;
++ }
++ spec = specFromSpec(s);
++ if ( spec != NULL) {
++ mc = spec->macros;
++ if (mc->macroTable != NULL) {
++ int i;
++ for (i = 0; i < mc->firstFree; i++) {
++ MacroEntry me;
++ PyObject *macro;
++ if ((me = mc->macroTable[i]) == NULL) {
++ /* XXX this should never happen */
++ continue;
++ }
++ macro = PyDict_New();
++
++ PyMapping_SetItemString(macro, "used", PyInt_FromLong(me->used));
++ PyMapping_SetItemString(macro, "level", PyInt_FromLong(me->level));
++ if (me->opts && *me->opts)
++ PyMapping_SetItemString(macro, "opts", PyString_FromString(me->opts));
++ if (me->body && *me->body)
++ PyMapping_SetItemString(macro, "body", PyString_FromString(me->body));
++ PyMapping_SetItemString(macroDict, strdup(me->name), macro);
++ }
++ }
++
++ return macroDict;
++ }
++ else {
++ return NULL;
++ }
++
++}
++
+ /**
+ */
+ /*@unchecked@*/ /*@observer@*/
+@@ -161,6 +207,7 @@ static PyMethodDef spec_Spec_methods[] =
+ {"check", (PyCFunction) spec_get_check, METH_VARARGS, NULL },
+ {"clean", (PyCFunction) spec_get_clean, METH_VARARGS, NULL },
+ {"buildRoot", (PyCFunction) spec_get_buildroot, METH_VARARGS, NULL },
++ {"macros", (PyCFunction) spec_get_macros, METH_VARARGS, NULL },
+ {NULL} /* Sentinel */
+ };
+ /*@=fullinitblock@*/
diff --git a/rpm-5.4.5-rpmfc-apply-python-coloring-from-magic.patch b/rpm-5.4.5-rpmfc-apply-python-coloring-from-magic.patch
new file mode 100644
index 0000000..06d5470
--- /dev/null
+++ b/rpm-5.4.5-rpmfc-apply-python-coloring-from-magic.patch
@@ -0,0 +1,10 @@
+--- rpm-5.4.5/lib/rpmfc.c.python_coloring~ 2012-03-05 23:13:57.442354701 +0100
++++ rpm-5.4.5/lib/rpmfc.c 2012-03-05 23:13:59.610357114 +0100
+@@ -641,6 +641,7 @@ static struct rpmfcTokens_s rpmfcTokens[
+ /* XXX "python 2.3 byte-compiled" */
+ { " /usr/bin/python", RPMFC_PYTHON|RPMFC_INCLUDE },
+ { "python ", RPMFC_PYTHON|RPMFC_INCLUDE },
++ { "Python script", RPMFC_PYTHON|RPMFC_INCLUDE },
+
+ { "libtool library ", RPMFC_LIBTOOL|RPMFC_INCLUDE },
+ { "pkgconfig ", RPMFC_PKGCONFIG|RPMFC_INCLUDE },
diff --git a/rpm-5.4.5-rpmfc-use-strlen-not-sizeof.patch b/rpm-5.4.5-rpmfc-use-strlen-not-sizeof.patch
new file mode 100644
index 0000000..a18a408
--- /dev/null
+++ b/rpm-5.4.5-rpmfc-use-strlen-not-sizeof.patch
@@ -0,0 +1,11 @@
+--- rpm-5.4.5/lib/rpmfc.c.sizeof~ 2012-03-05 21:01:46.845529682 +0100
++++ rpm-5.4.5/lib/rpmfc.c 2012-03-05 21:01:51.679533439 +0100
+@@ -909,7 +909,7 @@ static int rpmfcSCRIPT(rpmfc fc)
+ if (defaultdocdir == NULL || *defaultdocdir == '\0')
+ defaultdocdir = "/usr/share/doc";
+
+- if (strncmp(fn, defaultdocdir, sizeof(defaultdocdir)-1)) {
++ if (strncmp(fn, defaultdocdir, strlen(defaultdocdir))) {
+ if (fc->fcolor->vals[fc->ix] & RPMFC_MODULE)
+ xx = rpmfcHelper(fc, 'P', "perl");
+ if (is_executable || (fc->fcolor->vals[fc->ix] & RPMFC_MODULE))
diff --git a/rpm-5.4.5-rubygems-add-missing-newline.patch b/rpm-5.4.5-rubygems-add-missing-newline.patch
new file mode 100644
index 0000000..706e38a
--- /dev/null
+++ b/rpm-5.4.5-rubygems-add-missing-newline.patch
@@ -0,0 +1,16 @@
+--- rpm-5.4.5/scripts/rubygems.rb.rb_newline~ 2012-02-29 17:25:34.815069060 +0100
++++ rpm-5.4.5/scripts/rubygems.rb 2012-02-29 18:45:41.587464927 +0100
+@@ -61,10 +61,11 @@ for path in $stdin.readlines
+ end
+
+ if requires or abi_provide
+- print "ruby(abi)"
++ abidep = "ruby(abi)"
+ if ruby_versioned
+- print " = %s\n" % RbConfig::CONFIG["ruby_version"]
++ abidep += " = %s" % RbConfig::CONFIG["ruby_version"]
+ end
++ print abidep + "\n"
+ end
+
+ if gems.length > 0
diff --git a/rpm-5.4.5-skip-dependencies-for-character-devices.patch b/rpm-5.4.5-skip-dependencies-for-character-devices.patch
new file mode 100644
index 0000000..790ff48
--- /dev/null
+++ b/rpm-5.4.5-skip-dependencies-for-character-devices.patch
@@ -0,0 +1,13 @@
+--- rpm-5.4.5/lib/rpmfc.c.skip_chrdev~ 2012-03-03 05:22:33.527640802 +0100
++++ rpm-5.4.5/lib/rpmfc.c 2012-03-03 05:31:05.973896224 +0100
+@@ -1265,7 +1265,9 @@ assert(fc->fn != NULL);
+ }
+ }
+
+- xx = (*fcat->func) (fc);
++ struct stat sb, * st = &sb;
++ if (stat(fc->fn[fc->ix], st) == 0 && !(st->st_mode & (S_IFBLK|S_IFCHR)))
++ xx = (*fcat->func) (fc);
+ }
+ }
+
diff --git a/rpm-5.4.7-dont-consider-trigger-dependencies-as-overlapping.patch b/rpm-5.4.7-dont-consider-trigger-dependencies-as-overlapping.patch
new file mode 100644
index 0000000..bfb9159
--- /dev/null
+++ b/rpm-5.4.7-dont-consider-trigger-dependencies-as-overlapping.patch
@@ -0,0 +1,12 @@
+--- rpm-5.4.7/build/reqprov.c.triggers_nooverlap~ 2012-03-20 16:44:54.803999496 +0100
++++ rpm-5.4.7/build/reqprov.c 2012-03-20 16:44:57.294002536 +0100
+@@ -117,6 +117,9 @@ int addReqProv(/*@unused@*/ Spec spec, H
+ * bit further, leaving under #ifdef for now...
+ * TODO: auto-generated deps too
+ */
++ if (Flags & RPMSENSE_TRIGGER)
++ continue;
++
+ if (flagtag && versions != NULL) {
+ int overlap = 0, res = 0;
+ rpmds old = rpmdsSingle(flagtag, names[len], versions[len] ? versions[len] : "", flags[len]);
diff --git a/rpm-5.4.7-fix-generation-of-ruby-abi-provides.patch b/rpm-5.4.7-fix-generation-of-ruby-abi-provides.patch
new file mode 100644
index 0000000..b75fd38
--- /dev/null
+++ b/rpm-5.4.7-fix-generation-of-ruby-abi-provides.patch
@@ -0,0 +1,48 @@
+--- rpm-5.4.7/lib/rpmfc.c.rubyabi_prov~ 2012-03-10 21:50:02.143073469 +0100
++++ rpm-5.4.7/lib/rpmfc.c 2012-03-10 21:57:13.898394232 +0100
+@@ -1204,9 +1204,13 @@ assert(fc->fn != NULL);
+ }
+ else if (!strncmp(fn, "/ruby", sizeof("/ruby")-1)) {
+ fc->fcolor->vals[fc->ix] |= RPMFC_RUBY;
+- if ((fn = strstr(fn, "/specifications/")) &&
+- (fn = strrchr(fn, '.')) && !strcmp(fn, ".gemspec"))
+- fc->fcolor->vals[fc->ix] |= RPMFC_MODULE;
++ if ((strstr(fn, ".gemspec") || strstr(fn, "rbconfig.rb"))) {
++ miRE mire = mireNew(RPMMIRE_REGEX, RPMTAG_FILEPATHS);
++ if (!mireRegcomp(mire, ".*/(specifications/.*\\.gemspec|rbconfig\\.rb)$"))
++ if (mireRegexec(mire, fc->fn[fc->ix], (size_t) 0) >= 0)
++ fc->fcolor->vals[fc->ix] |= RPMFC_MODULE;
++ mire = mireFree(mire);
++ }
+ }
+ /* XXX: lacking better, more generic classifier... */
+ else if (!strncmp(fn, "/gstreamer", sizeof("/gstreamer")-1) &&
+--- rpm-5.4.7/scripts/rubygems.rb.rubyabi_prov~ 2012-03-10 21:50:15.637085059 +0100
++++ rpm-5.4.7/scripts/rubygems.rb 2012-03-10 21:50:23.928092180 +0100
+@@ -36,7 +36,12 @@ ruby_versioned = false
+ abi_provide = false
+
+ for path in $stdin.readlines
+- if path.match(specpatt)
++ # way fugly, but we make the assumption that if the package has
++ # this file, the package is the current ruby version, and should
++ # therefore provide ruby(abi) = version
++ if provides and path.match(RbConfig::CONFIG["archdir"] + "/rbconfig.rb")
++ abi_provide = true
++ elsif path.match(specpatt)
+ ruby_versioned = true
+ gems.push(path.chomp)
+ # this is quite ugly and lame, but the assumption made is that if any files
+@@ -46,12 +51,6 @@ for path in $stdin.readlines
+ elsif not ruby_versioned
+ if path.match(RbConfig::CONFIG["rubylibdir"])
+ ruby_versioned = true
+- # even more fugly, but we make the assumption that if the package has
+- # this file, the package is the current ruby version, and should
+- # therefore provide ruby(abi) = version
+- if provides and path.match(RbConfig::CONFIG["rubylibdir"] + "/Env.rb")
+- abi_provide = true
+- end
+ elsif path.match(RbConfig::CONFIG["sitelibdir"])
+ ruby_versioned = true
+ elsif path.match(RbConfig::CONFIG["vendorlibdir"])
diff --git a/rpm-5.4.7-fix-minor-memleaks.patch b/rpm-5.4.7-fix-minor-memleaks.patch
new file mode 100644
index 0000000..78a1899
--- /dev/null
+++ b/rpm-5.4.7-fix-minor-memleaks.patch
@@ -0,0 +1,25 @@
+--- rpm-5.4.7/build/parseReqs.c.memleak~ 2012-03-21 19:13:54.725053861 +0100
++++ rpm-5.4.7/build/parseReqs.c 2012-03-21 19:13:57.755057614 +0100
+@@ -177,7 +177,7 @@ rpmRC parseRCPOT(Spec spec, Package pkg,
+ if (!(nr > 3 && EVR[0] == '%' && EVR[1] == '{' && EVR[nr-1] == '}'))
+ {
+ memset(evr, 0, sizeof(*evr));
+- ix = rpmEVRparse(xstrdup(EVR), evr);
++ ix = rpmEVRparse(EVR, evr);
+ evr->str = _free(evr->str);
+ }
+ if (ix != 0) {
+--- rpm-5.4.7/rpmio/macro.c.memleak~ 2012-03-21 19:16:07.453218370 +0100
++++ rpm-5.4.7/rpmio/macro.c 2012-03-21 19:19:33.758488216 +0100
+@@ -2818,8 +2818,10 @@ rpmLoadMacroFile(MacroContext mc, const
+ }
+ se = rpmMCExpand(mc, s, NULL);
+ rc = rpmGlob(se, &argc, &argv);
+- for(i = 0; i < argc; i++)
++ for(i = 0; i < argc; i++) {
+ rc |= rpmLoadMacroFile(mc, argv[i], nesting - 1);
++ argv[i] = _free(argv[i]);
++ }
+ argv = _free(argv);
+ se = _free(se);
+ if (rc != 0)
diff --git a/rpm-5.4.7-hdrfmt-fix-unitialized-argv-element.patch b/rpm-5.4.7-hdrfmt-fix-unitialized-argv-element.patch
new file mode 100644
index 0000000..157a6eb
--- /dev/null
+++ b/rpm-5.4.7-hdrfmt-fix-unitialized-argv-element.patch
@@ -0,0 +1,14 @@
+--- rpm-5.4.7/rpmdb/hdrfmt.c.unitialized~ 2012-03-19 14:21:14.907225418 +0100
++++ rpm-5.4.7/rpmdb/hdrfmt.c 2012-03-19 14:21:17.327228582 +0100
+@@ -2048,8 +2048,10 @@ static int triggertypeTag(Header h, HE_t
+ he->p.argv = xmalloc(sizeof(*he->p.argv) * he->c);
+ for (i = 0; i < (unsigned) he->c; i++) {
+ for (j = 0; j < (unsigned) numNames; j++) {
+- if (indices.ui32p[j] != i)
++ if (indices.ui32p[j] != i) {
++ he->p.argv[i] = NULL;
+ /*@innercontinue@*/ continue;
++ }
+
+ /* XXX FIXME: there's memory leaks here. */
+ if (flags.ui32p[j] & RPMSENSE_TRIGGERPREIN)
diff --git a/rpm-5.4.7-kmod-dependencies.patch b/rpm-5.4.7-kmod-dependencies.patch
new file mode 100644
index 0000000..df3d02c
--- /dev/null
+++ b/rpm-5.4.7-kmod-dependencies.patch
@@ -0,0 +1,66 @@
+--- rpm-5.4.7/lib/rpmfc.c.kmod~ 2012-03-16 16:34:04.640654829 +0100
++++ rpm-5.4.7/lib/rpmfc.c 2012-03-16 16:34:04.644654834 +0100
+@@ -981,6 +981,19 @@ static int rpmfcSCRIPT(rpmfc fc)
+ xx = rpmfcHelper(fc, 'P', "gstreamer");
+ /* XXX: currently of no use, but for the sake of consistency... */
+ xx = rpmfcHelper(fc, 'R', "gstreamer");
++#if defined(RPM_VENDOR_MANDRIVA) || defined(RPM_VENDOR_PLD)
++ } else
++ if ((fc->fcolor->vals[fc->ix] & RPMFC_MODULE)) {
++ miRE mire = mireNew(RPMMIRE_REGEX, RPMTAG_FILEPATHS);
++ if (!mireRegcomp(mire, "^.*((/lib/modules/|/var/lib/dkms/).*\\.ko(\\.gz|\\.xz)?|(/var/lib/dkms-binary/[^/]+/[^/]+|/usr/src)/[^/]+/dkms.conf)$"))
++ if (mireRegexec(mire, fc->fn[fc->ix], (size_t) 0) >= 0) {
++ fc->fcolor->vals[fc->ix] |= (RPMFC_MODULE|RPMFC_SCRIPT);
++ xx = rpmfcHelper(fc, 'P', "kernel");
++ /* XXX: currently of no use, but for the sake of consistency... */
++ xx = rpmfcHelper(fc, 'R', "kernel");
++ }
++ mire = mireFree(mire);
++#endif
+ } else
+ if (fc->fcolor->vals[fc->ix] & RPMFC_JAVA) {
+ xx = rpmfcHelper(fc, 'P', "java");
+@@ -1188,6 +1201,14 @@ assert(fc->fn != NULL);
+ else if (!strncmp(fn, "/gstreamer", sizeof("/gstreamer")-1) &&
+ fc->fcolor->vals[fc->ix] & RPMFC_LIBRARY)
+ fc->fcolor->vals[fc->ix] |= (RPMFC_MODULE|RPMFC_SCRIPT);
++#if defined(RPM_VENDOR_MANDRIVA) || defined(RPM_VENDOR_PLD)
++ } else {
++ miRE mire = mireNew(RPMMIRE_REGEX, RPMTAG_FILEPATHS);
++ if (!mireRegcomp(mire, "^.*((/lib/modules/|/var/lib/dkms/).*\\.ko(\\.gz|\\.xz)?|(/var/lib/dkms-binary/[^/]+/[^/]+|/usr/src)/[^/]+/dkms.conf)$"))
++ if (mireRegexec(mire, fc->fn[fc->ix], (size_t) 0) >= 0)
++ fc->fcolor->vals[fc->ix] |= (RPMFC_MODULE|RPMFC_SCRIPT);
++ mire = mireFree(mire);
++#endif
+ }
+ }
+
+--- rpm-5.4.7/macros/kernel.in.kmod~ 2011-04-10 12:54:18.000000000 +0200
++++ rpm-5.4.7/macros/kernel.in 2012-03-16 16:37:04.277948160 +0100
+@@ -2,11 +2,11 @@
+ # To make use of these macros insert the following line into your spec file:
+ # %{load:%{_usrlibrpm}/macros.d/kernel}
+
+-%__modinfo @__MODINFO
++%__modinfo @__MODINFO@
+
+ # Path to scripts to autogenerate gstreamer package dependencies,
+ #
+-# Note: Used if _use_internal_dependency_generator is non-zero. The
++# Note: Used iff _use_internal_dependency_generator is non-zero. The
+ # helpers are also used by %{_rpmhome}/rpmdeps {--provides|--requires}.
+ %__kernel_provides %{_rpmhome}/kmod-deps.sh --provides --modinfo %__modinfo
+ #%__kernel_requires %{_rpmhome}/kmod-deps.sh --requires --modinfo %__modinfo
+--- rpm-5.4.7/macros/macros.in.kmod~ 2012-03-16 16:34:04.614654786 +0100
++++ rpm-5.4.7/macros/macros.in 2012-03-16 16:34:04.645654836 +0100
+@@ -981,6 +981,10 @@ $_arbitrary_tags_tests Foo:Bar
+ %{load:%{_usrlibrpm}/macros.d/haskell}
+
+ #------------------------------------------------------------------------
++# kmod(...) configuration.
++%{load:%{_usrlibrpm}/macros.d/kernel}
++
++#------------------------------------------------------------------------
+ # perl(...) configuration
+ %{load:%{_usrlibrpm}/macros.d/perl}
+
diff --git a/rpm-5.4.7-no-seqid_init-on-rdonly-database.patch b/rpm-5.4.7-no-seqid_init-on-rdonly-database.patch
new file mode 100644
index 0000000..85d52e0
--- /dev/null
+++ b/rpm-5.4.7-no-seqid_init-on-rdonly-database.patch
@@ -0,0 +1,11 @@
+--- rpm-5.4.7/rpmdb/db3.c.db_rdonly~ 2012-03-24 04:16:30.305949579 +0100
++++ rpm-5.4.7/rpmdb/db3.c 2012-03-24 04:16:39.649962411 +0100
+@@ -2700,7 +2700,7 @@ assert(Pdbi != NULL);
+ if (oflags & (DB_CREATE|DB_TRUNCATE)) _flags |= DB_CREATE;
+ xx = db3associate(Pdbi, dbi, _callback, _flags);
+ }
+- if (dbi->dbi_seq_id) {
++ if (dbi->dbi_seq_id && !(oflags & DB_RDONLY)) {
+ char * end = NULL;
+ uint32_t u = (uint32_t) strtoll(dbi->dbi_seq_id, &end, 0);
+
diff --git a/rpm-5.4.7-rpmfc-fix-invalid-free-if-not-_defaultdocdir-set.patch b/rpm-5.4.7-rpmfc-fix-invalid-free-if-not-_defaultdocdir-set.patch
new file mode 100644
index 0000000..9e77639
--- /dev/null
+++ b/rpm-5.4.7-rpmfc-fix-invalid-free-if-not-_defaultdocdir-set.patch
@@ -0,0 +1,11 @@
+--- rpm-5.4.7/lib/rpmfc.c.free~ 2012-03-10 19:45:12.592164430 +0100
++++ rpm-5.4.7/lib/rpmfc.c 2012-03-10 19:45:15.353166385 +0100
+@@ -901,7 +901,7 @@ static int rpmfcSCRIPT(rpmfc fc)
+ if (fc->fcolor->vals[fc->ix] & RPMFC_PERL) {
+ defaultdocdir = rpmExpand("%{?_defaultdocdir}", NULL);
+ if (defaultdocdir == NULL || *defaultdocdir == '\0')
+- defaultdocdir = "/usr/share/doc";
++ defaultdocdir = strdup("/usr/share/doc");
+
+ if (strncmp(fn, defaultdocdir, strlen(defaultdocdir))) {
+ if (fc->fcolor->vals[fc->ix] & RPMFC_MODULE)
diff --git a/rpm-5.4.8-dont-show-suggests-with-requires.patch b/rpm-5.4.8-dont-show-suggests-with-requires.patch
new file mode 100644
index 0000000..19cf1e0
--- /dev/null
+++ b/rpm-5.4.8-dont-show-suggests-with-requires.patch
@@ -0,0 +1,62 @@
+--- rpm-5.4.8/rpmdb/hdrfmt.c.suggests~ 2012-04-25 17:58:22.721144146 +0200
++++ rpm-5.4.8/rpmdb/hdrfmt.c 2012-04-25 18:33:32.293704707 +0200
+@@ -1607,6 +1607,38 @@ static const char * bfstring(unsigned in
+ #endif
+
+ /**
++ * Format dependency flags for display.
++ * @param he tag container
++ * @param av parameter list (or NULL)
++ * @return formatted string
++ */
++static /*@only@*/
++char * hintFormat(HE_t he, /*@unused@*/ /*@null@*/ const char ** av)
++ /*@*/
++{
++ int ix = (he->ix > 0 ? he->ix : 0);
++ char * val;
++
++assert(ix == 0);
++ if (he->t != RPM_UINT64_TYPE) {
++ val = xstrdup(_("(invalid type)"));
++ } else {
++ rpmuint64_t anint = he->p.ui64p[ix];
++ char *t, *buf;
++
++ t = buf = alloca(32);
++ *t = '\0';
++
++ if (anint & RPMSENSE_MISSINGOK)
++ t = stpcpy(t, "(hint)");
++ *t = '\0';
++
++ val = xstrdup(buf);
++ }
++
++ return val;
++}
++/**
+ * Retrieve install prefixes.
+ * @param h header
+ * @retval *he tag container
+@@ -5201,6 +5233,8 @@ static struct headerSprintfExtension_s _
+ { .fmtFunction = digestFormat } },
+ { HEADER_EXT_FORMAT, "fflags",
+ { .fmtFunction = fflagsFormat } },
++ { HEADER_EXT_FORMAT, "hint",
++ { .fmtFunction = hintFormat } },
+ { HEADER_EXT_FORMAT, "iconv",
+ { .fmtFunction = iconvFormat } },
+ { HEADER_EXT_FORMAT, "json",
+--- rpm-5.4.8/rpmpopt.in.suggests~ 2012-04-25 17:58:22.439141788 +0200
++++ rpm-5.4.8/rpmpopt.in 2012-04-25 18:33:32.295704719 +0200
+@@ -98,7 +98,8 @@ rpm alias --provides --qf \
+ --POPTdesc=$"list capabilities that this package provides"
+
+ rpm alias --requires --qf \
+- "[%{REQUIRENAME}%{REQUIREFLAGS:depflags}%{REQUIREVERSION}\n]" \
++ "[%{REQUIRENAME}%{REQUIREFLAGS:hint:depflags}%{REQUIREVERSION}\n]" \
++ --pipe "grep -v \(hint\)" \
+ --POPTdesc=$"list capabilities required by package(s)"
+ rpm alias -R --requires
+
diff --git a/rpm-5.4.9-avoid-dependencies-on-self.patch b/rpm-5.4.9-avoid-dependencies-on-self.patch
new file mode 100644
index 0000000..8a3ea13
--- /dev/null
+++ b/rpm-5.4.9-avoid-dependencies-on-self.patch
@@ -0,0 +1,85 @@
+--- rpm-5.4.9/lib/rpmfc.c.drop_deps~ 2012-05-07 22:41:45.000000000 +0200
++++ rpm-5.4.9/lib/rpmfc.c 2012-05-15 01:58:00.071056896 +0200
+@@ -1696,6 +1696,65 @@ static int rpmfcGenerateScriptletDeps(co
+ return rc;
+ }
+
++static void removeSillyDeps(Header h) {
++ HE_t he = memset(alloca(sizeof(*he)), 0, sizeof(*he));
++ int xx, i, rnum, removed = 0;
++ const char **deps = NULL;
++ const char **versions = NULL;
++ evrFlags *flags = NULL;
++
++ he->tag = RPMTAG_REQUIRENAME;
++ xx = headerGet(h, he, 0);
++ deps = he->p.argv;
++ rnum = he->c;
++
++ he->tag = RPMTAG_REQUIREVERSION;
++ xx = headerGet(h, he, 0);
++ versions = he->p.argv;
++
++ he->tag = RPMTAG_REQUIREFLAGS;
++ xx = headerGet(h, he, 0);
++ flags = (evrFlags*)he->p.ui32p;
++
++ for (i = 0; i < rnum-removed; i++) {
++ if (removed) {
++ deps[i] = deps[i+removed];
++ versions[i] = versions[i+removed];
++ flags[i] = flags[i+removed];
++ }
++ rpmds req = rpmdsSingle(RPMTAG_REQUIRENAME, deps[i], versions[i], flags[i]);
++ rpmds prov = rpmdsNew(h, (*deps[i] == '/' && !*versions[i]) ? RPMTAG_BASENAMES : RPMTAG_PROVIDENAME, 0);
++ if (rpmdsMatch(req, prov)) {
++ if (flags[i] & RPMSENSE_SCRIPT_PRE)
++ rpmlog(RPMLOG_ERR, "Requires(pre): on dependency provided by self: %s\n", rpmdsDNEVR(req));
++ else {
++ rpmlog(RPMLOG_NOTICE, "Removing dependency on self: %s\n", rpmdsDNEVR(req));
++ removed++;
++ i--;
++ }
++ }
++ req = rpmdsFree(req);
++ prov = rpmdsFree(prov);
++ }
++ if (removed) {
++ he->tag = RPMTAG_REQUIRENAME;
++ he->t = RPM_STRING_ARRAY_TYPE;
++ he->p.argv = deps;
++ he->c -= removed;
++ headerMod(h, he, 0);
++
++ he->tag = RPMTAG_REQUIREVERSION;
++ he->p.argv = versions;
++ headerMod(h, he, 0);
++
++ he->tag = RPMTAG_REQUIREFLAGS;
++ he->t = RPM_UINT32_TYPE;
++ he->p.ui32p = (uint32_t*)flags;
++ headerMod(h, he, 0);
++ }
++
++}
++
+ rpmRC rpmfcGenerateDepends(void * _spec, void * _pkg)
+ {
+ HE_t he = (HE_t) memset(alloca(sizeof(*he)), 0, sizeof(*he));
+@@ -1729,6 +1788,7 @@ rpmRC rpmfcGenerateDepends(void * _spec,
+ if (internaldeps == 0) {
+ /* ... then generate dependencies using %{__find_requires} et al. */
+ rc = rpmfcGenerateDependsHelper(spec, pkg, fi);
++ removeSillyDeps(pkg->header);
+ printDeps(pkg->header);
+ return rc;
+ }
+@@ -1946,6 +2006,8 @@ assert(ac == (int)he->c);
+ xx = headerPut(pkg->header, he, 0);
+ }
+
++ removeSillyDeps(pkg->header);
++
+ printDeps(pkg->header);
+
+ if (fc != NULL && _rpmfc_debug) {
diff --git a/rpm-5.4.9-avoid-double-slash-in-path-for-dirname-filetrigger-matching.patch b/rpm-5.4.9-avoid-double-slash-in-path-for-dirname-filetrigger-matching.patch
new file mode 100644
index 0000000..7535c34
--- /dev/null
+++ b/rpm-5.4.9-avoid-double-slash-in-path-for-dirname-filetrigger-matching.patch
@@ -0,0 +1,23 @@
+--- rpm-5.4.9/lib/psm.c.slash~ 2012-05-15 03:47:32.000000000 +0200
++++ rpm-5.4.9/lib/psm.c 2012-05-15 03:49:04.075347677 +0200
+@@ -1463,11 +1463,15 @@ static rpmRC runTriggersLoop(rpmpsm psm,
+ ARGint_t vals;
+
+ depName = _free(depName);
+- depName = (char *) xmalloc(nName + 1 + 1);
+- (void) stpcpy(depName, Name);
+- /* XXX re-add the pesky trailing '/' to dirnames. */
+- depName[nName] = (tagno == RPMTAG_DIRNAMES ? '/' : '\0');
+- depName[nName+1] = '\0';
++ if (!strcmp(Name, "/"))
++ depName = xstrdup(Name);
++ else {
++ depName = xmalloc(nName + 1 + 1);
++ (void) stpcpy(depName, Name);
++ /* XXX re-add the pesky trailing '/' to dirnames. */
++ depName[nName] = (tagno == RPMTAG_DIRNAMES ? '/' : '\0');
++ depName[nName+1] = '\0';
++ }
+
+ if (depName[0] == '/' && psm->Tmires != NULL) {
+ miRE mire;
diff --git a/rpm-5.4.9-fix-typo-in-rpmtag-header.patch b/rpm-5.4.9-fix-typo-in-rpmtag-header.patch
new file mode 100644
index 0000000..ef1685b
--- /dev/null
+++ b/rpm-5.4.9-fix-typo-in-rpmtag-header.patch
@@ -0,0 +1,11 @@
+--- rpm-5.4.9/rpmdb/rpmtag.h.typo~ 2012-05-03 20:39:52.000000000 +0200
++++ rpm-5.4.9/rpmdb/rpmtag.h 2012-05-18 05:30:09.780867642 +0200
+@@ -948,7 +948,7 @@ Header headerCopyLoad(const void * uh)
+ int headerIsEntry(/*@null@*/ Header h, rpmTag tag)
+ /*@*/;
+
+-#if defined(SUPPORT_I18BSTRING_TYPE)
++#if defined(SUPPORT_I18NSTRING_TYPE)
+ /** \ingroup header
+ * Add locale specific tag to header.
+ * A NULL lang is interpreted as the C locale. Here are the rules:
diff --git a/rpm-5.4.9-fix-verify-segfault.patch b/rpm-5.4.9-fix-verify-segfault.patch
new file mode 100644
index 0000000..e457b5e
--- /dev/null
+++ b/rpm-5.4.9-fix-verify-segfault.patch
@@ -0,0 +1,26 @@
+--- rpm-5.4.9/rpmio/rpmhkp.c.fix_verify~ 2012-04-16 22:53:33.000000000 +0200
++++ rpm-5.4.9/rpmio/rpmhkp.c 2012-05-15 03:51:08.805023846 +0200
+@@ -901,6 +901,14 @@ char * t, * te;
+ te = t = tbuf;
+ *te = '\0';
+
++ /*Reset all the temporary variables*/
++ hkp->pubx = -1;
++ hkp->uidx = -1;
++ hkp->subx = -1;
++ hkp->sigx = -1;
++ hkp->tvalid = 0;
++ hkp->uvalidx = -1;
++
+ HKPDEBUG((stderr, "--> %s(%p,%s)\n", __FUNCTION__, hkp, keyname));
+
+ /* Do a lazy lookup before validating. */
+@@ -1065,7 +1073,7 @@ SPEW((stderr, "\t%s\n", pgpHexStr(hkp->p
+ }
+
+ exit:
+- if ((hkp->uidx >= 0 && hkp->uidx < hkp->npkts) && hkp->tvalid > 0) {
++ if ((hkp->uvalidx >= 0 && hkp->uvalidx < hkp->npkts) && hkp->tvalid > 0) {
+ char user[256+1];
+ size_t nuser;
+ pgpPktUid * u;
diff --git a/rpm-5.4.9-font-provides.patch b/rpm-5.4.9-font-provides.patch
new file mode 100644
index 0000000..d0b894a
--- /dev/null
+++ b/rpm-5.4.9-font-provides.patch
@@ -0,0 +1,60 @@
+--- rpm-5.4.9/macros/macros.rpmbuild.in.font~ 2012-05-15 02:55:46.222011889 +0200
++++ rpm-5.4.9/macros/macros.rpmbuild.in 2012-05-15 02:55:46.347012566 +0200
+@@ -682,5 +682,8 @@ done \
+
+ %requires_eq() %(echo '%*' | LC_ALL="C" xargs -r rpm -q --qf 'Requires: %%{name} = %%{epoch}:%%{version}\\n' | sed -e 's/ (none):/ /' -e 's/ 0:/ /' | grep -v "is not")
+
++%__font_provides %{_rpmhome}/fontconfig.prov
++#%__font_requires %{_rpmhome}/fontconfig.req
++
+ # \endverbatim
+ #*/
+--- rpm-5.4.9/scripts/fontconfig.prov.font~ 2012-05-15 02:55:46.347012566 +0200
++++ rpm-5.4.9/scripts/fontconfig.prov 2012-05-15 02:55:46.347012566 +0200
+@@ -0,0 +1,24 @@
++#!/bin/bash
++#
++# Script to install in:
++# /usr/lib/rpm/redhat/find-provides.d
++#
++# Transform font files into RPM provides
++# Requires fontconfig >= 2.6.90
++#
++# Author: Behdad Esfahbod <behdad at redhat.com>
++# Based on other provides scripts from RPM
++#
++
++fcquery=/usr/bin/fc-query
++
++if [ ! -x $fcquery ]; then
++ cat > /dev/null
++ exit 0
++fi
++
++# filter out anything outside main fontconfig path
++grep /usr/share/fonts/ |
++while read fn; do
++ $fcquery --format '%{=pkgkit}' "${fn}" 2> /dev/null
++done
+--- rpm-5.4.9/scripts/Makefile.am.font~ 2012-05-15 02:55:46.304012334 +0200
++++ rpm-5.4.9/scripts/Makefile.am 2012-05-15 02:55:46.347012566 +0200
+@@ -19,7 +19,7 @@ EXTRA_DIST = api-sanity-autotest.pl api-
+ cpanflute cpanflute2 Specfile.pm \
+ find-provides.perl find-requires.perl \
+ find-provides.php find-requires.php \
+- freshen.sh gendiff getpo.sh http.req \
++ freshen.sh fontconfig.prov gendiff getpo.sh http.req \
+ check-java-closure.sh java.prov.sh java.req.sh \
+ gstreamer.sh javadeps.sh libtooldeps.sh mgo \
+ mono-find-provides mono-find-requires \
+@@ -55,8 +55,8 @@ pkgdata_SCRIPTS = \
+ brp-strip-shared brp-strip-static-archive brp-sparc64-linux \
+ check-files cross-build dbconvert.sh executabledeps.sh \
+ find-debuginfo.sh find-lang.sh find-prov.pl find-req.pl \
+- find-provides.perl \
+- find-requires.perl gem_helper.rb getpo.sh http.req \
++ find-provides.perl find-requires.perl \
++ fontconfig.prov gem_helper.rb getpo.sh http.req \
+ kmod-deps.sh gstreamer.sh javadeps.sh libtooldeps.sh \
+ mono-find-provides mono-find-requires \
+ check-multiarch-files mkmultiarch \
diff --git a/rpm-5.4.9-keep-loading-script-macros.patch b/rpm-5.4.9-keep-loading-script-macros.patch
new file mode 100644
index 0000000..8bd04bf
--- /dev/null
+++ b/rpm-5.4.9-keep-loading-script-macros.patch
@@ -0,0 +1,80 @@
+--- rpm-5.4.9/macros/macros.in.script_macros~ 2012-05-07 00:36:51.000000000 +0200
++++ rpm-5.4.9/macros/macros.in 2012-05-15 01:39:37.382649841 +0200
+@@ -993,63 +993,63 @@ $_arbitrary_tags_tests Foo:Bar
+ # XXX %{load:...}, then loading will CEASE at that point in the file.
+ #==============================================================================
+ # ---- SELinux configuration macros.
+-#%%{load:%{_usrlibrpm}/macros.d/selinux}
++%{load:%{_usrlibrpm}/macros.d/selinux}
+
+ #==============================================================================
+ # ---- rpmbuild macros.
+-#%%{load:%{_usrlibrpm}/macros.rpmbuild}
++%{load:%{_usrlibrpm}/macros.rpmbuild}
+
+ #------------------------------------------------------------------------
+ # cmake(...) configuration
+-#%%{load:%{_usrlibrpm}/macros.d/cmake}
++%{load:%{_usrlibrpm}/macros.d/cmake}
+
+ #------------------------------------------------------------------------
+ # gstreamer(...) configuration.
+-#%%{load:%{_usrlibrpm}/macros.d/gstreamer}
++%{load:%{_usrlibrpm}/macros.d/gstreamer}
+
+ #------------------------------------------------------------------------
+ # haskell(...) configuration.
+ #%%{load:%{_usrlibrpm}/macros.d/haskell}
+
+ #------------------------------------------------------------------------
+ # perl(...) configuration
+-#%%{load:%{_usrlibrpm}/macros.d/perl}
++%{load:%{_usrlibrpm}/macros.d/perl}
+
+ #------------------------------------------------------------------------
+ # python(...) configuration.
+-#%%{load:%{_usrlibrpm}/macros.d/python}
++%{load:%{_usrlibrpm}/macros.d/python}
+
+ #------------------------------------------------------------------------
+ # php(...) configuration.
+-#%%{load:%{_usrlibrpm}/macros.d/php}
++%{load:%{_usrlibrpm}/macros.d/php}
+
+ #------------------------------------------------------------------------
+ # java(...) configuration.
+-#%%{load:%{_usrlibrpm}/macros.d/java}
++%{load:%{_usrlibrpm}/macros.d/java}
+
+ #------------------------------------------------------------------------
+ # libtool(...) configuration.
+-#%%{load:%{_usrlibrpm}/macros.d/libtool}
++%{load:%{_usrlibrpm}/macros.d/libtool}
+
+ #------------------------------------------------------------------------
+ # pkgconfig(...) configuration.
+-#%%{load:%{_usrlibrpm}/macros.d/pkgconfig}
++%{load:%{_usrlibrpm}/macros.d/pkgconfig}
+
+ #------------------------------------------------------------------------
+ # mono(...) configuration.
+-#%%{load:%{_usrlibrpm}/macros.d/mono}
++%{load:%{_usrlibrpm}/macros.d/mono}
+
+ #------------------------------------------------------------------------
+ # ruby(...) configuration.
+-#%%{load:%{_usrlibrpm}/macros.d/ruby}
++%{load:%{_usrlibrpm}/macros.d/ruby}
+
+ #------------------------------------------------------------------------
+ # tcl(...) configuration.
+-#%%{load:%{_usrlibrpm}/macros.d/tcl}
++%{load:%{_usrlibrpm}/macros.d/tcl}
+
+ #------------------------------------------------------------------------
+ # typelib(...) configuration.
+-#%%{load:%{_usrlibrpm}/macros.d/typelib}
++%{load:%{_usrlibrpm}/macros.d/typelib}
+
+ # \endverbatim
+ #*/
diff --git a/rpm-5.4.9-mire-fix-strings-lacking-null-terminator.patch b/rpm-5.4.9-mire-fix-strings-lacking-null-terminator.patch
new file mode 100644
index 0000000..b2d3f32
--- /dev/null
+++ b/rpm-5.4.9-mire-fix-strings-lacking-null-terminator.patch
@@ -0,0 +1,32 @@
+--- rpm-5.4.9/rpmio/mire.c.str_nul~ 2012-04-16 05:21:22.000000000 +0200
++++ rpm-5.4.9/rpmio/mire.c 2012-05-15 03:20:14.361970779 +0200
+@@ -415,11 +415,10 @@ int mireRegexec(miRE mire, const char *
+ break;
+ /* XXX rpmgrep: ensure that the string is NUL terminated. */
+ if (vallen > 0) {
+- if (val[vallen] != '\0') {
+- char * t = strncpy((char *)alloca(vallen+1), val, vallen);
+- t[vallen] = '\0';
+- val = t;
+- }
++ /* if (val[vallen] != '\0') might go outside of allocated memory */
++ char * t = strncpy(alloca(vallen+1), val, vallen);
++ t[vallen] = '\0';
++ val = t;
+ } else
+ if (vallen == 0)
+ vallen = strlen(val);
+@@ -466,6 +465,13 @@ int mireRegexec(miRE mire, const char *
+ case RPMMIRE_GLOB:
+ if (mire->pattern == NULL)
+ break;
++ /* XXX rpmgrep: ensure that the string is NUL terminated. */
++ if (vallen > 0) {
++ /* if (val[vallen] != '\0') might go outside of allocated memory */
++ char * t = strncpy(alloca(vallen+1), val, vallen);
++ t[vallen] = '\0';
++ val = t;
++ }
+ rc = fnmatch(mire->pattern, val, mire->fnflags);
+ switch (rc) {
+ case 0: rc = 0; /*@innerbreak@*/ break;
diff --git a/rpm-5.4.9-rpmfc-extract-dependencies-for-all-files.patch b/rpm-5.4.9-rpmfc-extract-dependencies-for-all-files.patch
new file mode 100644
index 0000000..2a72e5a
--- /dev/null
+++ b/rpm-5.4.9-rpmfc-extract-dependencies-for-all-files.patch
@@ -0,0 +1,11 @@
+--- rpm-5.4.9/lib/rpmfc.c.rpmfc_ruby~ 2012-05-15 02:27:26.000000000 +0200
++++ rpm-5.4.9/lib/rpmfc.c 2012-05-15 02:27:34.978029207 +0200
+@@ -1090,7 +1090,7 @@ typedef struct rpmfcApplyTbl_s {
+ /*@unchecked@*/
+ static struct rpmfcApplyTbl_s rpmfcApplyTable[] = {
+ { rpmfcELF, RPMFC_ELF },
+- { rpmfcSCRIPT, (RPMFC_SCRIPT|RPMFC_FONT|RPMFC_HASKELL|RPMFC_PERL|RPMFC_PYTHON|RPMFC_LIBTOOL|RPMFC_PKGCONFIG|RPMFC_BOURNE|RPMFC_JAVA|RPMFC_PHP|RPMFC_MONO|RPMFC_TYPELIB|RPMFC_DESKTOP_FILE) },
++ { rpmfcSCRIPT, (RPMFC_SCRIPT|RPMFC_FONT|RPMFC_HASKELL|RPMFC_RUBY|RPMFC_PERL|RPMFC_PYTHON|RPMFC_LIBTOOL|RPMFC_PKGCONFIG|RPMFC_BOURNE|RPMFC_JAVA|RPMFC_PHP|RPMFC_MONO|RPMFC_TYPELIB|RPMFC_DESKTOP_FILE) },
+ #if defined(RPM_VENDOR_MANDRIVA)
+ { rpmfcSYMLINK, RPMFC_SYMLINK },
+ #endif
diff --git a/rpm-5.4.9-rpmpython-fix-input.patch b/rpm-5.4.9-rpmpython-fix-input.patch
new file mode 100644
index 0000000..0589a54
--- /dev/null
+++ b/rpm-5.4.9-rpmpython-fix-input.patch
@@ -0,0 +1,11 @@
+--- rpm-5.4.9/rpmio/rpmpython.c.py_input~ 2012-05-15 03:40:55.316698083 +0200
++++ rpm-5.4.9/rpmio/rpmpython.c 2012-05-15 03:40:59.799722384 +0200
+@@ -215,7 +215,7 @@ fprintf(stderr, "==> %s(%p,%s,%p)\n", __
+ PyCompilerFlags cf = { 0 };
+ PyObject * m = PyImport_AddModule("__main__");
+ PyObject * d = (m ? PyModule_GetDict(m) : NULL);
+- PyObject * v = (m ? PyRun_StringFlags(val, Py_file_input, d, d, &cf) : NULL);
++ PyObject * v = (m ? PyRun_StringFlags(val, Py_single_input, d, d, &cf) : NULL);
+
+ if (v == NULL) {
+ PyErr_Print();
diff --git a/rpm-5.4.9-ruby1.9-fixes.patch b/rpm-5.4.9-ruby1.9-fixes.patch
new file mode 100644
index 0000000..2c0ae90
--- /dev/null
+++ b/rpm-5.4.9-ruby1.9-fixes.patch
@@ -0,0 +1,114 @@
+diff -urN rpm-5.4.9/macros/ruby.in rpm-5.4.9-patched/macros/ruby.in
+--- rpm-5.4.9/macros/ruby.in 2011-10-15 23:56:57.000000000 +1100
++++ rpm-5.4.9-patched/macros/ruby.in 2012-08-30 18:09:09.732009037 +1100
+@@ -2,7 +2,7 @@
+ # To make use of these macros insert the following line into your spec file:
+ # %{load:%{_usrlibrpm}/macros.d/ruby}
+
+-%__ruby @__RUBY@
++%__ruby /usr/bin/ruby
+
+ # Path to scripts to autogenerate php package dependencies,
+ #
+@@ -11,18 +11,18 @@
+ %__ruby_provides %{_rpmhome}/rubygems.rb --provides
+ %__ruby_requires %{_rpmhome}/rubygems.rb --requires
+
+-%ruby_version %(%{__ruby} -rrbconfig -e 'print Config::CONFIG["ruby_version"]')
++%ruby_version %(%{__ruby} -rrbconfig -e 'print RbConfig::CONFIG["ruby_version"]')
+
+-%ruby_archdir %(%{__ruby} -rrbconfig -e 'print Config::CONFIG["archdir"]')
+-%ruby_libdir %(%{__ruby} -rrbconfig -e 'print Config::CONFIG["rubylibdir"]')
+-%ruby_sitedir %(%{__ruby} -rrbconfig -e 'print Config::CONFIG["sitedir"]')
+-%ruby_sitearchdir %(%{__ruby} -rrbconfig -e 'print Config::CONFIG["sitearchdir"]')
+-%ruby_sitelibdir %(%{__ruby} -rrbconfig -e 'print Config::CONFIG["sitelibdir"]')
+-%ruby_vendordir %(%{__ruby} -rrbconfig -e 'print Config::CONFIG["vendordir"]')
+-%ruby_vendorarchdir %(%{__ruby} -rrbconfig -e 'print Config::CONFIG["vendorarchdir"]')
+-%ruby_vendorlibdir %(%{__ruby} -rrbconfig -e 'print Config::CONFIG["vendorlibdir"]')
+-%ruby_gemdir %(%{__ruby} -rrbconfig -e 'include Config; print CONFIG["rubylibdir"].sub(CONFIG["ruby_version"], "gems/#{CONFIG["ruby_version"]}")')
+-%ruby_ridir %(%{__ruby} -rrbconfig -e 'include Config; print File.join(CONFIG["datadir"], "ri", CONFIG["ruby_version"])')
++%ruby_archdir %(%{__ruby} -rrbconfig -e 'print RbConfig::CONFIG["archdir"]')
++%ruby_libdir %(%{__ruby} -rrbconfig -e 'print RbConfig::CONFIG["rubylibdir"]')
++%ruby_sitedir %(%{__ruby} -rrbconfig -e 'print RbConfig::CONFIG["sitedir"]')
++%ruby_sitearchdir %(%{__ruby} -rrbconfig -e 'print RbConfig::CONFIG["sitearchdir"]')
++%ruby_sitelibdir %(%{__ruby} -rrbconfig -e 'print RbConfig::CONFIG["sitelibdir"]')
++%ruby_vendordir %(%{__ruby} -rrbconfig -e 'print RbConfig::CONFIG["vendordir"]')
++%ruby_vendorarchdir %(%{__ruby} -rrbconfig -e 'print RbConfig::CONFIG["vendorarchdir"]')
++%ruby_vendorlibdir %(%{__ruby} -rrbconfig -e 'print RbConfig::CONFIG["vendorlibdir"]')
++%ruby_gemdir %(%{__ruby} -rrbconfig -e 'print RbConfig::CONFIG["rubylibdir"].sub(RbConfig::CONFIG["ruby_version"], "gems/#{RbConfig::CONFIG["ruby_version"]}")')
++%ruby_ridir %(%{__ruby} -rrbconfig -e 'print File.join(RbConfig::CONFIG["datadir"], "ri", RbConfig::CONFIG["ruby_version"])')
+
+ %__gem_helper %{_usrlibrpm}/gem_helper.rb
+
+diff -urN rpm-5.4.9/scripts/gem_helper.rb rpm-5.4.9-patched/scripts/gem_helper.rb
+--- rpm-5.4.9/scripts/gem_helper.rb 2010-10-16 20:58:48.000000000 +1100
++++ rpm-5.4.9-patched/scripts/gem_helper.rb 2012-08-30 18:12:11.233007114 +1100
+@@ -57,10 +57,13 @@
+ argv.delete_at(0)
+ end
+
+- file_data = Zlib::GzipReader.open("metadata.gz")
++ file_data = Zlib::GzipReader.open("metadata.gz") {|io| io.read}
+ header = YAML::load(file_data)
+- file_data.close()
+- body = header.instance_variable_get :@ivars
++ body = {}
++ # I don't know any better.. :/
++ header.instance_variables.each do |iv|
++ body[iv.to_s.gsub(/^@/,'')] = header.instance_variable_get(iv)
++ end
+
+ require 'rubygems'
+ spec = Gem::Specification.from_yaml(YAML.dump(header))
+diff -urN rpm-5.4.9/scripts/rubygems.rb rpm-5.4.9-patched/scripts/rubygems.rb
+--- rpm-5.4.9/scripts/rubygems.rb 2011-04-01 18:30:28.000000000 +1100
++++ rpm-5.4.9-patched/scripts/rubygems.rb 2012-08-30 18:09:09.771009037 +1100
+@@ -30,7 +30,7 @@
+ exit(1)
+ end
+
+-specpatt = Config::CONFIG["rubylibdir"].sub(Config::CONFIG["ruby_version"], ".*/specifications/.*\.gemspec$")
++specpatt = RbConfig::CONFIG["rubylibdir"].sub(RbConfig::CONFIG["ruby_version"], ".*/specifications/.*\.gemspec$")
+ gems = []
+ ruby_versioned = false
+ abi_provide = false
+@@ -44,17 +44,17 @@
+ # package is dependent on this specific version.
+ # FIXME: only supports current ruby version
+ elsif not ruby_versioned
+- if path.match(Config::CONFIG["rubylibdir"])
++ if path.match(RbConfig::CONFIG["rubylibdir"])
+ ruby_versioned = true
+ # even more fugly, but we make the assumption that if the package has
+ # this file, the package is the current ruby version, and should
+ # therefore provide ruby(abi) = version
+- if provides and path.match(Config::CONFIG["rubylibdir"] + "/Env.rb")
++ if provides and path.match(RbConfig::CONFIG["rubylibdir"] + "/Env.rb")
+ abi_provide = true
+ end
+- elsif path.match(Config::CONFIG["sitelibdir"])
++ elsif path.match(RbConfig::CONFIG["sitelibdir"])
+ ruby_versioned = true
+- elsif path.match(Config::CONFIG["vendorlibdir"])
++ elsif path.match(RbConfig::CONFIG["vendorlibdir"])
+ ruby_versioned = true
+ end
+ end
+@@ -63,7 +63,7 @@
+ if requires or abi_provide
+ print "ruby(abi)"
+ if ruby_versioned
+- print " = %s\n" % Config::CONFIG["ruby_version"]
++ print " = %s\n" % RbConfig::CONFIG["ruby_version"]
+ end
+ end
+
+@@ -105,7 +105,7 @@
+ end
+ if requires
+ for d in spec.dependencies
+- print d.requirement.to_rpm(d.name) unless d.type != :runtime
++ print d.requirement.to_rpm(d.name)[0] unless d.type != :runtime
+ end
+ for d in spec.required_rubygems_version.to_rpm("rubygems")
+ print d.gsub(/(rubygem\()|(\))/, "")
diff --git a/rpm-5.4.9-strip-buildroot-away-from-duplicate-files-list.patch b/rpm-5.4.9-strip-buildroot-away-from-duplicate-files-list.patch
new file mode 100644
index 0000000..8e48830
--- /dev/null
+++ b/rpm-5.4.9-strip-buildroot-away-from-duplicate-files-list.patch
@@ -0,0 +1,97 @@
+--- rpm-5.4.9/build/files.c.buildroot_dups~ 2012-04-15 17:04:14.000000000 +0200
++++ rpm-5.4.9/build/files.c 2012-05-15 02:11:03.734983519 +0200
+@@ -2917,7 +2917,7 @@ exit:
+
+ /* auxiliary function for checkDuplicateFiles() */
+ /* XXX need to pass Header because fi->h is NULL */
+-static int fiIntersect(/*@null@*/ rpmfi fi1, /*@null@*/ rpmfi fi2)
++static int fiIntersect(/*@null@*/ rpmfi fi1, /*@null@*/ rpmfi fi2, size_t buildrootL)
+ /*@globals internalState @*/
+ /*@modifies fi1, fi2, internalState @*/
+ {
+@@ -2941,7 +2941,7 @@ static int fiIntersect(/*@null@*/ rpmfi
+ if (!dups)
+ dups = rpmiobNew(0);
+ dups = rpmiobAppend(dups, "\t", 0);
+- dups = rpmiobAppend(dups, fn1, 1);
++ dups = rpmiobAppend(dups, fn1+buildrootL, 1);
+ n++;
+ }
+ }
+@@ -2972,7 +2972,7 @@ static int fiIntersect(/*@null@*/ rpmfi
+ * @param spec spec file control structure
+ * @return number of duplicate files
+ */
+-static int checkDuplicateFiles(Spec spec)
++static int checkDuplicateFiles(Spec spec, size_t buildrootL)
+ /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
+ /*@modifies *spec->packages,
+ rpmGlobalMacroContext, fileSystem, internalState @*/
+@@ -2997,7 +2997,7 @@ static int checkDuplicateFiles(Spec spec
+ #endif
+ if (fi2 == NULL) continue;
+ (void) rpmfiSetHeader(fi2, pkg2->header);
+- n += fiIntersect(fi1, fi2);
++ n += fiIntersect(fi1, fi2, buildrootL);
+ (void) rpmfiSetHeader(fi2, NULL);
+ fi2 = rpmfiFree(fi2);
+ }
+@@ -3023,7 +3023,7 @@ static inline int packagedDir(Package pk
+ * /A/B/C/D
+ * Now directories "/A/B" and "/A/B/C" should also be packaged.
+ */
+-static int pkgUnpackagedSubdirs(Package pkg)
++static int pkgUnpackagedSubdirs(Package pkg, size_t buildrootL)
+ /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
+ /*@modifies pkg->header,
+ rpmGlobalMacroContext, fileSystem, internalState @*/
+@@ -3096,7 +3096,7 @@ static int pkgUnpackagedSubdirs(Package
+
+ for (i = 0; i < n; i++) {
+ list = rpmiobAppend(list, "\t", 0);
+- list = rpmiobAppend(list, unpackaged[i], 1);
++ list = rpmiobAppend(list, unpackaged[i]+buildrootL, 1);
+ unpackaged[i] = _free(unpackaged[i]);
+ }
+ unpackaged = _free(unpackaged);
+@@ -3117,7 +3117,7 @@ static int pkgUnpackagedSubdirs(Package
+ * @param spec spec file control structure
+ * @return number of unpackaged subdirectories
+ */
+-static int checkUnpackagedSubdirs(Spec spec)
++static int checkUnpackagedSubdirs(Spec spec, size_t buildrootL)
+ /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
+ /*@modifies *spec->packages,
+ rpmGlobalMacroContext, fileSystem, internalState @*/
+@@ -3126,7 +3126,7 @@ static int checkUnpackagedSubdirs(Spec s
+ Package pkg;
+
+ for (pkg = spec->packages; pkg; pkg = pkg->next)
+- n += pkgUnpackagedSubdirs(pkg);
++ n += pkgUnpackagedSubdirs(pkg, buildrootL);
+ return n;
+ }
+
+@@ -3137,6 +3137,11 @@ rpmRC processBinaryFiles(Spec spec, int
+ Package pkg;
+ rpmRC res = RPMRC_OK;
+
++ char *buildroot = rpmExpand("%{?buildroot}", NULL);
++ size_t buildrootL = strlen(buildroot);
++
++ buildroot = _free(buildroot);
++
+ for (pkg = spec->packages; pkg != NULL; pkg = pkg->next) {
+ int rc;
+
+@@ -3178,8 +3183,8 @@ rpmRC processBinaryFiles(Spec spec, int
+ if (res == RPMRC_OK) {
+ if (checkUnpackagedFiles(spec) > 0)
+ res = RPMRC_FAIL;
+- (void) checkDuplicateFiles(spec);
+- (void) checkUnpackagedSubdirs(spec);
++ (void) checkDuplicateFiles(spec, buildrootL);
++ (void) checkUnpackagedSubdirs(spec, buildrootL);
+ }
+
+ return res;
diff --git a/rpm-5.4.9-update-rpmfc-when-removing-dependencies-on-self.patch b/rpm-5.4.9-update-rpmfc-when-removing-dependencies-on-self.patch
new file mode 100644
index 0000000..c3b9e35
--- /dev/null
+++ b/rpm-5.4.9-update-rpmfc-when-removing-dependencies-on-self.patch
@@ -0,0 +1,140 @@
+--- rpm-5.4.9/lib/rpmfc.c.fc_deps~ 2012-05-15 02:23:23.157740011 +0200
++++ rpm-5.4.9/lib/rpmfc.c 2012-05-15 02:24:42.863147557 +0200
+@@ -1763,12 +1763,14 @@ static int rpmfcGenerateScriptletDeps(co
+ return rc;
+ }
+
+-static void removeSillyDeps(Header h) {
++static unsigned removeSillyDeps(Header h, rpmfc fc) {
+ HE_t he = memset(alloca(sizeof(*he)), 0, sizeof(*he));
+- int xx, i, rnum, removed = 0;
++ int xx;
++ unsigned i, rnum, removed = 0;
+ const char **deps = NULL;
+ const char **versions = NULL;
+ evrFlags *flags = NULL;
++ int *newpos = NULL, *ddictxPos = NULL;
+
+ he->tag = RPMTAG_REQUIRENAME;
+ xx = headerGet(h, he, 0);
+@@ -1783,18 +1785,32 @@ static void removeSillyDeps(Header h) {
+ xx = headerGet(h, he, 0);
+ flags = (evrFlags*)he->p.ui32p;
+
++ if (fc && fc->requires != NULL && fc->ddictx != NULL) {
++ newpos = alloca(he->c*sizeof(newpos[0]));
++ if (fc->ddictx)
++ ddictxPos = alloca(fc->ddictx->nvals*sizeof(ddictxPos[0]));
++ }
+ for (i = 0; i < rnum-removed; i++) {
+ if (removed) {
+ deps[i] = deps[i+removed];
+ versions[i] = versions[i+removed];
+ flags[i] = flags[i+removed];
++ if (fc) {
++ fc->requires->N[i] = fc->requires->N[i+removed];
++ fc->requires->EVR[i] = fc->requires->EVR[i+removed];
++ fc->requires->Flags[i] = fc->requires->Flags[i+removed];
++ }
+ }
++ if (fc && fc->requires != NULL && fc->ddictx != NULL)
++ newpos[i+removed] = i;
+ rpmds req = rpmdsSingle(RPMTAG_REQUIRENAME, deps[i], versions[i], flags[i]);
+ rpmds prov = rpmdsNew(h, (*deps[i] == '/' && !*versions[i]) ? RPMTAG_BASENAMES : RPMTAG_PROVIDENAME, 0);
+ if (rpmdsMatch(req, prov)) {
+ if (flags[i] & RPMSENSE_SCRIPT_PRE)
+ rpmlog(RPMLOG_ERR, "Requires(pre): on dependency provided by self: %s\n", rpmdsDNEVR(req));
+ else {
++ if (fc && fc->requires != NULL && fc->ddictx != NULL)
++ newpos[i+removed] = -1;
+ rpmlog(RPMLOG_NOTICE, "Removing dependency on self: %s\n", rpmdsDNEVR(req));
+ removed++;
+ i--;
+@@ -1803,6 +1819,52 @@ static void removeSillyDeps(Header h) {
+ req = rpmdsFree(req);
+ prov = rpmdsFree(prov);
+ }
++ if (fc && fc->requires != NULL && fc->ddictx != NULL && removed) {
++ fc->requires->Count -= removed;
++ unsigned rx = 0;
++ for (i = 0; i < fc->ddictx->nvals-rx; i++) {
++ unsigned ix;
++ unsigned char deptype;
++
++ ix = fc->ddictx->vals[i+rx];
++ deptype = ((ix >> 24) & 0xff);
++ ix &= 0x00ffffff;
++
++ if (deptype == 'P') {
++ ddictxPos[i+rx] = i;
++ fc->ddictx->vals[i] = fc->ddictx->vals[i+rx];
++ continue;
++ }
++ if (newpos[ix] == -1) {
++ ddictxPos[i+rx] = -1;
++ i--, rx++;
++ }
++ else
++ {
++ ddictxPos[i+rx] = i;
++ fc->ddictx->vals[i] = (deptype << 24) | (newpos[ix] & 0x00ffffff);
++ }
++ }
++ fc->ddictx->nvals -= rx;
++
++ for (i = 0; i < fc->fddictn->nvals; i++) {
++ rx = 0;
++ if (fc->fddictn->vals[i]) {
++ unsigned j, ix = fc->fddictx->vals[i];
++ for (j = 0, rx = 0; j < fc->fddictn->vals[i]; j++, ix++) {
++ if (ddictxPos[ix] == -1)
++ rx++;
++ if (j == 0 || fc->fddictx->vals[i] == -1)
++ fc->fddictx->vals[i] = ddictxPos[ix];
++ }
++ }
++ if (rx)
++ fc->fddictn->vals[i] -= rx;
++ if (fc->fddictn->vals[i] == 0)
++ fc->fddictx->vals[i] = 0;
++ }
++ }
++
+ if (removed) {
+ he->tag = RPMTAG_REQUIRENAME;
+ he->t = RPM_STRING_ARRAY_TYPE;
+@@ -1820,6 +1882,7 @@ static void removeSillyDeps(Header h) {
+ headerMod(h, he, 0);
+ }
+
++ return removed;
+ }
+
+ rpmRC rpmfcGenerateDepends(void * _spec, void * _pkg)
+@@ -1855,7 +1918,7 @@ rpmRC rpmfcGenerateDepends(void * _spec,
+ if (internaldeps == 0) {
+ /* ... then generate dependencies using %{__find_requires} et al. */
+ rc = rpmfcGenerateDependsHelper(spec, pkg, fi);
+- removeSillyDeps(pkg->header);
++ removeSillyDeps(pkg->header, NULL);
+ printDeps(pkg->header);
+ return rc;
+ }
+@@ -2045,6 +2108,8 @@ assert(he->p.ptr != NULL);
+ /*@=nullpass@*/
+ }
+
++ removeSillyDeps(pkg->header, fc);
++
+ /* Add dependency dictionary(#dependencies) */
+ he->tag = RPMTAG_DEPENDSDICT;
+ he->t = RPM_UINT32_TYPE;
+@@ -2073,8 +2138,6 @@ assert(ac == (int)he->c);
+ xx = headerPut(pkg->header, he, 0);
+ }
+
+- removeSillyDeps(pkg->header);
+-
+ printDeps(pkg->header);
+
+ if (fc != NULL && _rpmfc_debug) {
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/rpm.git/commitdiff/0a1ccab0f0501b2e304b03cbff81ce8a8f3860bf
More information about the pld-cvs-commit
mailing list