From: Yaroslav Halchenko <debian@onerussian.com>
Date: Wed, 13 Aug 2014 17:58:09 +0000 (-0400)
Subject: popcon: cleanup **only** when upgrading from older version of the neurodebian-popcon
X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=8f8419e74dcc5c1cd4cf648970791038e6bf4332;p=neurodebian.git

popcon: cleanup **only** when upgrading from older version of the neurodebian-popcon
---

diff --git a/debian/TODO b/debian/TODO
index 43b5232..7be3127 100644
--- a/debian/TODO
+++ b/debian/TODO
@@ -54,5 +54,3 @@ echo "I: success"
 
 * add backport patch for wheezy for neurodebian-guest-additions to pre-depend on update-manager-gnome
 
-* popcon: cleanup **only** when upgrading from older version of the neurodebian-popcon
-
diff --git a/debian/changelog b/debian/changelog
index 3aaa6b9..105d4f4 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -8,6 +8,11 @@ neurodebian (0.34) unstable; urgency=medium
       into Depends (from Pre-Depends), and stripping deprecated -ose suffix
     - fixing package names for chromium, and removing update-manager-gnome
       N/A in sid
+  * debian/neurodebian-popularity-contest.*
+    - .postinst  should try to remove old-fashion popcon entry only if
+      upgrading/configuring from pre 0.33 version of neurodebian-*
+    - .postrm  removed altogether since will not longer be needed because
+      popcon configuration gets installed as a config file now
   * tools/nd-configurerepo
     - use long GPG key id
     - unify prefix for environment variables to be NEURODEBIAN_ instead of
diff --git a/debian/neurodebian-popularity-contest.postinst b/debian/neurodebian-popularity-contest.postinst
index fb003d5..4f6c572 100755
--- a/debian/neurodebian-popularity-contest.postinst
+++ b/debian/neurodebian-popularity-contest.postinst
@@ -48,8 +48,11 @@ if [ "$1" = "configure" -o "$1" = "abort-upgrade" ]; then
 	if dpkg --compare-versions $popcon_version lt 1.61; then
 		add_neurodebian_popcon_pre161
 	else
-		# Assure that we have no "old" settings for submission
-		remove_neurodebian_popcon_pre161 || :
+		# Assure that we have no "old" settings for submission if
+		# previous version of our package was old
+		if [ "$1" = "configure" ] && [ -z "$2" ] && dpkg --compare-versions "$2" lt 0.33; then
+			remove_neurodebian_popcon_pre161 || :
+		fi
 	fi
 fi
 
diff --git a/debian/neurodebian-popularity-contest.postrm b/debian/neurodebian-popularity-contest.postrm
deleted file mode 100755
index 92bb35d..0000000
--- a/debian/neurodebian-popularity-contest.postrm
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/bin/sh -e
-
-#DEBHELPER#
-
-popcon_conf=/etc/popularity-contest.conf
-nd_popcon_conf=/etc/popularity-contest.d/neurodebian.conf
-remove_neurodebian_popcon_pre161() {
-	# Adjust popularity-contest.conf
-	if [ -e "$popcon_conf" ] \
-	   && grep -q "http://neuro.debian.net/cgi-bin/popcon-submit.cgi" $popcon_conf; then
-		echo "Removing NeuroDebian url for Popularity Contest submissions."
-		# First remove any explicit mentioning and then empty additions
-		sed -i -e 's,http://neuro.debian.net/cgi-bin/popcon-submit.cgi,,g' \
-			   -e '/SUBMITURLS+=" *"/d' \
-			   -e '/SUBMITURLS="$SUBMITURLS *"/d' \
-			"$popcon_conf"
-	fi
-}
-
-# If requested to be purged -- remove our entry
-if [ "$1" = "purge" ]; then
-	remove_neurodebian_popcon_pre161
-fi