[SCM] Packaging for Google Go branch, weekly-debian-sid, updated. debian-weekly/2011.06.09-2-28-g60edf06

Ondřej Surý ondrej at sury.org
Wed Aug 24 11:46:14 UTC 2011


The following commit has been merged in the weekly-debian-sid branch:
commit 60edf06b22a71c81e8d592f390a3cc88c05640cb
Author: Ondřej Surý <ondrej at sury.org>
Date:   Wed Aug 24 13:46:08 2011 +0200

    Add support for goinstall dashboard debconf question in the Debian packaging (now it needs to Go counterpart)

diff --git a/debian/golang-weekly-tools.config b/debian/golang-weekly-tools.config
new file mode 100644
index 0000000..61ae6a4
--- /dev/null
+++ b/debian/golang-weekly-tools.config
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+set -e
+
+conffile=/etc/golang/goinstall.conf
+
+. /usr/share/debconf/confmodule
+
+if [ -f $conffile ] ; then
+    if grep -q DASHBOARD $conffile; then
+        :;
+    fi
+    . $conffile
+    if [ yes = "$DASHBOARD" ] ; then
+        DASHBOARD=true
+    else
+        DASHBOARD=false
+    fi
+    db_set popularity-contest/dashboard "$DASHBOARD"
+fi
+
+db_input high popularity-contest/dashboard || [ $? -eq 30 ]
+db_go || true
diff --git a/debian/golang-weekly-tools.postinst b/debian/golang-weekly-tools.postinst
new file mode 100644
index 0000000..b511b97
--- /dev/null
+++ b/debian/golang-weekly-tools.postinst
@@ -0,0 +1,75 @@
+#!/bin/sh
+
+# Load debconf variables
+. /usr/share/debconf/confmodule
+
+confdir=/etc/golang
+conffile=$confdir/goinstall.conf
+
+set -e
+
+if [ -e $conffile ] ; then
+    # Fetch current values.
+    . $conffile
+fi
+
+# Get this setting from debconf.  It was set based on the content of
+# /etc/golang/goinstall.conf in the 'config' script, so it should be
+# safe to ignore the value fetched by loading the file above.  This
+# should allow for using debconf to reconfigure the package.
+db_get golang-weekly-tools/dashboard || true
+if [ "$RET" = "yes" ] || [ "$RET" = "YES" ] || [ "$RET" = "true" ]; then
+    DASHBOARD="yes"
+else
+    DASHBOARD="no"
+fi
+
+generate_conffile() {
+	if [ ! -d $confdir ]; then
+		mkdir $confdir
+	fi
+	cat <<-EOF >$conffile
+		# Config file for goinstall tool.
+		#
+		# To change this file, use:
+		#        dpkg-reconfigure golang-weekly-tools
+		#
+		# You can also edit it by hand, if you so choose.
+		
+		DASHBOARD="$DASHBOARD"
+	EOF
+
+	# Make sure user nobody can read the file.
+	chmod a+r $conffile
+}
+
+case "$1" in
+    configure)
+	if [ ! -e $conffile ]; then
+	    generate_conffile
+	else
+	    # Replace only if the content changed, to avoid changing the
+	    # config file date when no change was done.
+
+	    # Commenting out the obsolete addresses, to use the
+	    # default config from /usr/share/ on hosts where
+	    # the old default was unchanged.  Replace the "empty" id.
+
+	    sedopts=" \
+		s/^DASHBOARD=.*$/DASHBOARD=\"$DASHBOARD\"/;   \
+                "
+	    if sed "$sedopts" < $conffile > $conffile.new &&
+		! cmp $conffile $conffile.new > /dev/null; then
+		mv $conffile.new $conffile
+		# Make sure user nobody can read the file.
+		chmod a+r $conffile
+	    else
+		rm $conffile.new
+	    fi
+	fi
+	;;
+    *)
+	;;
+esac
+
+#DEBHELPER#
diff --git a/debian/golang-weekly-tools.postrm b/debian/golang-weekly-tools.postrm
new file mode 100644
index 0000000..2cf582e
--- /dev/null
+++ b/debian/golang-weekly-tools.postrm
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+set -e
+
+# purge the config file which is created in the postinst script
+if [ "$1" = purge ] ; then
+        rm -f /etc/golang/goinstall.conf
+	rmdir /etc/golang || true
+fi
+
+if [ "$1" = "purge" ] && [ -e /usr/share/debconf/confmodule ]; then
+    # Source debconf library.
+    . /usr/share/debconf/confmodule
+    # Remove my changes to the db.
+    db_purge
+fi
+
+#DEBHELPER#
+
diff --git a/debian/golang-weekly-tools.templates b/debian/golang-weekly-tools.templates
new file mode 100644
index 0000000..d7f325b
--- /dev/null
+++ b/debian/golang-weekly-tools.templates
@@ -0,0 +1,16 @@
+Template: golang-weekly-tools/dashboard
+Type: boolean
+Default: true
+_Description: Report installation of public packages to Go Dashboard?
+ goinstall reports the successful installation of the public packages
+ to godashboard.appspot.com, which increments a count associated with
+ the package and the time of its most recent installation.  This
+ mechanism powers the package list at the Go Dashboard, allowing Go
+ programmers to learn about popular packages that might be worth
+ looking at.
+ .
+ If you choose to participate, the goinstall will report each
+ successful installation to the Go Dashboard.
+ .
+ This choice can be later modified by running "dpkg-reconfigure
+ popularity-contest".

-- 
Packaging for Google Go



More information about the Pkg-google-commits mailing list