From 79b845498ac4420eb6f422137e0b428ec841270e Mon Sep 17 00:00:00 2001
From: joey <joey>
Date: Sun, 22 Sep 2002 15:36:23 +0000
Subject: [PATCH] r551:    * Make addsubstvars remove old instances of line
 before adding new. This      will make dh_perl get deps right for packages
 that have perl modules and      XS in them.

---
 Debian/Debhelper/Dh_Lib.pm | 3 ++-
 debian/changelog           | 8 ++++++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/Debian/Debhelper/Dh_Lib.pm b/Debian/Debhelper/Dh_Lib.pm
index e2d26b2..3b7a519 100644
--- a/Debian/Debhelper/Dh_Lib.pm
+++ b/Debian/Debhelper/Dh_Lib.pm
@@ -439,7 +439,8 @@ sub addsubstvar {
 	}
 
 	if (length $line) {
-		 complex_doit("echo '${substvar}=$line' >> $substvarfile");
+		 complex_doit("(grep -v ${substvar} $substvarfile 2>/dev/null; echo '${substvar}=$line') > $substvarfile.new");
+		 doit("mv", "$substvarfile.new", $substvarfile);
 	}
 }
 
diff --git a/debian/changelog b/debian/changelog
index ad7014a..87cc9bd 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+debhelper (4.1.11) unstable; urgency=low
+
+  * Make addsubstvars remove old instances of line before adding new. This
+    will make dh_perl get deps right for packages that have perl modules and
+    XS in them.
+
+ -- Joey Hess <joeyh@debian.org>  Sun, 22 Sep 2002 11:27:08 -0400
+
 debhelper (4.1.10) unstable; urgency=low
 
   * Depend on coreutils | fileutils. Closes: #161452
-- 
2.39.5