Hi,
attached is a patch that uses debconf to display the diff. This avoids
that the GUI freeze when using the gnome debconf frontend.
It uses the "escape" capability of debconf, this is why I updated the
debconf version and removed cdebconf (it does not support this feature
currently).
Feedback is very welcome.
Cheers,
Michael
P.S. I did the patch against a slightly older version, but it applies
fine to the latest version in unstable.
diff -Nru /tmp/qt62XW0P0Q/ucf-2.0017/debian/changelog
/tmp/uJq8M5mbqL/ucf-2.0017ubuntu1/debian/changelog
--- /tmp/qt62XW0P0Q/ucf-2.0017/debian/changelog 2006-11-16 20:35:59.000000000
+0100
+++ /tmp/uJq8M5mbqL/ucf-2.0017ubuntu1/debian/changelog 2007-02-09
21:13:26.000000000 +0100
@@ -1,3 +1,11 @@
+ucf (2.0017ubuntu1) feisty; urgency=low
+
+ * use a debconf note for the diff
+ * updated dependency of debconf to 1.4.72 (this is the version that
+ supports the "escape" capability)
+
+ -- Michael Vogt <[EMAIL PROTECTED]> Fri, 9 Feb 2007 18:49:12 +0100
+
ucf (2.0017) unstable; urgency=low
* Bug fix: "ucf: spelling errors", thanks to Matt Taggart (Closes: #395444).
diff -Nru /tmp/qt62XW0P0Q/ucf-2.0017/debian/control
/tmp/uJq8M5mbqL/ucf-2.0017ubuntu1/debian/control
--- /tmp/qt62XW0P0Q/ucf-2.0017/debian/control 2006-11-16 20:35:59.000000000
+0100
+++ /tmp/uJq8M5mbqL/ucf-2.0017ubuntu1/debian/control 2007-02-09
21:21:07.000000000 +0100
@@ -7,7 +7,7 @@
Package: ucf
Architecture: all
-Depends: debconf (>= 1.2.0) | debconf-2.0, coreutils (>= 5.91)
+Depends: debconf (>= 1.4.72), coreutils (>= 5.91)
Recommends: debconf-utils
Description: Update Configuration File: preserves user changes to config files.
Debian policy states that configuration files must preserve user
diff -Nru /tmp/qt62XW0P0Q/ucf-2.0017/debian/templates
/tmp/uJq8M5mbqL/ucf-2.0017ubuntu1/debian/templates
--- /tmp/qt62XW0P0Q/ucf-2.0017/debian/templates 2006-11-16 23:15:39.000000000
+0100
+++ /tmp/uJq8M5mbqL/ucf-2.0017ubuntu1/debian/templates 2007-02-09
21:38:48.000000000 +0100
@@ -106,3 +106,8 @@
En ny version av konfigurationsfilen ${FILE} finns tillgänglig men din
version har modifierats lokalt.
Description-vi.UTF-8: Đối với ${BASENAME}?, bạn muốn làm gì vậy?
Có một phiên bản mới của tập tin cấu hình ${FILE}, nhưng phiên bản bạn đã
được sửa đổi một cách địa phương.
+
+Template: ucf/show_diff
+Type: note
+Description: The differences
+ ${DIFF}
diff -Nru /tmp/qt62XW0P0Q/ucf-2.0017/debian/templates.master
/tmp/uJq8M5mbqL/ucf-2.0017ubuntu1/debian/templates.master
--- /tmp/qt62XW0P0Q/ucf-2.0017/debian/templates.master 2006-11-16
20:35:59.000000000 +0100
+++ /tmp/uJq8M5mbqL/ucf-2.0017ubuntu1/debian/templates.master 2007-02-09
21:33:02.000000000 +0100
@@ -18,3 +18,8 @@
_Description: What would you like to do about ${BASENAME}?
A new version of configuration file ${FILE} is available, but your version
has been locally modified.
+
+Template: ucf/show_diff
+Type: note
+_Description: The differences
+ ${DIFF}
diff -Nru /tmp/qt62XW0P0Q/ucf-2.0017/ucf /tmp/uJq8M5mbqL/ucf-2.0017ubuntu1/ucf
--- /tmp/qt62XW0P0Q/ucf-2.0017/ucf 2006-11-16 20:35:57.000000000 +0100
+++ /tmp/uJq8M5mbqL/ucf-2.0017ubuntu1/ucf 2007-02-09 21:37:09.000000000
+0100
@@ -57,6 +57,26 @@
fi
}
+show_diff() {
+ if [ -z "$1" ]; then
+ echo >&2 "need a diff as argument"
+ exit 1;
+ fi
+ DIFF="$1"
+ if [ "$DEBCONF_OK" = "YES" ] && [ "$DEBIAN_HAS_FRONTEND" ]; then
+ templ=ucf/show_diff
+ db_capb escape
+ db_reset $templ
+ db_subst $templ DIFF "$(printf %s "$DIFF" | debconf-escape -e)"
+ db_input critical $templ || true
+ db_go
+ db_get $templ
+ db_capb
+ else
+ echo "$DIFF" | sensible-pager
+ fi
+}
+
withecho () {
echo " $@" >&2
"$@"
@@ -870,59 +890,40 @@
;;
"$choice_diff"|D|d)
if [ -e "$dest_file" ]; then
- ( diff -uBbw "$dest_file" "$new_file" | \
- sensible-pager ) </dev/tty >/dev/tty
+ DIFF="$(diff -uBbw "$dest_file" "$new_file")" || true
else
- ( diff -uBbw /dev/null "$new_file" | \
- sensible-pager ) </dev/tty >/dev/tty
- fi
- if [ "X$STOP" != "X" ]; then
- echo >&2 "Please hit enter to continue";
- read -e ANSWER </dev/tty
+ DIFF="$(diff -uBbw /dev/null "$new_file")" || true
fi
+ show_diff "$DIFF"
;;
"$choice_sdiff"|S|s)
if [ -e "$dest_file" ]; then
- ( sdiff -BbW "$dest_file" "$new_file" | \
- sensible-pager ) </dev/tty >/dev/tty
+ DIFF="$( sdiff -BbW "$dest_file" "$new_file")" || true
else
- ( sdiff -BbW /dev/null "$new_file" | \
- sensible-pager ) </dev/tty >/dev/tty
- fi
- if [ "X$STOP" != "X" ]; then
- echo >&2 "Please hit enter to continue";
- read -e ANSWER </dev/tty
+ DIFF="$(sdiff -BbW /dev/null "$new_file")" || true
fi
+ show_diff "$DIFF"
;;
"$choice_diff_threeway"|3|t|T)
if [ -e "$statedir/cache/$cached_file" \
-a "X$THREEWAY" != "X" ]; then
if [ -e "$dest_file" ]; then
- ( diff3 -L Current -L Older -L New -A \
+ DIFF="$(diff3 -L Current -L Older -L New -A \
"$dest_file" "$statedir/cache/$cached_file" \
- "$new_file" | sensible-pager ) >/dev/tty </dev/tty
+ "$new_file")" || true
else
- ( diff3 -L Current -L Older -L New -A \
+ DIFF="$(diff3 -L Current -L Older -L New -A \
/dev/null "$statedir/cache/$cached_file" \
- "$new_file" | sensible-pager ) >/dev/tty </dev/tty
+ "$new_file")" || true
fi
- if [ "X$STOP" != "X" ]; then
- echo >&2 "Please hit enter to continue";
- read -e ANSWER </dev/tty
- fi
+ show_diff "$DIFF"
else
if [ -e "$dest_file" ]; then
- ( diff -uBbw "$dest_file" "$new_file" | \
- sensible-pager ) </dev/tty >/dev/tty
+ DIFF="$(diff -uBbw "$dest_file" "$new_file")" || true
else
- ( diff -uBbw /dev/null "$new_file" | \
- sensible-pager ) </dev/tty >/dev/tty
- fi
-
- if [ "X$STOP" != "X" ]; then
- echo >&2 "Please hit enter to continue";
- read -e ANSWER </dev/tty
+ DIFF="$(diff -uBbw /dev/null "$new_file")" || true
fi
+ show_diff "$DIFF"
fi
;;
"$choice_merge_threeway"|M|m)