Package: dpkg
Version: 1.13.25
Severity: wishlist
Tags: patch

promptconfaction offers the choices of
    Y or I  : install the package maintainer's version
    N or O  : keep your currently-installed version
      D     : show the differences between the versions
      Z     : background this process to examine the situation

This patch adds another option: vimdiff.
It works similarly as D, only it doesn't diff but vimdiff the files.


-- System Information:
Debian Release: 4.0
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.18-6-686
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) (ignored: LC_ALL 
set to en_US.utf-8)

Versions of packages dpkg depends on:
ii  coreutils              5.97-5.3          The GNU core utilities
ii  libc6                  2.3.6.ds1-13etch5 GNU C Library: Shared libraries

dpkg recommends no packages.

-- no debconf information
--- src/configure.c	2008-04-02 14:13:56 +0000
+++ src/configure.c	2008-04-02 14:15:28 +0000
@@ -478,6 +478,38 @@
 	}
 }
 
+/* Show a vimdiff between two files
+ */
+static void showvimdiff(const char* old, const char* new) {
+	int	pid;
+	int	r;
+	int	status;
+
+	if (!(pid=m_fork())) {
+		/* Child process */
+		const char*	s;		/* shell */
+		char		cmdbuf[1024];	/* command to run */
+
+		sprintf(cmdbuf, "vimdiff %.250s %.250s >/dev/tty </dev/tty", new, old);
+
+		s=getenv(SHELLENV);
+		if (!s || !*s)
+			s=DEFAULTSHELL;
+
+		execlp(s,s,"-c", cmdbuf, NULL);
+		ohshite(_("failed to run %s (%.250s)"), DIFF, cmdbuf);
+	}
+
+	/* Parent process */
+	while (((r=waitpid(pid,&status,0))==-1) && (errno==EINTR))
+		;
+
+	if (r!=pid) {
+		onerr_abort++;
+		ohshite(_("wait for shell failed"));
+	}
+}
+
 
 /* Suspend dpkg temporarily
  */
@@ -613,7 +645,8 @@
 					"    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"
-					"      Z     : background this process to examine the situation\n"));
+					"      Z     : background this process to examine the situation\n"
+					"      V     : show the vimdiff between the versions\n"));
 
 		if (what & cfof_keep)
 			fprintf(stderr, _(" The default action is to keep your current version.\n"));
@@ -622,7 +655,7 @@
 
 		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/Z/V) %s ? ",
 				s,
 				(what & cfof_keep) ? _("[default=N]") :
 				(what & cfof_install) ? _("[default=Y]") : _("[no default]"));
@@ -648,6 +681,9 @@
 		if (cc == 'd')
 			showdiff(realold, realnew);
 
+		if (cc == 'v')
+			showvimdiff(realold, realnew);
+
 		if (cc == 'z')
 			suspend();
 

Reply via email to