[PATCH] Preserve local CPANPLUS configuration on upgrades

Niko Tyni ntyni at debian.org
Fri Aug 28 18:37:38 UTC 2009


In versions older than 5.10.0-24, CPANPLUS system configuration would
be erroneously saved under /usr/share. Avoid loss of local configuration
by moving it to /etc/perl/CPANPLUS/Config/System.pm on upgrades before
the new package overwrites it. (Closes: #543910)
---
 debian/changelog            |    4 ++++
 debian/perl-modules.preinst |   16 ++++++++++++++++
 2 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index c7efac7..67ff310 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -14,6 +14,10 @@ perl (5.10.1-1) UNRELEASED; urgency=low
     (Closes: #536384, #542137)
   * Add support for abstract sockets. Thanks to Lubomir Rintel.
     (Closes: #329291, #490660)
+  * In versions older than 5.10.0-24, CPANPLUS system configuration would be
+    erroneously saved under /usr/share. Avoid loss of local configuration by
+    copying it to /etc/perl/CPANPLUS/Config/System.pm on upgrades before the
+    new package overwrites it. (Closes: #543910)
 
  -- Niko Tyni <ntyni at debian.org>  Thu, 20 Aug 2009 14:51:52 +0300
 
diff --git a/debian/perl-modules.preinst b/debian/perl-modules.preinst
index 7d4b13e..e9c3c68 100644
--- a/debian/perl-modules.preinst
+++ b/debian/perl-modules.preinst
@@ -12,4 +12,20 @@ if [ -h /usr/share/doc/perl-modules ]; then
     rm -f /usr/share/doc/perl-modules
 fi
 
+# cpanp used to save its configuration to /usr/share
+# the md5sum corresponds to the file we ship from 5.10.0-24 onwards
+if [ "$1" = upgrade ] &&
+   [ -f /usr/share/perl/5.10.0/CPANPLUS/Config/System.pm ] &&
+   [ ! -e /etc/perl/CPANPLUS/Config/System.pm ] &&
+   [ "$(md5sum /usr/share/perl/5.10.0/CPANPLUS/Config/System.pm)" != \
+       "a8e8f612c37f8a5d1b73ebf5bd4e4473  /usr/share/perl/5.10.0/CPANPLUS/Config/System.pm" ]
+then
+   if [ -d /etc/perl/CPANPLUS/Config ] || mkdir -p /etc/perl/CPANPLUS/Config
+   then
+        mv /usr/share/perl/5.10.0/CPANPLUS/Config/System.pm \
+           /etc/perl/CPANPLUS/Config/System.pm || true
+        rmdir /usr/share/perl/5.10.0/CPANPLUS/Config  || true
+   fi
+fi
+
 exit 0
-- 
1.5.6.5


--qMm9M+Fa2AknHoGS--






More information about the Perl-maintainers mailing list