[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[PATCH 5/7] Implement 'p' option for diffing dist conffiles during conflict resolution



A new option is presented to the user in the conffile resolution prompt,
offering to show the diff between the previous dist version of the conffile
and the new dist version of the conffile. This can be useful for the local
admin to know what has changed in the latest version of the package in the
case that manual conflict resolution is necessary.

To remove ambiguity the string prompt for the old diff option has been
updated as well.  The new prompt contains the following:

      D     : show the differences from your current version
      P     : show the differences from the previous debian version

Suggestions are welcome for improvement to this.
---
 src/configure.c |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/src/configure.c b/src/configure.c
index 88a7c48..1b41da9 100644
--- a/src/configure.c
+++ b/src/configure.c
@@ -593,6 +593,7 @@ promptconfaction(struct pkginfo *pkg, const char *cfgfile,
                  int useredited, int distedited, enum conffopt what)
 {
 	const char *s;
+	char *prev_conffile;
 	int c, cc;
 
 	if (!(what & cfof_prompt))
@@ -659,7 +660,8 @@ promptconfaction(struct pkginfo *pkg, const char *cfgfile,
 		        _("   What would you like to do about it ?  Your options are:\n"
 		          "    Y or I  : install the package maintainer's version\n"
 		          "    N or O  : keep your currently-installed version\n"
-		          "      D     : show the differences between the versions\n"
+		          "      D     : show the differences from your current version\n"
+		          "      P     : show the differences from the previous debian version\n"
 		          "      Z     : background this process to examine the situation\n"));
 
 		if (what & cfof_keep)
@@ -670,7 +672,7 @@ promptconfaction(struct pkginfo *pkg, const char *cfgfile,
 		s = strrchr(cfgfile, '/');
 		if (!s || !*++s)
 			s = cfgfile;
-		fprintf(stderr, "*** %s (Y/I/N/O/D/Z) %s ? ",
+		fprintf(stderr, "*** %s (Y/I/N/O/D/P/Z) %s ? ",
 		        s,
 		        (what & cfof_keep) ? _("[default=N]") :
 		        (what & cfof_install) ? _("[default=Y]") :
@@ -704,6 +706,14 @@ promptconfaction(struct pkginfo *pkg, const char *cfgfile,
 		if (cc == 'd')
 			showdiff(realold, realnew);
 
+		if (cc == 'p') {
+			prev_conffile = conffiledb_path(pkg,
+			                                &pkg->configversion,
+			                                cfgfile);
+			showdiff(prev_conffile, realnew);
+			free(prev_conffile);
+		}
+
 		if (cc == 'z')
 			suspend();
 	} while (!strchr("yino", cc));
-- 
1.6.5.3


Reply to: