[pkg-bacula-commits] [bacula] 03/03: renamed install-dbconfig-upgrade to install-dbconfig overwriting the old perl script

Carsten Leonhardt leo at moszumanska.debian.org
Fri Jul 15 15:41:25 UTC 2016


This is an automated email from the git hooks/post-receive script.

leo pushed a commit to branch master
in repository bacula.

commit 8b64473218bc02e6788a5d503d10b33b406a4dff
Author: Carsten Leonhardt <leo at debian.org>
Date:   Fri Jul 15 11:43:08 2016 +0200

    renamed install-dbconfig-upgrade to install-dbconfig
    overwriting the old perl script
---
 debian/rules                            |   4 +-
 debian/scripts/install-dbconfig         | 180 ++++++++++++++++++--------------
 debian/scripts/install-dbconfig-upgrade | 110 -------------------
 3 files changed, 104 insertions(+), 190 deletions(-)

diff --git a/debian/rules b/debian/rules
index 2277126..fbcbae2 100755
--- a/debian/rules
+++ b/debian/rules
@@ -117,8 +117,8 @@ override_dh_installinit-arch:
 override_dh_install-arch:
 	dh_install -a
 	######### dbconfig-common stuff
-	# The script install-dbconfig-upgrade needs to be adapted when upstream changes the database format!
-	debian/scripts/install-dbconfig-upgrade # handles install of all upgrade/install scripts to db version 11 and greater
+	# The script install-dbconfig needs to be adapted when upstream changes the database format!
+	debian/scripts/install-dbconfig # handles install of all upgrade/install scripts to db version 11 and greater
 	# fix database type in some scripts
 	$(foreach db,$(VARIANTS),sed -i \
 	  -e "s/XX_DB_XX/$(db)/" \
diff --git a/debian/scripts/install-dbconfig b/debian/scripts/install-dbconfig
index 1bca1ea..539c81b 100755
--- a/debian/scripts/install-dbconfig
+++ b/debian/scripts/install-dbconfig
@@ -1,86 +1,110 @@
-#!/usr/bin/perl
-
-# Script to install files used by dbconfig-common to install and upgrade
-# databases
-# (c) 2011 Debian project, Jan Hauke Rahm <jhr at debian.org>
-# Based on make macros written by John Goerzen
-
-# Arguments needed:
-# 1: database type (sqlite3, mysql, pgsql)
-# 2: package version
-# 3: bacula database version to support
-#
-# There are three ways to call this script:
-# 1) ./script db-type
-# 2) ./script db-type version
-# 3) ./script db-type version bacula-db
-#
-# The first will install the SQL stuff needed to create the database during
-# package installations. The second will install the SQL stuff needed to
-# upgrade to the latest version of the bacula-db. The third will install
-# additional SQL upgrade stuff if we skipped a bacula db version in Debian.
-#
-# Example: lenny had package version 2.4.4 with bacula db version 10, squeeze has
-#          package version 5.0.0 with bacula db version 12.
-#          Always needed is the installation stuff:
-#    ./script db-type
-#          Then we need to migrate the db from 10 (2.4.4) to 11 (3.0.0)
-#    ./script db-type 3.0.0 11
-#          Finally we need to migrate from 11 to 12 (3.0.0 to 5.0.0) which
-#          upstream ships as "latest upgrade"
-#    ./script db-type 5.0.0
-
-use strict;
-use File::Path "make_path";
-
-my $DBC = "usr/share/dbconfig-common/data";
-
-my $db		= $ARGV[0];
-my $pkgver	= $ARGV[1];
-my $dbver	= $ARGV[2];
-
-my $longdb	= $db;
-$longdb = ($db eq "pgsql") ? "postgresql" : $db;
-
-if (@ARGV == 1) {
-	install($db);
-} elsif (@ARGV == 2) {
-	latest($db, $pkgver);
-} elsif (@ARGV == 3) {
-	update($db, $pkgver, $dbver);
-} else {
-	exit 1;
-}
+#!/bin/sh
 
-sub install {
-	make_path("debian/bacula-director-$db/$DBC/bacula-director-$db/install");
-	extract_here("src/cats/make_".$longdb."_tables", "debian/bacula-director-$db/$DBC/bacula-director-$db/install/$db");
-}
+# this script creates the files needed by dbc for database creation
+# and updates.
 
-sub latest {
-	make_path("debian/bacula-director-$db/$DBC/bacula-director-$db/upgrade/$db");
-	extract_here("src/cats/update_".$longdb."_tables", "debian/bacula-director-$db/$DBC/bacula-director-$db/upgrade/$db/$pkgver");
-}
+# this script needs to be augmented whenever there is a new database update,
+# in particular "lastdbversion" and the case statements need to be reviewed.
 
-sub update {
-	my $path = ($dbver - 1) . "_to_" . $dbver;
 
-	make_path("debian/bacula-director-$db/$DBC/bacula-director-$db/upgrade/$db");
-	extract_here("updatedb/update_".$longdb."_tables_$path", "debian/bacula-director-$db/$DBC/bacula-director-$db/upgrade/$db/$pkgver");
-}
+# (C) 2016 Carsten Leonhardt <leo at debian.org>
+
+# License: expat
+
+# Permission is hereby granted, free of charge, to any person
+# obtaining a copy of this software and associated documentation files
+# (the "Software"), to deal in the Software without restriction,
+# including without limitation the rights to use, copy, modify, merge,
+# publish, distribute, sublicense, and/or sell copies of the Software,
+# and to permit persons to whom the Software is furnished to do so,
+# subject to the following conditions:
 
-sub extract_here {
-	my $input = shift;
-	my $output = shift;
+#     The above copyright notice and this permission notice shall be
+#     included in all copies or substantial portions of the Software.
 
-	my $found = 0;
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
 
-	open (INPUT, '<', $input);
-	open (OUTPUT, '>', $output);
-	while (<INPUT>) {
-		if (m/END.OF.DATA/ && !$found) {$found = 1; next;};
-		last if (m/END.OF.DATA/);
-		print OUTPUT $_ if $found;
-	}
-	close (INPUT);
+# first and last target database version covered by this script
+dbtarget=11
+lastdbversion=15
+
+variants="mysql pgsql sqlite3"
+
+dbc="usr/share/dbconfig-common/data"
+extractor="debian/scripts/extract-dbupgrade.awk"
+
+set_longdb() {
+    if [ $db = pgsql ] ; then
+	longdb=postgresql
+    else
+	longdb=$db
+    fi
 }
+
+# handle older db upgrades
+while [ $dbtarget -le 12 ]; do
+    for db in $variants; do
+	set_longdb
+
+	case $dbtarget in
+	    11)	baculaversion="3.0.0"
+		sourcefile="updatedb/update_"$longdb"_tables_10_to_11"
+		;;
+	    12)	baculaversion="5.0.0"
+		sourcefile="updatedb/update_"$longdb"_tables_11_to_12"
+		;;
+	esac
+
+	targetfile="debian/bacula-director-"$db"/"$dbc"/bacula-director-"$db"/upgrade/"$db"/"$baculaversion;
+
+	mkdir -p `dirname $targetfile`
+	awk -v version=ignore -f $extractor $sourcefile >> $targetfile
+    done
+
+    dbtarget=$((dbtarget + 1))
+done
+
+# handle newer db upgrades
+while [ $dbtarget -le $lastdbversion ]; do
+    for db in $variants; do
+	set_longdb
+
+	case $dbtarget in
+	    13)	baculaversion="5.2.0"
+		;;
+	    14)	baculaversion="5.2.0"
+		;;
+	    15)	baculaversion="7.2.0"
+		;;
+	    *)	echo "$0: Unknown database target version"
+		exit 1
+		;;
+	esac
+
+	sourcefile="src/cats/update_"$longdb"_tables"
+	targetfile="debian/bacula-director-"$db"/"$dbc"/bacula-director-"$db"/upgrade/"$db"/"$baculaversion;
+
+	mkdir -p `dirname $targetfile`
+	awk -v version=$dbtarget -f $extractor $sourcefile >> $targetfile
+    done
+
+    dbtarget=$((dbtarget + 1))
+done
+
+# handle db creation
+for db in $variants; do
+    set_longdb
+
+    sourcefile="src/cats/make_"$longdb"_tables"
+    targetfile="debian/bacula-director-"$db"/"$dbc"/bacula-director-"$db"/install/"$db;
+
+    mkdir -p `dirname $targetfile`
+    awk -v version=ignore -f $extractor $sourcefile >> $targetfile
+done
diff --git a/debian/scripts/install-dbconfig-upgrade b/debian/scripts/install-dbconfig-upgrade
deleted file mode 100755
index 539c81b..0000000
--- a/debian/scripts/install-dbconfig-upgrade
+++ /dev/null
@@ -1,110 +0,0 @@
-#!/bin/sh
-
-# this script creates the files needed by dbc for database creation
-# and updates.
-
-# this script needs to be augmented whenever there is a new database update,
-# in particular "lastdbversion" and the case statements need to be reviewed.
-
-
-# (C) 2016 Carsten Leonhardt <leo at debian.org>
-
-# License: expat
-
-# Permission is hereby granted, free of charge, to any person
-# obtaining a copy of this software and associated documentation files
-# (the "Software"), to deal in the Software without restriction,
-# including without limitation the rights to use, copy, modify, merge,
-# publish, distribute, sublicense, and/or sell copies of the Software,
-# and to permit persons to whom the Software is furnished to do so,
-# subject to the following conditions:
-
-#     The above copyright notice and this permission notice shall be
-#     included in all copies or substantial portions of the Software.
-
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-# SOFTWARE.
-
-# first and last target database version covered by this script
-dbtarget=11
-lastdbversion=15
-
-variants="mysql pgsql sqlite3"
-
-dbc="usr/share/dbconfig-common/data"
-extractor="debian/scripts/extract-dbupgrade.awk"
-
-set_longdb() {
-    if [ $db = pgsql ] ; then
-	longdb=postgresql
-    else
-	longdb=$db
-    fi
-}
-
-# handle older db upgrades
-while [ $dbtarget -le 12 ]; do
-    for db in $variants; do
-	set_longdb
-
-	case $dbtarget in
-	    11)	baculaversion="3.0.0"
-		sourcefile="updatedb/update_"$longdb"_tables_10_to_11"
-		;;
-	    12)	baculaversion="5.0.0"
-		sourcefile="updatedb/update_"$longdb"_tables_11_to_12"
-		;;
-	esac
-
-	targetfile="debian/bacula-director-"$db"/"$dbc"/bacula-director-"$db"/upgrade/"$db"/"$baculaversion;
-
-	mkdir -p `dirname $targetfile`
-	awk -v version=ignore -f $extractor $sourcefile >> $targetfile
-    done
-
-    dbtarget=$((dbtarget + 1))
-done
-
-# handle newer db upgrades
-while [ $dbtarget -le $lastdbversion ]; do
-    for db in $variants; do
-	set_longdb
-
-	case $dbtarget in
-	    13)	baculaversion="5.2.0"
-		;;
-	    14)	baculaversion="5.2.0"
-		;;
-	    15)	baculaversion="7.2.0"
-		;;
-	    *)	echo "$0: Unknown database target version"
-		exit 1
-		;;
-	esac
-
-	sourcefile="src/cats/update_"$longdb"_tables"
-	targetfile="debian/bacula-director-"$db"/"$dbc"/bacula-director-"$db"/upgrade/"$db"/"$baculaversion;
-
-	mkdir -p `dirname $targetfile`
-	awk -v version=$dbtarget -f $extractor $sourcefile >> $targetfile
-    done
-
-    dbtarget=$((dbtarget + 1))
-done
-
-# handle db creation
-for db in $variants; do
-    set_longdb
-
-    sourcefile="src/cats/make_"$longdb"_tables"
-    targetfile="debian/bacula-director-"$db"/"$dbc"/bacula-director-"$db"/install/"$db;
-
-    mkdir -p `dirname $targetfile`
-    awk -v version=ignore -f $extractor $sourcefile >> $targetfile
-done

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-bacula/bacula.git



More information about the pkg-bacula-commits mailing list