So it seems I did.  Sorry about that.  It is now attached.

        -Tim Abbott

On Wed, 11 Jun 2008, Adrien Cunin wrote:

Hello,

I'd be interested in your ucf patch, but it seems you forgot to attach it to
your mail. Could you please re-send it?

Thanks.

--
Adrien Cunin aka Adri2000
diff -ur ucf-3.006.orig/ucf ucf-3.006/ucf
--- ucf-3.006.orig/ucf	2008-04-02 23:16:15.000000000 -0400
+++ ucf-3.006/ucf	2008-06-07 14:14:32.000000000 -0400
@@ -98,6 +98,7 @@
                              this file.  Overrides any setting of --src-dir.
      -d [n], --debug    [n]  Set the Debug level to N
      -n,     --no-action     Dry run. No action is actually taken.
+     -P foo, --package foo   Don't follow dpkg-divert diversions by package foo.
      -v,     --verbose       Make the script verbose
              --three-way     Register this file in the cache, and turn on the
                              diff3 option allowing the merging of maintainer
@@ -350,6 +351,8 @@
 	-h|--help) usageversion;                        exit 0 ;;
 	-n|--no-action) action='echo'; docmd='NO';      shift  ;;
 	-v|--verbose) VERBOSE=1;                        shift  ;;
+	-P|--package)
+	    opt_package="$2";			       shift 2 ;;
 	-s|--src-dir)
 	    opt_source_dir="$2";                       shift 2 ;;
 	--sum-file)
@@ -409,6 +412,19 @@
     setq dest_file "$(readlink -q -m $temp_dest_file)" "The Destination file";
 fi
 
+# Follow dpkg-divert as though we are installed as part of $opt_package
+divert_line=$(dpkg-divert --list "$safe_dest_file")
+if [ echo "$divert_line" | grep "^local" ]; then
+    # local diversion; pick something not in the package namespace
+    divert_package="LOCAL"
+else
+    # extract the name of the diverted package.
+    # The fact that this requires output parsing is bug #485012
+    divert_package=$(echo "$divert_line" | sed 's/^.* by \([a-z0-9+-]*\)$/\1/')
+fi
+if [ "$divert_package" != "$opt_package" ]; then
+    dest_file=$(dpkg-divert --truename "dest_file")
+fi
 
 safe_dest_file=$(echo $dest_file | perl -nle 'print "\Q$_\E\n"')
 
diff -ur ucf-3.006.orig/ucf.1 ucf-3.006/ucf.1
--- ucf-3.006.orig/ucf.1	2008-04-02 23:16:15.000000000 -0400
+++ ucf-3.006/ucf.1	2008-06-07 14:13:58.000000000 -0400
@@ -151,6 +151,10 @@
 .B "\-v, \-\-verbose"
 Make the script be very verbose about setting internal variables.
 .TP
+.B "\-P foo, \-\-package foo"
+Don't follow dpkg-divert diversions by package foo when updating
+configuration files.
+.TP
 .B "\-s foo, \-\-src\-dir  foo"
 Set the source directory (historical md5sums are expected to live in
 files and sub directories of this directory) to foo. By default, the

Reply via email to