File installprefix.diff of Package rpm.openSUSE_13.1_Update

commit 88d24b14a8e0e33e768cb74a3487acf0925b012a
Author: Panu Matilainen <pmatilai@redhat.com>
Date:   Fri Jul 5 10:27:18 2013 +0300

    Ensure relocatable packages always get install-prefix(es) set (RhBug:979443)
    
    - Scriptlets from relocatable packages should always run with
      $RPM_INSTALL_PREFIX* defined, whether actually being relocated or not.
    - Fixes regression introduced by the optimization in commit
      5d3018c4ed476b1b7ac18e2573af517f872cb303. We always need to call
      addPrefixes() but return early from rpmRelocateFileList() when
      no relocations are taking place, fixing the performance regression
      introduced all the way back in cb8241dda783f7e8c143b08fecf57fe89a39c3a6
      which is what 5d3018c4ed476b1b7ac18e2573af517f872cb303 was trying
      to fix. Pooh :)

--- ./lib/rpmfi.c.orig	2013-06-10 15:55:10.000000000 +0000
+++ ./lib/rpmfi.c	2013-12-19 15:00:52.808435567 +0000
@@ -793,7 +793,8 @@ static int addPrefixes(Header h, rpmRelo
 	headerPutStringArray(h, RPMTAG_INSTPREFIXES, actualRelocations, numActual);
     }
     free(actualRelocations);
-    return numActual;
+    /* When any relocations are present there'll be more work to do */
+    return 1;
 }
 
 static void saveRelocs(Header h, rpmtd bnames, rpmtd dnames, rpmtd dindexes)
@@ -835,7 +836,8 @@ void rpmRelocateFileList(rpmRelocation *
     int i, j;
     struct rpmtd_s bnames, dnames, dindexes, fmodes;
 
-    addPrefixes(h, relocations, numRelocations);
+    if (!addPrefixes(h, relocations, numRelocations))
+	return;
 
     if (!_printed) {
 	_printed = 1;
--- ./lib/rpmte.c.orig	2012-11-18 08:21:42.000000000 +0000
+++ ./lib/rpmte.c	2013-12-19 15:00:52.808435567 +0000
@@ -98,7 +98,7 @@ static rpmfi getFI(rpmte p, Header h)
 				      (RPMFI_NOHEADER | RPMFI_FLAGS_ERASE);
 
     /* relocate stuff in header if necessary */
-    if (rpmteType(p) == TR_ADDED && rpmfsFC(p->fs) > 0 && p->nrelocs) {
+    if (rpmteType(p) == TR_ADDED && rpmfsFC(p->fs) > 0) {
 	if (!headerIsSource(h) && !headerIsEntry(h, RPMTAG_ORIGBASENAMES)) {
 	    rpmRelocateFileList(p->relocs, p->nrelocs, p->fs, h);
 	}
openSUSE Build Service is sponsored by