[Webapps-common-discuss] [commit] r111 - in webapps-common/trunk: . debian debian/po dpkg examples/webapp-apache-dbapp-example/debian

seanius at alioth.debian.org seanius at alioth.debian.org
Mon May 14 00:00:36 UTC 2007


Author: seanius
Date: 2007-05-14 00:00:35 +0000 (Mon, 14 May 2007)
New Revision: 111

Modified:
   webapps-common/trunk/TODO
   webapps-common/trunk/debian/changelog
   webapps-common/trunk/debian/control
   webapps-common/trunk/debian/po/templates.pot
   webapps-common/trunk/debian/rules
   webapps-common/trunk/dpkg/common
   webapps-common/trunk/dpkg/config
   webapps-common/trunk/dpkg/postinst
   webapps-common/trunk/dpkg/postrm
   webapps-common/trunk/dpkg/prerm
   webapps-common/trunk/examples/webapp-apache-dbapp-example/debian/config
Log:
multiinstance dbapp joy

Modified: webapps-common/trunk/TODO
===================================================================
--- webapps-common/trunk/TODO	2007-05-13 11:17:03 UTC (rev 110)
+++ webapps-common/trunk/TODO	2007-05-14 00:00:35 UTC (rev 111)
@@ -1,20 +1,16 @@
 right now:
 
-- "default" isn't really the right name for the default virtual host
-  choice.  maybe "global" would be better because it's not the "default
-  host", but "all hosts" (those that include conf.d?). or maybe default
-  is best after all, because we don't reallyknow what happens when
-  we just drop the configuration in conf.d...
-
 - handling pre-existing virtualhosts.  currently we end up with duplicate
   configs...
 
 - finish dbconfig-common integration:
   - currently the package has to set dbc_dbtype in each maintainer
     script, which is a bit sub-optimal imo.
-  - multi-instance support, which may need to rely on multi-instance
-    support from dbconfig-common, and will certainly at the least
-	involve some more thought/planning
+  - multi-instance support is still a little rough around the edges
+  - newer versions of dbconfig-common have changed behaviour in a way that
+    automagic batch configuration isn't so automagic anymore (you have to
+	answer yes to "reinstall this db" which is kinda annoying
+  - dbc doesn't remember the admin password between goes.
 
 - migration paths for previously existing packages which used other
   methods for configuration.

Modified: webapps-common/trunk/debian/changelog
===================================================================
--- webapps-common/trunk/debian/changelog	2007-05-13 11:17:03 UTC (rev 110)
+++ webapps-common/trunk/debian/changelog	2007-05-14 00:00:35 UTC (rev 111)
@@ -1,3 +1,13 @@
+webapps-common (0.8) UNRELEASED; urgency=low
+
+  [sean finney]
+  * the "oh yeah, *that* project" release.
+  * take a first shot at the final obstacle for experimental, dbconfig-common
+    support on a per-instance basis.  requires a versioned dependency on
+    dbconfig-common.  still a little rough around the edges...
+
+ -- sean finney <seanius at debian.org>  Mon, 14 May 2007 01:21:56 +0200
+
 webapps-common (0.7) UNRELEASED; urgency=low
 
   [sean finney]

Modified: webapps-common/trunk/debian/control
===================================================================
--- webapps-common/trunk/debian/control	2007-05-13 11:17:03 UTC (rev 110)
+++ webapps-common/trunk/debian/control	2007-05-14 00:00:35 UTC (rev 111)
@@ -2,12 +2,12 @@
 Section: admin
 Priority: optional
 Maintainer: sean finney <seanius at debian.org>
-Build-Depends: debhelper (>= 4.0.0), debiandoc-sgml
+Build-Depends: debhelper (>= 4.0.0), po-debconf, debiandoc-sgml, tetex-extra, gs
 Standards-Version: 3.6.1
 
 Package: webapps-common
 Architecture: all
-Depends: ${misc:Depends}
+Depends: ${misc:Depends}, dbconfig-common (>= 1.8.33)
 Description: common framework for packaging web applications
  webapps-common presents a policy and implementation for various
  aspects of involved in developing and managing web applications in

