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

Authored and Committed by Panu Matilainen 15 years ago
    - don't mess up problem altNEVR in python ts.check() (#501068)
    - fix hardlink size calculation on build (#503020)
    
        
rpm-4.7.0-hardlink-sizes.patch ADDED
@@ -0,0 +1,98 @@
1
+ commit cdfd0934841d4eccc26d7da7c35b23e6e9f76a9c
2
+ Author: Panu Matilainen <pmatilai@redhat.com>
3
+ Date: Fri May 29 09:02:44 2009 +0300
4
+
5
+ Fix calculation of hardlinked files (RhBug:503020)
6
+ - regression from commit 899dfb58927ec6e91014773430824462f4d0002e,
7
+ size of hardlinked file set is the size of one file of the set
8
+ - add isHardLink() internal helper to avoid a copy-paste code
9
+
10
+ diff --git a/build/files.c b/build/files.c
11
+ index ef60ae2..98abedd 100644
12
+ --- a/build/files.c
13
+ +++ b/build/files.c
14
+ @@ -981,6 +981,14 @@ static int isDoc(FileList fl, const char * fileName)
15
+ return 0;
16
+ }
17
+
18
+ +static int isHardLink(FileListRec flp, FileListRec tlp)
19
+ +{
20
+ + return ((S_ISREG(flp->fl_mode) && S_ISREG(tlp->fl_mode)) &&
21
+ + ((flp->fl_nlink > 1) && (flp->fl_nlink == tlp->fl_nlink)) &&
22
+ + (flp->fl_ino == tlp->fl_ino) &&
23
+ + (flp->fl_dev == tlp->fl_dev));
24
+ +}
25
+ +
26
+ /**
27
+ * Verify that file attributes scope over hardlinks correctly.
28
+ * If partial hardlink sets are possible, then add tracking dependency.
29
+ @@ -999,14 +1007,18 @@ static int checkHardLinks(FileList fl)
30
+
31
+ for (j = i + 1; j < fl->fileListRecsUsed; j++) {
32
+ jlp = fl->fileList + j;
33
+ - if (!S_ISREG(jlp->fl_mode))
34
+ - continue;
35
+ - if (ilp->fl_nlink != jlp->fl_nlink)
36
+ - continue;
37
+ - if (ilp->fl_ino != jlp->fl_ino)
38
+ - continue;
39
+ - if (ilp->fl_dev != jlp->fl_dev)
40
+ - continue;
41
+ + if (isHardLink(ilp, jlp)) {
42
+ + return 1;
43
+ + }
44
+ + }
45
+ + }
46
+ + return 0;
47
+ +}
48
+ +
49
+ +static int seenHardLink(FileList fl, FileListRec flp)
50
+ +{
51
+ + for (FileListRec ilp = fl->fileList; ilp < flp; ilp++) {
52
+ + if (isHardLink(flp, ilp)) {
53
+ return 1;
54
+ }
55
+ }
56
+ @@ -1147,9 +1159,12 @@ static void genCpioListAndHeader(FileList fl,
57
+ rpm_off_t rsize32 = (rpm_off_t)flp->fl_size;
58
+ headerPutUint32(h, RPMTAG_FILESIZES, &rsize32, 1);
59
+ }
60
+ - /* Excludes and dupes have been filtered out by now */
61
+ - if (S_ISREG(flp->fl_mode))
62
+ - totalFileSize += flp->fl_size;
63
+ + /* Excludes and dupes have been filtered out by now. */
64
+ + if (S_ISREG(flp->fl_mode)) {
65
+ + if (flp->fl_nlink == 1 || !seenHardLink(fl, flp)) {
66
+ + totalFileSize += flp->fl_size;
67
+ + }
68
+ + }
69
+
70
+ /*
71
+ * For items whose size varies between systems, always explicitly
72
+ @@ -1492,25 +1507,7 @@ static rpmRC addFile(FileList fl, const char * diskPath,
73
+ flp->specdFlags = fl->currentSpecdFlags;
74
+ flp->verifyFlags = fl->currentVerifyFlags;
75
+
76
+ - /* Hard links need be counted only once. */
77
+ - if (S_ISREG(flp->fl_mode) && flp->fl_nlink > 1) {
78
+ - FileListRec ilp;
79
+ - for (i = 0; i < fl->fileListRecsUsed; i++) {
80
+ - ilp = fl->fileList + i;
81
+ - if (!S_ISREG(ilp->fl_mode))
82
+ - continue;
83
+ - if (flp->fl_nlink != ilp->fl_nlink)
84
+ - continue;
85
+ - if (flp->fl_ino != ilp->fl_ino)
86
+ - continue;
87
+ - if (flp->fl_dev != ilp->fl_dev)
88
+ - continue;
89
+ - break;
90
+ - }
91
+ - } else
92
+ - i = fl->fileListRecsUsed;
93
+ -
94
+ - if (!(flp->flags & RPMFILE_EXCLUDE) && S_ISREG(flp->fl_mode) && i >= fl->fileListRecsUsed) {
95
+ + if (!(flp->flags & RPMFILE_EXCLUDE) && S_ISREG(flp->fl_mode)) {
96
+ /*
97
+ * XXX Simple and stupid check for now, this needs to be per-payload
98
+ * format check once we have other payloads than good 'ole cpio.
rpm-4.7.0-python-altnevr.patch ADDED
@@ -0,0 +1,39 @@
1
+ commit 9322f737819a3d81088699b1d7fa667259245411
2
+ Author: Panu Matilainen <pmatilai@redhat.com>
3
+ Date: Tue May 19 10:26:50 2009 +0300
4
+
5
+ Don't mess up problem altNEVR in python ts.check() (rhbz#501068)
6
+ - the use of strrchr() silently casts away the const from the problem
7
+ set altNEVR string, which we then happily modify..
8
+ - similar to commit 62cc76e25cdfad78ac30bb28f626b474efdecddc
9
+
10
+ diff --git a/python/rpmts-py.c b/python/rpmts-py.c
11
+ index e56e001..9877fbc 100644
12
+ --- a/python/rpmts-py.c
13
+ +++ b/python/rpmts-py.c
14
+ @@ -365,7 +365,7 @@ fprintf(stderr, "*** rpmts_Check(%p) ts %p cb %p\n", s, s->ts, cbInfo.cb);
15
+
16
+ /* XXX TODO: rpmlib >= 4.0.3 can return multiple suggested keys. */
17
+ while ((i = rpmpsNextIterator(psi)) >= 0) {
18
+ - const char * needsName;
19
+ + char * altNEVR, * needsName;
20
+ char * byName, * byVersion, * byRelease, *byArch;
21
+ char * needsOP, * needsVersion;
22
+ rpmsenseFlags needsFlags, sense;
23
+ @@ -383,7 +383,7 @@ fprintf(stderr, "*** rpmts_Check(%p) ts %p cb %p\n", s, s->ts, cbInfo.cb);
24
+
25
+ key = rpmProblemGetKey(p);
26
+
27
+ - needsName = rpmProblemGetAltNEVR(p);
28
+ + altNEVR = needsName = xstrdup(rpmProblemGetAltNEVR(p));
29
+ if (needsName[1] == ' ') {
30
+ sense = (needsName[0] == 'C')
31
+ ? RPMDEP_SENSE_CONFLICTS : RPMDEP_SENSE_REQUIRES;
32
+ @@ -409,6 +409,7 @@ fprintf(stderr, "*** rpmts_Check(%p) ts %p cb %p\n", s, s->ts, cbInfo.cb);
33
+ PyList_Append(list, (PyObject *) cf);
34
+ Py_DECREF(cf);
35
+ free(byName);
36
+ + free(altNEVR);
37
+ }
38
+
39
+ psi = rpmpsFreeIterator(psi);
file modified
+9 -1
rpm.spec CHANGED
@@ -21,7 +21,7 @@
21
21
Summary: The RPM package management system
22
22
Name: rpm
23
23
Version: %{rpmver}
24
- Release: 4%{?dist}
24
+ Release: 5%{?dist}
25
25
Group: System Environment/Base
26
26
Url: http://www.rpm.org/
27
27
Source0: http://rpm.org/releases/testing/%{name}-%{srcver}.tar.bz2
@@ -41,6 +41,8 @@ Patch3: rpm-4.6.0-fedora-specspo.patch
41
41
# Patches already in upstream
42
42
Patch200: rpm-4.7.0-findlang-kde3.patch
43
43
Patch201: rpm-4.7.0-prtsig.patch
44
+ Patch202: rpm-4.7.0-python-altnevr.patch
45
+ Patch203: rpm-4.7.0-hardlink-sizes.patch
44
46
45
47
# These are not yet upstream
46
48
Patch300: rpm-4.7.0-extra-provides.patch
@@ -194,6 +196,8 @@ packages on a system.
194
196
195
197
%patch200 -p1 -b .findlang-kde3
196
198
%patch201 -p1 -b .prtsig
199
+ %patch202 -p1 -b .py-altnevr
200
+ %patch203 -p1 -b .hardlink-sizes
197
201
198
202
%patch300 -p1 -b .extra-prov
199
203
%patch301 -p1 -b .niagara
@@ -408,6 +412,10 @@ exit 0
408
412
%doc doc/librpm/html/*
409
413
410
414
%changelog
415
+ * Tue Jun 03 2009 Panu Matilainen <pmatilai@redhat.com> - 4.7.0-5
416
+ - don't mess up problem altNEVR in python ts.check() (#501068)
417
+ - fix hardlink size calculation on build (#503020)
418
+
411
419
* Thu May 14 2009 Panu Matilainen <pmatilai@redhat.com> - 4.7.0-4
412
420
- split cron-job into a sub-package to avoid silly deps on core rpm (#500722)
413
421
- rpm requires coreutils but not in %%post