1 --- rpm-5.4.9/build/files.c.buildroot_dups~ 2012-04-15 17:04:14.000000000 +0200
2 +++ rpm-5.4.9/build/files.c 2012-05-15 02:11:03.734983519 +0200
3 @@ -2917,7 +2917,7 @@ exit:
5 /* auxiliary function for checkDuplicateFiles() */
6 /* XXX need to pass Header because fi->h is NULL */
7 -static int fiIntersect(/*@null@*/ rpmfi fi1, /*@null@*/ rpmfi fi2)
8 +static int fiIntersect(/*@null@*/ rpmfi fi1, /*@null@*/ rpmfi fi2, size_t buildrootL)
9 /*@globals internalState @*/
10 /*@modifies fi1, fi2, internalState @*/
12 @@ -2941,7 +2941,7 @@ static int fiIntersect(/*@null@*/ rpmfi
15 dups = rpmiobAppend(dups, "\t", 0);
16 - dups = rpmiobAppend(dups, fn1, 1);
17 + dups = rpmiobAppend(dups, fn1+buildrootL, 1);
21 @@ -2972,7 +2972,7 @@ static int fiIntersect(/*@null@*/ rpmfi
22 * @param spec spec file control structure
23 * @return number of duplicate files
25 -static int checkDuplicateFiles(Spec spec)
26 +static int checkDuplicateFiles(Spec spec, size_t buildrootL)
27 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
28 /*@modifies *spec->packages,
29 rpmGlobalMacroContext, fileSystem, internalState @*/
30 @@ -2997,7 +2997,7 @@ static int checkDuplicateFiles(Spec spec
32 if (fi2 == NULL) continue;
33 (void) rpmfiSetHeader(fi2, pkg2->header);
34 - n += fiIntersect(fi1, fi2);
35 + n += fiIntersect(fi1, fi2, buildrootL);
36 (void) rpmfiSetHeader(fi2, NULL);
39 @@ -3023,7 +3023,7 @@ static inline int packagedDir(Package pk
41 * Now directories "/A/B" and "/A/B/C" should also be packaged.
43 -static int pkgUnpackagedSubdirs(Package pkg)
44 +static int pkgUnpackagedSubdirs(Package pkg, size_t buildrootL)
45 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
46 /*@modifies pkg->header,
47 rpmGlobalMacroContext, fileSystem, internalState @*/
48 @@ -3096,7 +3096,7 @@ static int pkgUnpackagedSubdirs(Package
50 for (i = 0; i < n; i++) {
51 list = rpmiobAppend(list, "\t", 0);
52 - list = rpmiobAppend(list, unpackaged[i], 1);
53 + list = rpmiobAppend(list, unpackaged[i]+buildrootL, 1);
54 unpackaged[i] = _free(unpackaged[i]);
56 unpackaged = _free(unpackaged);
57 @@ -3117,7 +3117,7 @@ static int pkgUnpackagedSubdirs(Package
58 * @param spec spec file control structure
59 * @return number of unpackaged subdirectories
61 -static int checkUnpackagedSubdirs(Spec spec)
62 +static int checkUnpackagedSubdirs(Spec spec, size_t buildrootL)
63 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
64 /*@modifies *spec->packages,
65 rpmGlobalMacroContext, fileSystem, internalState @*/
66 @@ -3126,7 +3126,7 @@ static int checkUnpackagedSubdirs(Spec s
69 for (pkg = spec->packages; pkg; pkg = pkg->next)
70 - n += pkgUnpackagedSubdirs(pkg);
71 + n += pkgUnpackagedSubdirs(pkg, buildrootL);
75 @@ -3137,6 +3137,11 @@ rpmRC processBinaryFiles(Spec spec, int
79 + char *buildroot = rpmExpand("%{?buildroot}", NULL);
80 + size_t buildrootL = strlen(buildroot);
82 + buildroot = _free(buildroot);
84 for (pkg = spec->packages; pkg != NULL; pkg = pkg->next) {
87 @@ -3178,8 +3183,8 @@ rpmRC processBinaryFiles(Spec spec, int
88 if (res == RPMRC_OK) {
89 if (checkUnpackagedFiles(spec) > 0)
91 - (void) checkDuplicateFiles(spec);
92 - (void) checkUnpackagedSubdirs(spec);
93 + (void) checkDuplicateFiles(spec, buildrootL);
94 + (void) checkUnpackagedSubdirs(spec, buildrootL);