Modified: webapps-common/trunk/debian/po/templates.pot
===================================================================
--- webapps-common/trunk/debian/po/templates.pot	2007-05-13 11:17:03 UTC (rev 110)
+++ webapps-common/trunk/debian/po/templates.pot	2007-05-14 00:00:35 UTC (rev 111)
@@ -8,7 +8,7 @@
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: seanius at debian.org\n"
-"POT-Creation-Date: 2006-05-16 11:35-0500\n"
+"POT-Creation-Date: 2007-05-12 13:23+0200\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
 "Language-Team: LANGUAGE <LL at li.org>\n"
@@ -18,13 +18,13 @@
 
 #. Type: boolean
 #. Description
-#: ../webapps-common.templates:4
+#: ../webapps-common.templates:1001
 msgid "Configure web server(s) for ${pkg} with webapps-common?"
 msgstr ""
 
 #. Type: boolean
 #. Description
-#: ../webapps-common.templates:4
+#: ../webapps-common.templates:1001
 msgid ""
 "${pkg} must be registered and configured with a web server before it can be "
 "used.  If you like, this can be handled with webapps-common."
@@ -32,7 +32,7 @@
 
 #. Type: boolean
 #. Description
-#: ../webapps-common.templates:4
+#: ../webapps-common.templates:1001
 msgid ""
 "If you are an advanced web server administrator and know that you want to "
 "perform this configuration manually, or if your web server has already been "
@@ -42,19 +42,19 @@
 
 #. Type: boolean
 #. Description
-#: ../webapps-common.templates:4
+#: ../webapps-common.templates:1001
 msgid "Otherwise, you should probably choose this option."
 msgstr ""
 
 #. Type: boolean
 #. Description
-#: ../webapps-common.templates:19
+#: ../webapps-common.templates:2001
 msgid "Deconfigure web server(s) for ${pkg} with webapps-common?"
 msgstr ""
 
 #. Type: boolean
 #. Description
-#: ../webapps-common.templates:19
+#: ../webapps-common.templates:2001
 msgid ""
 "Since you are removing ${pkg}, it's probable that you no longer wish to have "
 "any web servers configured to use ${pkg}."
@@ -62,14 +62,14 @@
 
 #. Type: boolean
 #. Description
-#: ../webapps-common.templates:19
+#: ../webapps-common.templates:2001
 msgid ""
 "If you like, web server deconfiguration can be handled with webapps-common."
 msgstr ""
 
 #. Type: boolean
 #. Description
-#: ../webapps-common.templates:19
+#: ../webapps-common.templates:2001
 msgid ""
 "If you know that you do want to keep the web server configuration for "
 "${pkg}, or if you want to handle the deconfiguration manually, you should "
@@ -78,25 +78,25 @@
 
 #. Type: boolean
 #. Description
-#: ../webapps-common.templates:19
+#: ../webapps-common.templates:2001
 msgid "Otherwise, you should choose this option."
 msgstr ""
 
 #. Type: select
 #. Choices
-#: ../webapps-common.templates:34
+#: ../webapps-common.templates:3001
 msgid "abort, retry, retry (skip questions)"
 msgstr ""
 
 #. Type: select
 #. Description
-#: ../webapps-common.templates:36
+#: ../webapps-common.templates:3002
 msgid "Error registering ${pkg} with webserver(s).  Retry?"
 msgstr ""
 
 #. Type: select
 #. Description
-#: ../webapps-common.templates:36
+#: ../webapps-common.templates:3002
 msgid ""
 "An error seems to have occurred while registering ${pkg} with one or more of "
 "the web servers on your system.  If it's of any help, this was the error "
@@ -104,35 +104,18 @@
 msgstr ""
 
 #. Type: select
-#. Choices
-#: ../webapps-common.templates:53
-msgid "abort, retry"
-msgstr ""
-
-#. Type: select
 #. Description
-#: ../webapps-common.templates:55
-msgid "Error deconfiguring ${pkg} with webserver(s).  Retry?"
-msgstr ""
-
 #. Type: select
 #. Description
-#: ../webapps-common.templates:55
-msgid ""
-"An error seems to have occurred while unregistering ${pkg} with one or more "
-"of the web servers on your system.  If it's of any help, this was the error "
-"encountered:"
+#: ../webapps-common.templates:3002 ../webapps-common.templates:4002
+msgid "${error}"
 msgstr ""
 
 #. Type: select
 #. Description
-#: ../webapps-common.templates:55
-msgid "${error}"
-msgstr ""
-
 #. Type: select
 #. Description
-#: ../webapps-common.templates:55
+#: ../webapps-common.templates:3002 ../webapps-common.templates:4002
 msgid ""
 "At this point, you have the option to retry or abort the operation. If you "
 "choose \"retry\", you will be prompted with all the configuration questions "
@@ -143,21 +126,42 @@
 "otherwise manually intervene to continue using it."
 msgstr ""
 
+#. Type: select
+#. Choices
+#: ../webapps-common.templates:4001
+msgid "abort, retry"
+msgstr ""
+
+#. Type: select
+#. Description
+#: ../webapps-common.templates:4002
+msgid "Error deconfiguring ${pkg} with webserver(s).  Retry?"
+msgstr ""
+
+#. Type: select
+#. Description
+#: ../webapps-common.templates:4002
+msgid ""
+"An error seems to have occurred while unregistering ${pkg} with one or more "
+"of the web servers on your system.  If it's of any help, this was the error "
+"encountered:"
+msgstr ""
+
 #. Type: multiselect
 #. Choices
-#: ../webapps-common.templates:72
+#: ../webapps-common.templates:5001
 msgid "${httpds}"
 msgstr ""
 
 #. Type: multiselect
 #. Description
-#: ../webapps-common.templates:73
+#: ../webapps-common.templates:5002
 msgid "Please select the webserver(s) to be configured for ${pkg}"
 msgstr ""
 
 #. Type: multiselect
 #. Description
-#: ../webapps-common.templates:73
+#: ../webapps-common.templates:5002
 msgid ""
 "Please note that you may be asked this question again in certain "
 "circumstances, such as if the list of installed webservers change."
@@ -165,25 +169,25 @@
 
 #. Type: string
 #. Description
-#: ../webapps-common.templates:79
+#: ../webapps-common.templates:6001
 msgid "Please enter the name of a new virtualhost."
 msgstr ""
 
 #. Type: select
 #. Choices
-#: ../webapps-common.templates:83
+#: ../webapps-common.templates:7001
 msgid "=global=, new vhost, ${virtualhosts}"
 msgstr ""
 
 #. Type: select
 #. Description
-#: ../webapps-common.templates:84
+#: ../webapps-common.templates:7002
 msgid "Please select a virtualhost with which to configure ${pkg}"
 msgstr ""
 
 #. Type: select
 #. Description
-#: ../webapps-common.templates:84
+#: ../webapps-common.templates:7002
 msgid ""
 "If you want to configure this application for the default site available "
 "from your webserver, you should select \"=global=\".  If you wish to "
@@ -192,14 +196,22 @@
 msgstr ""
 
 #. Type: multiselect
+#. Choices
+#. Type: multiselect
+#. Choices
+#: ../webapps-common.templates:8001 ../webapps-common.templates:9001
+msgid "configure new instance, ${instances}"
+msgstr ""
+
+#. Type: multiselect
 #. Description
-#: ../webapps-common.templates:93
+#: ../webapps-common.templates:8002
 msgid "Please select the instances to configure for ${pkg}"
 msgstr ""
 
 #. Type: multiselect
 #. Description
-#: ../webapps-common.templates:93
+#: ../webapps-common.templates:8002
 msgid ""
 "This application supports multiple simultaneous installations.  You may "
 "configure any number of site/directory combinations by continuing to select "
@@ -207,21 +219,15 @@
 "time by unselecting the given instance."
 msgstr ""
 
-#. Type: multiselect
-#. Choices
-#: ../webapps-common.templates:101
-msgid "configure new instance, ${instances}"
-msgstr ""
-
 #. Type: string
 #. Description
-#: ../webapps-common.templates:105
+#: ../webapps-common.templates:10001
 msgid "Please provide the subdirectory for ${pkg} on ${vhost}"
 msgstr ""
 
 #. Type: string
 #. Description
-#: ../webapps-common.templates:105
+#: ../webapps-common.templates:10001
 msgid ""
 "The subdirectory that you provide will be the directory from which the "
 "application is externally accessed.  You may provide a nested subdirectory "
@@ -232,13 +238,13 @@
 
 #. Type: multiselect
 #. Description
-#: ../webapps-common.templates:115
+#: ../webapps-common.templates:11001
 msgid "Select the web servers to reload."
 msgstr ""
 
 #. Type: multiselect
 #. Description
-#: ../webapps-common.templates:115
+#: ../webapps-common.templates:11001
 msgid ""
 "Due to configuration changes, some of your webservers may need to be "
 "reloaded.  You may de-select servers from the given list if you do not wish "

Modified: webapps-common/trunk/debian/rules
===================================================================
--- webapps-common/trunk/debian/rules	2007-05-13 11:17:03 UTC (rev 110)
+++ webapps-common/trunk/debian/rules	2007-05-14 00:00:35 UTC (rev 111)
@@ -14,7 +14,7 @@
 DOC:=${TMPDIR}/usr/share/doc/webapps-common
 
 # set to no here or in the environment to skip building the documentation
-# builddocs=no
+builddocs=no
 
 configure: configure-stamp
 configure-stamp:

Modified: webapps-common/trunk/dpkg/common
===================================================================
--- webapps-common/trunk/dpkg/common	2007-05-13 11:17:03 UTC (rev 110)
+++ webapps-common/trunk/dpkg/common	2007-05-14 00:00:35 UTC (rev 111)
@@ -503,5 +503,33 @@
 }
 
 ###
+### wc_gen_unique_user: generate a unique user id based on the package
+###                     and a hash of instance name
 ###
+##  usage: gen_unique_user packagename instance
+## XXX syntax for different dbtypes?
 ###
+wc_gen_unique_user(){
+	local u
+	u=`echo $1 | dd bs=1 count=8 2>/dev/null`
+	u="${u}`echo $2 | md5sum | dd bs=1 count=8 2>/dev/null`"
+	echo $u
+}
+
+###
+### wc_gen_unique_db: generate a database id based on the package
+###                     and a hash of instance name
+###
+##  usage: gen_unique_db packagename instance
+## XXX syntax for different dbtypes?
+###
+wc_gen_unique_db(){
+	local d
+	d=`echo $1 | tr -d +-. | dd bs=1 count=12 2>/dev/null`
+	d="${d}`echo $2 | md5sum | dd bs=1 count=16 2>/dev/null`"
+	echo $d
+}
+
+###
+###
+###

Modified: webapps-common/trunk/dpkg/config
===================================================================
--- webapps-common/trunk/dpkg/config	2007-05-13 11:17:03 UTC (rev 110)
+++ webapps-common/trunk/dpkg/config	2007-05-14 00:00:35 UTC (rev 111)
@@ -2,7 +2,7 @@
 # sean finney <seanius at debian.org>
 
 wc_go(){
-	local oldinstances
+	local oldinstances realpackage
 	. /usr/share/webapps-common/dpkg/common
 	_wc_debug "(config) wc_go() $@"
 	wc_config $@
@@ -38,17 +38,23 @@
 	# let's stop here for now.
 	db_go || true
 
-	# no, now let's do the dbconfig-support
-	if [ ! "$wc_multiple_instances" ]; then
-		if [ "$wc_dbapp" ]; then
-			_wc_debug "configuring db support"
+	# now let's do the dbconfig-support
+	if [ "$wc_dbapp" ]; then
+		db_get $wc_package/httpd/instances && instances=$RET
+		_wc_debug "configuring database(s): "
+		for i in `_wc_list_explode "$instances"`; do
+			_wc_debug "  $i"
+			dbc_package=$i
+			dbc_dbuser=`wc_gen_unique_user $wc_package $i`
+			dbc_dbname=`wc_gen_unique_db $wc_package $i`
 			if [ "$wc_dbtype" ]; then
 				. /usr/share/dbconfig-common/dpkg/config.$wc_dbtype
 			else
 				. /usr/share/dbconfig-common/dpkg/config
 			fi
-			dbc_go $@
-		fi
+			_wc_debug dbc_go $i $wc_command $wc_oldversion
+			dbc_go $i $wc_command $wc_oldversion || _wc_debug "hrm, nonzero?"
+		done
 	fi
 }
 

Modified: webapps-common/trunk/dpkg/postinst
===================================================================
--- webapps-common/trunk/dpkg/postinst	2007-05-13 11:17:03 UTC (rev 110)
+++ webapps-common/trunk/dpkg/postinst	2007-05-14 00:00:35 UTC (rev 111)
@@ -57,12 +57,19 @@
 
 wc_postinst_dbapp_support(){
 	if [ "$wc_dbapp" ]; then
-		if [ "$wc_dbtype" ]; then
-			. /usr/share/dbconfig-common/dpkg/postinst.$wc_dbtype
-		else
-			. /usr/share/dbconfig-common/dpkg/postinst
-		fi
-		dbc_go $@
+		_wc_debug "postinst configuring database(s): "
+		instances=`grep -vE '^[[:space:]]*#' "$wc_pkgconfig" | cut -sf1` 2>/dev/null || true	
+		realpackage=$wc_package
+		for i in $instances; do
+			_wc_debug "   $i"
+			if [ "$wc_dbtype" ]; then
+				. /usr/share/dbconfig-common/dpkg/postinst.$wc_dbtype
+			else
+				. /usr/share/dbconfig-common/dpkg/postinst
+			fi
+			_wc_debug dbc_go $i $wc_command $wc_oldversion
+			dbc_go $i $wc_command $wc_oldversion
+		done
 	fi
 }
 

Modified: webapps-common/trunk/dpkg/postrm
===================================================================
--- webapps-common/trunk/dpkg/postrm	2007-05-13 11:17:03 UTC (rev 110)
+++ webapps-common/trunk/dpkg/postrm	2007-05-14 00:00:35 UTC (rev 111)
@@ -13,21 +13,26 @@
 		wc_postrm_disable_app
 	fi
 
-	# actually remove the files only in purge
-	if [ "$wc_command" = "purge" ]; then
-		wc_postrm_purge_app
-	fi
-
-	if [ ! "$wc_multiple_instances" ]; then
-		if [ "$wc_dbapp" ]; then
+	# run the dbconig support here, before we delete the files we
+	# need to run the dbconfig support
+	if [ "$wc_dbapp" ]; then
+		_wc_debug "postrm deconfiguring database(s): "
+		instances=`grep -vE '^[[:space:]]*#' "$wc_pkgconfig" | cut -sf1` 2>/dev/null || true
+		for i in $instances; do
+			_wc_debug "   $i"
 			if [ "$wc_dbtype" ]; then
 				. /usr/share/dbconfig-common/dpkg/postrm.$wc_dbtype
 			else
 				. /usr/share/dbconfig-common/dpkg/postrm
 			fi
-			dbc_go $@
-		fi
+			dbc_go $i $wc_command $wc_oldversion
+		done
 	fi
+
+	# actually remove the files only in purge
+	if [ "$wc_command" = "purge" ]; then
+		wc_postrm_purge_app
+	fi
 }
 
 wc_postrm_disable_app(){

Modified: webapps-common/trunk/dpkg/prerm
===================================================================
--- webapps-common/trunk/dpkg/prerm	2007-05-13 11:17:03 UTC (rev 110)
+++ webapps-common/trunk/dpkg/prerm	2007-05-14 00:00:35 UTC (rev 111)
@@ -1,18 +1,24 @@
 # prerm hook for webapps-common
 
 wc_go(){
+	local instances realpackage
 	. /usr/share/webapps-common/dpkg/common
     _wc_debug "(prerm) wc_go() $@"
-	# wc_config $@
+	wc_config $@
 
-	if [ ! "$wc_multiple_instances" ]; then
+	if [ "$wc_command" = "remove" ]; then
 		if [ "$wc_dbapp" ]; then
-			if [ "$wc_dbtype" ]; then
-				. /usr/share/dbconfig-common/dpkg/prerm.$wc_dbtype
-			else
-				. /usr/share/dbconfig-common/dpkg/prerm
-			fi
-			dbc_go $@
+			_wc_debug "deconfiguring database(s): "
+			instances=`grep -vE '^[[:space:]]*#' "$wc_pkgconfig" | cut -sf1` 2>/dev/null || true
+			for i in $instances; do
+				_wc_debug "   $i"
+				if [ "$wc_dbtype" ]; then
+					. /usr/share/dbconfig-common/dpkg/prerm.$wc_dbtype
+				else
+					. /usr/share/dbconfig-common/dpkg/prerm
+				fi
+				dbc_go $i $wc_command $wc_oldversion
+			done
 		fi
 	fi
 }

Modified: webapps-common/trunk/examples/webapp-apache-dbapp-example/debian/config
===================================================================
--- webapps-common/trunk/examples/webapp-apache-dbapp-example/debian/config	2007-05-13 11:17:03 UTC (rev 110)
+++ webapps-common/trunk/examples/webapp-apache-dbapp-example/debian/config	2007-05-14 00:00:35 UTC (rev 111)
@@ -6,4 +6,5 @@
 . /usr/share/webapps-common/dpkg/config
 wc_dbapp="yes"
 wc_dbtype="mysql"
+wc_multiple_instances="yes"
 wc_go webapp-apache-dbapp-example $@




More information about the Webapps-common-discuss mailing list