- don't mess up problem altNEVR in python ts.check() (#501068)

- fix hardlink size calculation on build (#503020)
This commit is contained in:
Panu Matilainen 2009-06-03 13:38:58 +00:00
parent d9ecaeb35a
commit 61937a9d76
3 changed files with 146 additions and 1 deletions

View File

@ -0,0 +1,98 @@
commit cdfd0934841d4eccc26d7da7c35b23e6e9f76a9c
Author: Panu Matilainen <pmatilai@redhat.com>
Date: Fri May 29 09:02:44 2009 +0300
Fix calculation of hardlinked files (RhBug:503020)
- regression from commit 899dfb58927ec6e91014773430824462f4d0002e,
size of hardlinked file set is the size of one file of the set
- add isHardLink() internal helper to avoid a copy-paste code
diff --git a/build/files.c b/build/files.c
index ef60ae2..98abedd 100644
--- a/build/files.c
+++ b/build/files.c
@@ -981,6 +981,14 @@ static int isDoc(FileList fl, const char * fileName)
return 0;
}
+static int isHardLink(FileListRec flp, FileListRec tlp)
+{
+ return ((S_ISREG(flp->fl_mode) && S_ISREG(tlp->fl_mode)) &&
+ ((flp->fl_nlink > 1) && (flp->fl_nlink == tlp->fl_nlink)) &&
+ (flp->fl_ino == tlp->fl_ino) &&
+ (flp->fl_dev == tlp->fl_dev));
+}
+
/**
* Verify that file attributes scope over hardlinks correctly.
* If partial hardlink sets are possible, then add tracking dependency.
@@ -999,14 +1007,18 @@ static int checkHardLinks(FileList fl)
for (j = i + 1; j < fl->fileListRecsUsed; j++) {
jlp = fl->fileList + j;
- if (!S_ISREG(jlp->fl_mode))
- continue;
- if (ilp->fl_nlink != jlp->fl_nlink)
- continue;
- if (ilp->fl_ino != jlp->fl_ino)
- continue;
- if (ilp->fl_dev != jlp->fl_dev)
- continue;
+ if (isHardLink(ilp, jlp)) {
+ return 1;
+ }
+ }
+ }
+ return 0;
+}
+
+static int seenHardLink(FileList fl, FileListRec flp)
+{
+ for (FileListRec ilp = fl->fileList; ilp < flp; ilp++) {
+ if (isHardLink(flp, ilp)) {
return 1;
}
}
@@ -1147,9 +1159,12 @@ static void genCpioListAndHeader(FileList fl,
rpm_off_t rsize32 = (rpm_off_t)flp->fl_size;
headerPutUint32(h, RPMTAG_FILESIZES, &rsize32, 1);
}
- /* Excludes and dupes have been filtered out by now */
- if (S_ISREG(flp->fl_mode))
- totalFileSize += flp->fl_size;
+ /* Excludes and dupes have been filtered out by now. */
+ if (S_ISREG(flp->fl_mode)) {
+ if (flp->fl_nlink == 1 || !seenHardLink(fl, flp)) {
+ totalFileSize += flp->fl_size;
+ }
+ }
/*
* For items whose size varies between systems, always explicitly
@@ -1492,25 +1507,7 @@ static rpmRC addFile(FileList fl, const char * diskPath,
flp->specdFlags = fl->currentSpecdFlags;
flp->verifyFlags = fl->currentVerifyFlags;
- /* Hard links need be counted only once. */
- if (S_ISREG(flp->fl_mode) && flp->fl_nlink > 1) {
- FileListRec ilp;
- for (i = 0; i < fl->fileListRecsUsed; i++) {
- ilp = fl->fileList + i;
- if (!S_ISREG(ilp->fl_mode))
- continue;
- if (flp->fl_nlink != ilp->fl_nlink)
- continue;
- if (flp->fl_ino != ilp->fl_ino)
- continue;
- if (flp->fl_dev != ilp->fl_dev)
- continue;
- break;
- }
- } else
- i = fl->fileListRecsUsed;
-
- if (!(flp->flags & RPMFILE_EXCLUDE) && S_ISREG(flp->fl_mode) && i >= fl->fileListRecsUsed) {
+ if (!(flp->flags & RPMFILE_EXCLUDE) && S_ISREG(flp->fl_mode)) {
/*
* XXX Simple and stupid check for now, this needs to be per-payload
* format check once we have other payloads than good 'ole cpio.

View File

@ -0,0 +1,39 @@
commit 9322f737819a3d81088699b1d7fa667259245411
Author: Panu Matilainen <pmatilai@redhat.com>
Date: Tue May 19 10:26:50 2009 +0300
Don't mess up problem altNEVR in python ts.check() (rhbz#501068)
- the use of strrchr() silently casts away the const from the problem
set altNEVR string, which we then happily modify..
- similar to commit 62cc76e25cdfad78ac30bb28f626b474efdecddc
diff --git a/python/rpmts-py.c b/python/rpmts-py.c
index e56e001..9877fbc 100644
--- a/python/rpmts-py.c
+++ b/python/rpmts-py.c
@@ -365,7 +365,7 @@ fprintf(stderr, "*** rpmts_Check(%p) ts %p cb %p\n", s, s->ts, cbInfo.cb);
/* XXX TODO: rpmlib >= 4.0.3 can return multiple suggested keys. */
while ((i = rpmpsNextIterator(psi)) >= 0) {
- const char * needsName;
+ char * altNEVR, * needsName;
char * byName, * byVersion, * byRelease, *byArch;
char * needsOP, * needsVersion;
rpmsenseFlags needsFlags, sense;
@@ -383,7 +383,7 @@ fprintf(stderr, "*** rpmts_Check(%p) ts %p cb %p\n", s, s->ts, cbInfo.cb);
key = rpmProblemGetKey(p);
- needsName = rpmProblemGetAltNEVR(p);
+ altNEVR = needsName = xstrdup(rpmProblemGetAltNEVR(p));
if (needsName[1] == ' ') {
sense = (needsName[0] == 'C')
? RPMDEP_SENSE_CONFLICTS : RPMDEP_SENSE_REQUIRES;
@@ -409,6 +409,7 @@ fprintf(stderr, "*** rpmts_Check(%p) ts %p cb %p\n", s, s->ts, cbInfo.cb);
PyList_Append(list, (PyObject *) cf);
Py_DECREF(cf);
free(byName);
+ free(altNEVR);
}
psi = rpmpsFreeIterator(psi);

View File

@ -21,7 +21,7 @@
Summary: The RPM package management system Summary: The RPM package management system
Name: rpm Name: rpm
Version: %{rpmver} Version: %{rpmver}
Release: 4%{?dist} Release: 5%{?dist}
Group: System Environment/Base Group: System Environment/Base
Url: http://www.rpm.org/ Url: http://www.rpm.org/
Source0: http://rpm.org/releases/testing/%{name}-%{srcver}.tar.bz2 Source0: http://rpm.org/releases/testing/%{name}-%{srcver}.tar.bz2
@ -41,6 +41,8 @@ Patch3: rpm-4.6.0-fedora-specspo.patch
# Patches already in upstream # Patches already in upstream
Patch200: rpm-4.7.0-findlang-kde3.patch Patch200: rpm-4.7.0-findlang-kde3.patch
Patch201: rpm-4.7.0-prtsig.patch Patch201: rpm-4.7.0-prtsig.patch
Patch202: rpm-4.7.0-python-altnevr.patch
Patch203: rpm-4.7.0-hardlink-sizes.patch
# These are not yet upstream # These are not yet upstream
Patch300: rpm-4.7.0-extra-provides.patch Patch300: rpm-4.7.0-extra-provides.patch
@ -194,6 +196,8 @@ packages on a system.
%patch200 -p1 -b .findlang-kde3 %patch200 -p1 -b .findlang-kde3
%patch201 -p1 -b .prtsig %patch201 -p1 -b .prtsig
%patch202 -p1 -b .py-altnevr
%patch203 -p1 -b .hardlink-sizes
%patch300 -p1 -b .extra-prov %patch300 -p1 -b .extra-prov
%patch301 -p1 -b .niagara %patch301 -p1 -b .niagara
@ -408,6 +412,10 @@ exit 0
%doc doc/librpm/html/* %doc doc/librpm/html/*
%changelog %changelog
* Tue Jun 03 2009 Panu Matilainen <pmatilai@redhat.com> - 4.7.0-5
- don't mess up problem altNEVR in python ts.check() (#501068)
- fix hardlink size calculation on build (#503020)
* Thu May 14 2009 Panu Matilainen <pmatilai@redhat.com> - 4.7.0-4 * Thu May 14 2009 Panu Matilainen <pmatilai@redhat.com> - 4.7.0-4
- split cron-job into a sub-package to avoid silly deps on core rpm (#500722) - split cron-job into a sub-package to avoid silly deps on core rpm (#500722)
- rpm requires coreutils but not in %%post - rpm requires coreutils but not in %%post