
theory at bricolage
Apr 29, 2008, 7:27 PM
Post #1 of 1
(85 views)
Permalink
|
|
[8206] Got `make uninstall` working again.
|
|
Revision: 8206 Author: theory Date: 2008-04-29 19:27:26 -0700 (Tue, 29 Apr 2008) ViewCVS: http://viewsvn.bricolage.cc/?rev=8206&view=rev Log Message: ----------- Got `make uninstall` working again. Modified Paths: -------------- bricolage/trunk/inst/db_uninst_mysql.pl bricolage/trunk/inst/db_uninstall.pl bricolage/trunk/inst/uninstall.pl Modified: bricolage/trunk/inst/db_uninst_mysql.pl =================================================================== --- bricolage/trunk/inst/db_uninst_mysql.pl 2008-04-30 02:21:39 UTC (rev 8205) +++ bricolage/trunk/inst/db_uninst_mysql.pl 2008-04-30 02:27:26 UTC (rev 8206) @@ -6,7 +6,7 @@ =head1 DESCRIPTION -This script is called during C<make uninstall> to uninstall the +This script is called during C<make uninstall> to uninstall the MySQL Bricolage database. =head1 AUTHOR @@ -22,10 +22,10 @@ =cut use strict; +use File::Spec::Functions qw(:ALL); use FindBin; use lib "$FindBin::Bin/lib"; -use File::Spec::Functions qw(:ALL); -use File::Find qw(find); +use Bric::Inst qw(:all); use DBI; print "\n\n==> Deleting Bricolage MySQL Database <==\n\n"; @@ -40,7 +40,6 @@ open STDERR, "| $perl -ne 'print unless /^NOTICE: /'" or die "Cannot pipe STDERR: $!\n"; - # setup database and user while connected to dummy template1 my $dbh = db_connect(); drop_db($dbh); @@ -53,7 +52,7 @@ sub db_connect { my $dsn = "dbi:mysql:database=$DB->{db_name}"; $dsn .= ";host:$DB->{host_name}" if ( $DB->{host_name} ne "localhost" and $DB->{host_name} ne ""); - $dsn .= ";port:$DB->{host_port}" if ( $DB->{host_port} ne "" ); + $dsn .= ";port:$DB->{host_port}" if ( $DB->{host_port} ne "" ); my $dbh = DBI->connect($dsn,$DB->{root_user}, $DB->{root_pass}); hard_fail("Unable to connect to MySQL using supplied root username ", "and password: ", DBI->errstr, "\n") @@ -62,10 +61,9 @@ return $dbh; } -# create the database, optionally dropping an existing database +# drop the database. sub drop_db { my $dbh = shift; - if (ask_yesno("Drop database \"$DB->{db_name}\"?", 0)) { unless ($dbh->do("DROP DATABASE $DB->{db_name}")) { hard_fail("Failed to drop database. The error from MySQL was:\n\n", @@ -75,7 +73,7 @@ } } -# create SYS_USER, optionally dropping an existing syst +# drop SYS_USER. sub drop_user { my $dbh = shift; Modified: bricolage/trunk/inst/db_uninstall.pl =================================================================== --- bricolage/trunk/inst/db_uninstall.pl 2008-04-30 02:21:39 UTC (rev 8205) +++ bricolage/trunk/inst/db_uninstall.pl 2008-04-30 02:27:26 UTC (rev 8206) @@ -6,7 +6,7 @@ =head1 DESCRIPTION -This script is called during C<make uninstall> to launch the apropriate +This script is called during C<make uninstall> to launch the apropriate uninstall Bricolage database script. =head1 AUTHOR @@ -22,22 +22,9 @@ =cut use strict; -use FindBin; -use lib "$FindBin::Bin/lib"; -use Bric::Inst qw(:all); use File::Spec::Functions qw(:ALL); -use File::Find qw(find); +my $DB = do './database.db' or die "Failed to read database.db : $!"; -print "\n\n==> Deleting Bricolage Database <==\n\n"; - -our $DB; -do "./database.db" or die "Failed to read database.db : $!"; - -my $uninstdb; -$uninstdb = "./inst/db_uninst_$DB->{db_type}.pl"; -do $uninstdb or die "Failed to launch $DB->{db_type} database loading script ($uninstdb)"; - -exit 0; - - +my $uninstdb = "./inst/db_uninst_$DB->{db_type}.pl"; +do $uninstdb or die "Failed to launch $DB->{db_type} database loading script ($uninstdb)"; Modified: bricolage/trunk/inst/uninstall.pl =================================================================== --- bricolage/trunk/inst/uninstall.pl 2008-04-30 02:21:39 UTC (rev 8205) +++ bricolage/trunk/inst/uninstall.pl 2008-04-30 02:27:26 UTC (rev 8206) @@ -79,16 +79,18 @@ # (XXX: config.db and upgrade.db must be output for stop.pl to work as is) sub output_dbs { # fake up the .dbs from %INSTALL - my %dbs = ( PG => "postgres.db", - CONFIG => "config.db" ); + my %dbs = ( + DB => 'database.db', + CONFIG => 'config.db', + ); while ( my ($key, $file) = each %dbs) { - open(FILE, ">$file") or die "Unable to open $file : $!"; - print FILE Data::Dumper->Dump([$INSTALL->{$key}], [$key]); - close(FILE); + open(FILE, ">$file") or die "Unable to open $file : $!\n"; + print FILE Data::Dumper->Dump([$INSTALL->{$key}], [$key]); + close(FILE); } # output upgrade.db - open(FILE, ">upgrade.db") or die "Unable to open upgrade.db : $!"; - print FILE Data::Dumper->Dump([\%UPGRADE], ["UPGRADE"]); + open(FILE, '>upgrade.db') or die "Unable to open upgrade.db : $!\n"; + print FILE Data::Dumper->Dump([\%UPGRADE], ['UPGRADE']); close(FILE); }
|