]> git.donarmstrong.com Git - neurodebian.git/commitdiff
Support popularity-contest >= 1.61 encrypting submissions
authorYaroslav Halchenko <debian@onerussian.com>
Wed, 6 Aug 2014 20:30:40 +0000 (16:30 -0400)
committerYaroslav Halchenko <debian@onerussian.com>
Wed, 6 Aug 2014 22:23:55 +0000 (18:23 -0400)
- provide GPG public key for encryption of submissions

debian/changelog
debian/neurodebian-popularity-contest.dirs [new file with mode: 0644]
debian/neurodebian-popularity-contest.install [new file with mode: 0644]
debian/neurodebian-popularity-contest.postinst
debian/neurodebian-popularity-contest.postrm
popcon/neurodebian-popcon.gpg [new file with mode: 0644]
popcon/neurodebian.conf [new file with mode: 0644]

index 2f339f63beebc0f2b9edbe7cac94c61830d205b5..7d7dd34d26128f3325b2ac41d17103a05cd52414 100644 (file)
@@ -1,3 +1,10 @@
+neurodebian (0.33~a1) UNRELEASED; urgency=medium
+
+  * Support popularity-contest >= 1.61 encrypting submissions:
+    - provide GPG public key for encryption of submissions
+
+ -- Yaroslav Halchenko <debian@onerussian.com>  Wed, 06 Aug 2014 16:21:04 -0400
+
 neurodebian (0.32) neurodebian; urgency=low
 
   [ Michael Hanke ]
diff --git a/debian/neurodebian-popularity-contest.dirs b/debian/neurodebian-popularity-contest.dirs
new file mode 100644 (file)
index 0000000..ff41a38
--- /dev/null
@@ -0,0 +1,2 @@
+usr/share/popularity-contest
+etc/popularity-contest.d
diff --git a/debian/neurodebian-popularity-contest.install b/debian/neurodebian-popularity-contest.install
new file mode 100644 (file)
index 0000000..88ddd33
--- /dev/null
@@ -0,0 +1,2 @@
+popcon/neurodebian.conf /etc/popularity-contest.d
+popcon/neurodebian-popcon.gpg /usr/share/popularity-contest
index 3bb1437090d96622a741aa615d0fc40ca9a0f283..fb003d5226173167bc58a3de22a2789ceeeb9739 100755 (executable)
@@ -1,8 +1,25 @@
 #!/bin/bash -e
 
+# following to be duplicated within postrm as well, but may be with
+# "Removing" message
 popcon_conf=/etc/popularity-contest.conf
-if [ "$1" = "configure" -o "$1" = "abort-upgrade" ]; then
+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
+}
+
+add_neurodebian_popcon_pre161() {
+       # Adjust main popularity-contest configuration file.  Should be
+       # used only with older versions of the popularity contest.
        if [ -e "$popcon_conf" ]; then
                # Fix dashism missing += operator
                if grep -q 'SUBMITURLS+="' "$popcon_conf"; then
@@ -14,6 +31,26 @@ if [ "$1" = "configure" -o "$1" = "abort-upgrade" ]; then
                        echo -e 'SUBMITURLS="$SUBMITURLS http://neuro.debian.net/cgi-bin/popcon-submit.cgi"' >> "$popcon_conf"
                fi
        fi
+}
+
+add_neurodebian_popcon_161() {
+       # 1.60 introduced encryption and a way to provide multiple keys to
+       # encrypt submissions to multiple servers.
+
+       # "Installation" is taken care of through installing files under
+       # /etc/popularity-contest.d, so no additional actions necessary here
+       :
+}
+
+popcon_version=$(dpkg -l popularity-contest | tail -n 1 | awk '{print $3;}')
+
+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 || :
+       fi
 fi
 
 #DEBHELPER#
index 6615555b99f81749e61ae8bc544a63d76919a093..92bb35d88fc615bd3278a147dd77320a0d7ed88b 100755 (executable)
@@ -2,11 +2,12 @@
 
 #DEBHELPER#
 
-# If requested to be purged -- remove our entry
 popcon_conf=/etc/popularity-contest.conf
-if [ "$1" = "purge" ]; then
+nd_popcon_conf=/etc/popularity-contest.d/neurodebian.conf
+remove_neurodebian_popcon_pre161() {
        # Adjust popularity-contest.conf
-       if [ -e "$popcon_conf" ]; then
+       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' \
@@ -14,4 +15,9 @@ if [ "$1" = "purge" ]; then
                           -e '/SUBMITURLS="$SUBMITURLS *"/d' \
                        "$popcon_conf"
        fi
+}
+
+# If requested to be purged -- remove our entry
+if [ "$1" = "purge" ]; then
+       remove_neurodebian_popcon_pre161
 fi
diff --git a/popcon/neurodebian-popcon.gpg b/popcon/neurodebian-popcon.gpg
new file mode 100644 (file)
index 0000000..d5e8c9b
Binary files /dev/null and b/popcon/neurodebian-popcon.gpg differ
diff --git a/popcon/neurodebian.conf b/popcon/neurodebian.conf
new file mode 100644 (file)
index 0000000..5d0ecee
--- /dev/null
@@ -0,0 +1,3 @@
+KEYRING="$KEYRING --keyring /usr/share/popularity-contest/neurodebian-popcon.gpg"
+POPCONKEY="$POPCONKEY -r 0x544665CB8B48DE1D"
+SUBMITURLS="$SUBMITURLS http://neuro.debian.net/cgi-bin/popcon-submit.cgi"