alexk / rpms / rpm

Forked from rpms/rpm 2 years ago
Clone
648606
From 3c99b06c7776345cfc3a3d4fd0c59fe671644317 Mon Sep 17 00:00:00 2001
648606
From: Lubos Kardos <lkardos@redhat.com>
648606
Date: Wed, 21 Oct 2015 15:25:47 +0200
648606
Subject: [PATCH] Overwrite a file if it is not marked as config any more.
648606
648606
If a file was marked as config in the previous version of a package but
648606
it is not marked as config in currently being installed version of
648606
the package then backup the old file as .rpmsave and overwrite it with
648606
the new file. (rhbz:1263859)
648606
---
648606
 lib/rpmfi.c | 12 ++++++++++++
648606
 1 file changed, 12 insertions(+)
648606
648606
diff --git a/lib/rpmfi.c b/lib/rpmfi.c
648606
index 924ff4b..28a697e 100644
648606
--- a/lib/rpmfi.c
648606
+++ b/lib/rpmfi.c
648606
@@ -1040,6 +1040,12 @@ rpmFileAction rpmfilesDecideFate(rpmfiles ofi, int oix,
648606
 	        goto exit;		/* file identical in new, replace. */
648606
 	}
648606
 
648606
+	/* if new file is no longer config, backup it and replace it */
648606
+	if (!(newFlags & RPMFILE_CONFIG)) {
648606
+	    action = FA_SAVE;
648606
+	    goto exit;
648606
+	}
648606
+
648606
 	/* If file can be determined identical in old and new pkg, let it be */
648606
 	if (newWhat == REG && oalgo == nalgo && odiglen == ndiglen) {
648606
 	    if (odigest && ndigest && memcmp(odigest, ndigest, odiglen) == 0) {
648606
@@ -1071,6 +1077,12 @@ rpmFileAction rpmfilesDecideFate(rpmfiles ofi, int oix,
648606
 		goto exit;		/* unmodified config file, replace. */
648606
 	}
648606
 
648606
+	/* if new file is no longer config, backup it and replace it */
648606
+	if (!(newFlags & RPMFILE_CONFIG)) {
648606
+	    action = FA_SAVE;
648606
+	    goto exit;
648606
+	}
648606
+
648606
 	/* If link is identical in old and new pkg, let it be */
648606
 	if (newWhat == LINK && oFLink && nFLink && rstreq(oFLink, nFLink)) {
648606
 	    action = FA_SKIP;		/* identical file, don't bother. */
648606
-- 
648606
2.5.5
648606