Alexey:
This is your patch reworked slightly. See what you think.
On Jun 16, 2008, at 4:36 AM, Jeff Johnson wrote:
RPM Package Manager, CVS Repository
http://rpm5.org/cvs/
______________________________________________________________________
______
Server: rpm5.org Name: Jeff Johnson
Root: /v/rpm/cvs Email: [EMAIL PROTECTED]
Module: rpm Date: 16-Jun-2008
10:36:53
Branch: HEAD Handle: 2008061608365201
Modified files:
rpm CHANGES
rpm/build files.c
Log:
- fix: RPMTAG_SIZE is incorrect with %exclude and %ghost
directives
(Alexey Tourbin<[EMAIL PROTECTED]>).
Summary:
Revision Changes Path
1.2416 +2 -0 rpm/CHANGES
1.321 +30 -32 rpm/build/files.c
______________________________________________________________________
______
patch -p0 <<'@@ .'
Index: rpm/CHANGES
======================================================================
======
$ cvs diff -u -r1.2415 -r1.2416 CHANGES
--- rpm/CHANGES 15 Jun 2008 09:21:08 -0000 1.2415
+++ rpm/CHANGES 16 Jun 2008 08:36:52 -0000 1.2416
@@ -1,5 +1,7 @@
5.1.0 -> 5.2a0:
+ - jbj: fix: RPMTAG_SIZE is incorrect with %exclude and %
ghost directives
+ (Alexey Tourbin<[EMAIL PROTECTED]>).
- jbj: fix: Install-Size: spewage in Kb, not bytes. everone
gotta be different.
- jbj: permit *.deb syntax as arbitrary tags.
- jbj: add *.deb format dependency tag header extensions.
@@ .
patch -p0 <<'@@ .'
Index: rpm/build/files.c
======================================================================
======
$ cvs diff -u -r1.320 -r1.321 files.c
--- rpm/build/files.c 2 Apr 2008 20:52:52 -0000 1.320
+++ rpm/build/files.c 16 Jun 2008 08:36:53 -0000 1.321
@@ -1601,15 +1601,6 @@
/[EMAIL PROTECTED] =noeffectuncon @*/
sxfn = _free(sxfn);
- ui32 = fl->totalFileSize;
- he->tag = RPMTAG_SIZE;
- he->t = RPM_UINT32_TYPE;
- he->p.ui32p = &ui32;
- he->c = 1;
- he->append = 1;
- xx = headerPut(h, he, 0);
- he->append = 0;
-
if (_rpmbuildFlags & 4) {
(void) rpmlibNeedsFeature(h, "PayloadFilesHavePrefix", "4.0-1");
(void) rpmlibNeedsFeature(h, "CompressedFileNames", "3.0.4-1");
@@ -1713,7 +1704,37 @@
if (isSrc)
fi->fmapflags[i] |= IOSM_FOLLOW_SYMLINKS;
+ if (S_ISREG(flp->fl_mode)) {
+ int bingo = 1;
+ /* Hard links need be tallied only once. */
+ if (flp->fl_nlink > 1) {
+ FileListRec jlp = flp + 1;
+ int j = i + 1;
+ for (; (unsigned)j < fi->fc; j++, jlp++) {
+ if (!S_ISREG(jlp->fl_mode))
+ continue;
+ if (flp->fl_nlink != jlp->fl_nlink)
+ continue;
+ if (flp->fl_ino != jlp->fl_ino)
+ continue;
+ if (flp->fl_dev != jlp->fl_dev)
+ continue;
+ bingo = 0; /* don't tally hardlink yet. */
+ break;
+ }
+ }
+ if (bingo)
+ fl->totalFileSize += flp->fl_size;
+ }
}
+
+ ui32 = fl->totalFileSize;
+ he->tag = RPMTAG_SIZE;
+ he->t = RPM_UINT32_TYPE;
+ he->p.ui32p = &ui32;
+ he->c = 1;
+ xx = headerPut(h, he, 0);
+
/[EMAIL PROTECTED]@*/
if (fip)
*fip = fi;
@@ -1946,27 +1967,6 @@
flp->flags = fl->currentFlags;
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)
- fl->totalFileSize += flp->fl_size;
}
fl->fileListRecsUsed++;
@@ -2758,8 +2758,6 @@
#endif
flp->langs = xstrdup("");
- fl.totalFileSize += flp->fl_size;
-
if (! (flp->uname && flp->gname)) {
rpmlog(RPMLOG_ERR, _("Bad owner/group: %s\n"), diskURL);
rc = fl.processingFailed = 1;
@@ .
______________________________________________________________________
RPM Package Manager http://rpm5.org
CVS Sources Repository [EMAIL PROTECTED]
______________________________________________________________________
RPM Package Manager http://rpm5.org
Developer Communication List rpm-devel@rpm5.org