- Fix regression on rpmspec dependency queries

This commit is contained in:
Panu Matilainen 2014-08-18 16:50:06 +03:00
parent a0d39e5bf3
commit 5f498494f8
2 changed files with 52 additions and 1 deletions

View File

@ -0,0 +1,47 @@
commit 0bda2faa4de368a87f85084856a5fed701774acb
Author: Panu Matilainen <pmatilai@redhat.com>
Date: Mon Aug 18 16:31:14 2014 +0300
Populate manual dependencies into spec pkg headers early too
- Similar to commit 1b41c91431d37295701281ff208f99a51f660c89, rpmspec
and other tools expect to find manually specified dependencies
from the headers of a freshly parsed spec. This means we need to
add this cruft two times: once for the manual dependencies and then
scratch all that and redo from start after automatic dependencies
have been discovered at the end of package build.
- Fixes another regression (rpmspec dependency queries went dead)
introduced in commit a357c99c58a5e1367160dfa692f26d14bd3a3df1
diff --git a/build/pack.c b/build/pack.c
index dc24fb5..4abca48 100644
--- a/build/pack.c
+++ b/build/pack.c
@@ -618,6 +618,11 @@ rpmRC packageBinaries(rpmSpec spec, const char *cookie, int cheating)
headerPutUint32(pkg->header, RPMTAG_BUILDTIME, getBuildTime(), 1);
for (int i=0; i<PACKAGE_NUM_DEPS; i++) {
+ /* Nuke any previously added dependencies from the header */
+ headerDel(pkg->header, rpmdsTagN(pkg->dependencies[i]));
+ headerDel(pkg->header, rpmdsTagEVR(pkg->dependencies[i]));
+ headerDel(pkg->header, rpmdsTagF(pkg->dependencies[i]));
+ /* ...and add again, now with automatic dependencies included */
rpmdsPutToHeader(pkg->dependencies[i], pkg->header);
}
diff --git a/build/parseSpec.c b/build/parseSpec.c
index b14c3ee..77cf409 100644
--- a/build/parseSpec.c
+++ b/build/parseSpec.c
@@ -548,6 +548,11 @@ static void addTargets(Package Pkgs)
headerPutString(pkg->header, RPMTAG_PLATFORM, platform);
headerPutString(pkg->header, RPMTAG_OPTFLAGS, optflags);
+ /* Add manual dependencies early for rpmspec etc to look at */
+ for (int i=0; i<PACKAGE_NUM_DEPS; i++) {
+ rpmdsPutToHeader(pkg->dependencies[i], pkg->header);
+ }
+
pkg->ds = rpmdsThis(pkg->header, RPMTAG_REQUIRENAME, RPMSENSE_EQUAL);
addPackageProvides(pkg);
}

View File

@ -27,7 +27,7 @@
Summary: The RPM package management system
Name: rpm
Version: %{rpmver}
Release: %{?snapver:0.%{snapver}.}2%{?dist}
Release: %{?snapver:0.%{snapver}.}3%{?dist}
Group: System Environment/Base
Url: http://www.rpm.org/
Source0: http://rpm.org/releases/testing/%{name}-%{srcver}.tar.bz2
@ -49,6 +49,7 @@ Patch4: rpm-4.8.1-use-gpg2.patch
# Patches already upstream:
Patch100: rpm-4.12-beta1-fix-buildrequires.patch
Patch101: rpm-4.12-beta1-spec-header-deps.patch
# These are not yet upstream
Patch302: rpm-4.7.1-geode-i686.patch
@ -527,6 +528,9 @@ exit 0
%doc doc/librpm/html/*
%changelog
* Mon Aug 18 2014 Panu Matilainen <pmatilai@redhat.com> - 4.12.0-0.beta1.3
- Fix regression on rpmspec dependency queries
* Mon Aug 18 2014 Panu Matilainen <pmatilai@redhat.com> - 4.12.0-0.beta1.2
- Fix regression on BuildRequires checking