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

Bug#294073: apt: [apt-get] Add new command (R) to resolve upgrade diffs



Package: apt
Version: 0.5.28.1
Severity: wishlist


Many times on upgrage, the manual work to resolve situations like
this could be made easier:

    Configuration file `/etc/cups/cupsd.conf'
     ==> Modified (by you or by a script) since installation.
     ==> Package distributor has shipped an updated version.
       What would you like to do about it ?  Your options are:
	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
     The default action is to keep your current version.

FEATURE SUGGESTION
==================

Add command "R" to (R)esolve diffs with an external program. The
command R would be implemented as:

* Call external COMMAND with ARG1 and ARG2. The ARG1 would
  be the old file and ARG2 would be the new file file. In this the
  exec all:

      COMMAND /etc/cups/cupsd.conf /etc/cups/cupsd.conf.dpkg-new

* The COMMAND would be defined somewhere in /etc/apt/ configuration 
  files. Like in /etc/apt/conf.d/30diff which would contain:

  APT::diff-resolve-command "/etc/apt/diff-resolve-emacs.sh";

* The default /etc/apt/diff-resolve-emacs.sh could be a simple bash script
  that would call Emacs ediff interface to resolve the situation. 
  Something like:

   #!/bin/sh

   Main()
   {
        current=$1
        orig=$2

        [ ! "$current" ]  && return 1
        [ ! "$orig" ] 	  && return 1

        [ ! -f $current ] && return 1
        [ ! -f $orig ] 	  && return 1

        bin=${EMACS:-emacs}

        type -P $bin > /dev/null || return 1   # No 'emacs' installed yet

	${EMACS:-emacs} --no-windows --no-init-file --no-site-file \
	      --load ediff \
	      --eval "(ediff \"$orig\" \"$current\")"
   }

   Main "$@"

   # End of example

After that, it would be a simple task of:

  * Pess "n" to go to next diff, "p" to previous
  * Press "A" to copy diff from new upgrade to CURRENT file (B)
  * Press "wb" to write patched CURRENT (B)
  * Exit emacs C-x C-b

The diff interface would return to the original screen:

       What would you like to do about it ?  Your options are:
	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
	  R     : Resolve differencies

And the user would press "N" to continue to next upgrade problem.

While this example is Emacs specific, the modular design would
allow user to write, or APT to ship with, any other example 
scripts e.g. that could use some graphical interface. Selecting
another interface would be just adding user entry:

 /etc/apt/conf.d/99diff

That would override the package's default.

Jari

-- Package-specific info:

-- (no /etc/apt/preferences present) --


-- (/etc/apt/sources.list present, but not submitted) --


-- System Information:
Debian Release: 3.1
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)
Kernel: Linux 2.6.9-1-686
Locale: LANG=C, LC_CTYPE=C (charmap=ISO-8859-1) (ignored: LC_ALL set to en_US)

Versions of packages apt depends on:
ii  libc6                       2.3.2.ds1-20 GNU C Library: Shared libraries an
ii  libgcc1                     1:3.4.3-7    GCC support library
ii  libstdc++5                  1:3.3.5-8    The GNU Standard C++ Library v3

-- no debconf information



Reply to: