[Dbconfig-common-changes] [dbconfig-common] r276 - in trunk: . debian dpkg examples/db-test-pgsql-migration-1.9/debian examples/db-test-pgsql-migration-2.0/debian

Sean Finney seanius at costa.debian.org
Wed Aug 2 01:31:53 CEST 2006


Author: seanius
Date: 2006-08-01 23:31:51 +0000 (Tue, 01 Aug 2006)
New Revision: 276

Modified:
   trunk/dbconfig-load-include
   trunk/debian/changelog
   trunk/debian/rules
   trunk/dpkg/config
   trunk/examples/db-test-pgsql-migration-1.9/debian/dirs
   trunk/examples/db-test-pgsql-migration-1.9/debian/rules
   trunk/examples/db-test-pgsql-migration-2.0/debian/config
   trunk/examples/db-test-pgsql-migration-2.0/debian/dirs
   trunk/examples/db-test-pgsql-migration-2.0/debian/postinst
   trunk/examples/db-test-pgsql-migration-2.0/debian/rules
Log:
- fix to ?\209?\149h format include parsing in dbconfig-load-include
- fixes to include loading in general
- more work on the "migration" example packages


Modified: trunk/dbconfig-load-include
===================================================================
--- trunk/dbconfig-load-include	2006-08-01 20:20:31 UTC (rev 275)
+++ trunk/dbconfig-load-include	2006-08-01 23:31:51 UTC (rev 276)
@@ -155,17 +155,26 @@
 
 case $format in
 sh)
-	. $inputfile
-	[ "$use_dbuser" ] && cat << EOF
-$dbuser_varname='$dbc_dbuser'
+	cat << EOF | sh
+. $inputfile
+use_dbuser="$use_dbuser";
+use_dbpass="$use_dbpass";
+use_dbname="$use_dbname";
+use_dbserver="$use_dbserver";
+use_dbport="$use_dbport";
+use_dbtype="$use_dbtype";
+
+[ "$use_dbuser" ] && cat << FOO
+dbc_dbuser='\$$dbuser_varname'
+FOO
+[ "$use_dbpass" ] && cat << FOO
+dbc_dbpass='\$$dbpass_varname'
+FOO
+	[ "$use_dbname" ] && echo "dbc_dbname='\$$dbname_varname'"
+	[ "$use_dbserver" ] && echo "dbc_dbserver='\$$dbserver_varname'"
+	[ "$use_dbport" ] && echo "dbc_dbport='\$$dbport_varname'"
+	[ "$use_dbtype" ] && echo "dbc_dbtype='\$$dbtype_varname'"
 EOF
-	[ "$use_dbpass" ] && cat << EOF
-$dbpass_varname='$dbc_dbpass'
-EOF
-	[ "$use_dbname" ] && echo "$dbname_varname='$dbc_dbname'"
-	[ "$use_dbserver" ] && echo "$dbserver_varname='$dbc_dbserver'"
-	[ "$use_dbport" ] && echo "$dbport_varname='$dbc_dbport'"
-	[ "$use_dbtype" ] && echo "$dbtype_varname='$dbc_dbtype'"
 ;;
 
 php)

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog	2006-08-01 20:20:31 UTC (rev 275)
+++ trunk/debian/changelog	2006-08-01 23:31:51 UTC (rev 276)
@@ -14,6 +14,9 @@
   * updated danish debconf translations from Claus Hindsgaul, thanks.
     closes: #378769
   * fixed/improved pgsql authentication method autodetection.
+  * new db-test-pgsql-migration-{1.9,2.0} packages to both show and
+    test how to migrate from previous non-dbc packaging.
+  * fix for sh-format include files from dbconfig-load-include.
 
   [ Bart Cornelis (cobaco) ]
   * Updated Dutch translation

Modified: trunk/debian/rules
===================================================================
--- trunk/debian/rules	2006-08-01 20:20:31 UTC (rev 275)
+++ trunk/debian/rules	2006-08-01 23:31:51 UTC (rev 276)
@@ -20,7 +20,7 @@
 
 
 build: build-stamp
-	make -C doc
+	if test -z "$$dbc_debug"; then make -C doc; fi
 
 build-stamp: configure-stamp 
 	dh_testdir
@@ -39,7 +39,7 @@
 	dh_testroot
 	dh_clean -k 
 	dh_installdirs
-	dh_installdocs
+	if test -z "$$dbc_debug"; then dh_installdocs; fi
 	debian/credit-xlators > ${DOC}/TRANSLATORS
 	install -m 644 AFL debian/dbconfig-common/usr/share/doc/dbconfig-common/
 	mkdir -p debian/dbconfig-common/etc/dbconfig-common

Modified: trunk/dpkg/config
===================================================================
--- trunk/dpkg/config	2006-08-01 20:20:31 UTC (rev 275)
+++ trunk/dpkg/config	2006-08-01 23:31:51 UTC (rev 276)
@@ -3,7 +3,7 @@
 ###
 
 dbc_go(){
-	local f db happy default_dbtype host newhost port oldhosts authmethod_admin do_config _preconf_list _s _t STATEiformat ifile install_question
+	local f db happy default_dbtype host newhost port oldhosts authmethod_admin do_config _preconf_list _s _t STATE iformat ifile install_question
 	. /usr/share/dbconfig-common/dpkg/common
 	dbc_debug "(config) dbc_go() $@"
 
@@ -57,25 +57,40 @@
 		##
 		## start new dbc upgrade section
 		##
+		# if there is a previously existing version already installed
+		# *and* the maintainer has provided the first version that used
+		# dbconfig-common *and*  this version is newer than the
+		# previously installed version... do the dbc import stuff.
+		if [ "$dbc_oldversion" ] && [ "$dbc_first_version" ] && \
+           dpkg --compare-versions "$dbc_first_version" gt "$dbc_oldversion"; 
+           then
 
-		# if dbc_load_include is set but the file doesn't exist
-		# then let's silently exit because that would imply
-		# we're running before the file is from the latest
-		# version of the package which has not yet been unpacked
-		if [ "$dbc_load_include" ]; then
-			iformat=`echo $dbc_load_include | cut -d: -f1`
-			ifile=`echo $dbc_load_include | cut -d: -f2-`
-		fi
+			# if dbc_load_include is set, determine the format
+			# and location of the old config file
+			if [ "$dbc_load_include" ]; then
+				iformat=`echo $dbc_load_include | cut -d: -f1`
+				ifile=`echo $dbc_load_include | cut -d: -f2-`
+			fi
 
-		if dpkg --compare-versions "$dbc_first_version" gt "$dbc_oldversion"; then
 			##
 			## if they want to import settings from a previous 
 			## non-dbc version, do that and mark the questions
 			## skipped 
 			##
-			if [ "$dbc_load_include" ] && [ -f "$ifile" ]; then
+			if [ "$ifile" ] && [ -f "$ifile" ]; then
 				db_input high $dbc_package/import-oldsettings || true
+				dbc_logpart "migrating old settings into dbconfig-common: "
+				if [ "$dbc_debug" ]; then
+					dbc_debug "dbconfig-load-include $dbc_load_include_args -f $iformat $ifile"
+					dbconfig-load-include $dbc_load_include_args -f $iformat $ifile
+				fi
 				eval `dbconfig-load-include $dbc_load_include_args -f $iformat $ifile`
+				# if the dbtype is hardcoded, reset it no matter what
+				# dbconfig-load-include tells us
+				if [ "$dbc_hardcoded_dbtype" ]; then 
+					dbc_dbtype="$dbc_hardcoded_dbtype"
+				fi
+				
 				for f in database-type $dbc_dbtype/method db/dbname; do
 					db_fset $dbc_package/$f seen true || true
 				done
@@ -97,6 +112,8 @@
 
 				db_set $dbc_package/database-type $dbc_dbtype
 				db_set $dbc_package/db/dbname "$dbc_dbname"
+
+				dbc_logline "done"
 			fi
 		fi
 

Modified: trunk/examples/db-test-pgsql-migration-1.9/debian/dirs
===================================================================
--- trunk/examples/db-test-pgsql-migration-1.9/debian/dirs	2006-08-01 20:20:31 UTC (rev 275)
+++ trunk/examples/db-test-pgsql-migration-1.9/debian/dirs	2006-08-01 23:31:51 UTC (rev 276)
@@ -1,3 +1,4 @@
+etc/db-test-pgsql-migration
 usr/share/db-test-pgsql-migration
 usr/share/dbconfig-common/data/db-test-pgsql-migration/install
 usr/share/dbconfig-common/data/db-test-pgsql-migration/upgrade/pgsql

Modified: trunk/examples/db-test-pgsql-migration-1.9/debian/rules
===================================================================
--- trunk/examples/db-test-pgsql-migration-1.9/debian/rules	2006-08-01 20:20:31 UTC (rev 275)
+++ trunk/examples/db-test-pgsql-migration-1.9/debian/rules	2006-08-01 23:31:51 UTC (rev 276)
@@ -39,7 +39,7 @@
 	dh_clean -k
 	dh_installdirs
 	# this is our "previous" config file: 
-	cp oldconf.conf /etc/db-test-pgsql-migration/db.conf
+	cp oldconf.conf debian/db-test-pgsql-migration/etc/db-test-pgsql-migration/db.conf
 
 # Build architecture-independent files here.
 binary-indep: build install

Modified: trunk/examples/db-test-pgsql-migration-2.0/debian/config
===================================================================
--- trunk/examples/db-test-pgsql-migration-2.0/debian/config	2006-08-01 20:20:31 UTC (rev 275)
+++ trunk/examples/db-test-pgsql-migration-2.0/debian/config	2006-08-01 23:31:51 UTC (rev 276)
@@ -6,5 +6,8 @@
 . /usr/share/debconf/confmodule
 . /usr/share/dbconfig-common/dpkg/config.pgsql 
 
-#dbc_authmethod_user="password"
+# the previous version (1.9) didn't use dbconfig-common.  this is
+# how we accomodate users who already have this old version installed:
+dbc_first_version="2.0"
+dbc_load_include="sh:/etc/db-test-pgsql-migration/db.conf"
 dbc_go db-test-pgsql-migration $@

Modified: trunk/examples/db-test-pgsql-migration-2.0/debian/dirs
===================================================================
--- trunk/examples/db-test-pgsql-migration-2.0/debian/dirs	2006-08-01 20:20:31 UTC (rev 275)
+++ trunk/examples/db-test-pgsql-migration-2.0/debian/dirs	2006-08-01 23:31:51 UTC (rev 276)
@@ -1,3 +1,4 @@
-usr/share/db-test-pgsql
+etc/db-test-pgsql-migration
+usr/share/db-test-pgsql-migration
 usr/share/dbconfig-common/data/db-test-pgsql-migration/install
 usr/share/dbconfig-common/data/db-test-pgsql-migration/upgrade/pgsql

Modified: trunk/examples/db-test-pgsql-migration-2.0/debian/postinst
===================================================================
--- trunk/examples/db-test-pgsql-migration-2.0/debian/postinst	2006-08-01 20:20:31 UTC (rev 275)
+++ trunk/examples/db-test-pgsql-migration-2.0/debian/postinst	2006-08-01 23:31:51 UTC (rev 276)
@@ -6,8 +6,10 @@
 . /usr/share/debconf/confmodule
 . /usr/share/dbconfig-common/dpkg/postinst.pgsql 
 
-# you can set the default database encoding to something else
-dbc_pgsql_createdb_encoding="UTF8"
+# the previous version (1.9) didn't use dbconfig-common.  this is
+# how we accomodate users who already have this old version installed:
+dbc_first_version="2.0"
+dbc_generate_include="sh:/etc/db-test-pgsql-migration/db.new.conf"
 dbc_go db-test-pgsql-migration $@
 
 #DEBHELPER#

Modified: trunk/examples/db-test-pgsql-migration-2.0/debian/rules
===================================================================
--- trunk/examples/db-test-pgsql-migration-2.0/debian/rules	2006-08-01 20:20:31 UTC (rev 275)
+++ trunk/examples/db-test-pgsql-migration-2.0/debian/rules	2006-08-01 23:31:51 UTC (rev 276)
@@ -41,7 +41,7 @@
 	#
 	# db-test-pgsql-migration needs the sql skeleton here:
 	#
-	cp pgsql.sql debian/db-test-pgsql-migration/usr/share/dbconfig-common/data/db-test-pgsql/install/pgsql
+	cp pgsql.sql debian/db-test-pgsql-migration/usr/share/dbconfig-common/data/db-test-pgsql-migration/install/pgsql
 
 # Build architecture-independent files here.
 binary-indep: build install




More information about the Dbconfig-common-changes mailing list