From: Mike O'Connor Date: Wed, 28 Jan 2009 02:09:57 +0000 (-0500) Subject: Merge branch 'content_generation' of http://kernel.ubuntu.com/~mcasadevall/dak into... X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;h=f71ac27c75a8ab5185508491e97bc6f237772aa6;p=dak.git Merge branch 'content_generation' of http://kernel.ubuntu.com/~mcasadevall/dak into content_generation Conflicts: dak/dakdb/update2.py dak/update_db.py This updates the "required_schema" to 4, moving mcasadevall's update2 to update4 Signed-off-by: Mike O'Connor --- f71ac27c75a8ab5185508491e97bc6f237772aa6 diff --cc dak/dakdb/update2.py index 20154b07,ec9650b1..0cf747e9 mode 100755,100644..100755 --- a/dak/dakdb/update2.py +++ b/dak/dakdb/update2.py @@@ -26,11 -29,7 +26,13 @@@ import psycopg2, tim ################################################################################ def do_update(self): - print "Adding content fields to database" ++vvvvvvvvvvvvvvvvvvvv + print "Note: to be able to enable the the PL/Perl (plperl) procedural language, we do" + print "need postgresql-plperl-$postgres-version installed. Make sure that this is the" + print "case before you continue. Interrupt if it isn't, sleeping 5 seconds now." + print "(We need to be database superuser for this to work!)" + time.sleep (5) ++^^^^^^^^^^^^^^^^^^^^ try: c = self.db.cursor() diff --cc dak/dakdb/update4.py index 00000000,00000000..31160766 new file mode 100644 --- /dev/null +++ b/dak/dakdb/update4.py @@@ -1,0 -1,0 +1,86 @@@ ++#!/usr/bin/env python ++# coding=utf8 ++ ++""" ++Debian Archive Kit Database Update Script ++Copyright © 2008 Michael Casadevall ++Copyright © 2008 Roger Leigh ++ ++Debian Archive Kit Database Update Script 2 ++""" ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 2 of the License, or ++# (at your option) any later version. ++ ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++ ++# You should have received a copy of the GNU General Public License ++# along with this program; if not, write to the Free Software ++# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ ++################################################################################ ++ ++# really, if we want to screw ourselves, let's find a better way. ++# rm -rf /srv/ftp.debian.org ++ ++################################################################################ ++ ++import psycopg2, time ++ ++################################################################################ ++ ++def do_update(self): ++ print "Adding content fields to database" ++ ++ try: ++ c = self.db.cursor() ++ c.execute("""CREATE TABLE content_file_paths ( ++ id serial primary key not null, ++ path text unique not null ++ )""") ++ ++ c.execute("""CREATE TABLE content_file_names ( ++ id serial primary key not null, ++ file text unique not null ++ )""") ++ ++ c.execute("""CREATE TABLE content_associations ( ++ id serial not null, ++ binary_pkg int4 not null references binaries(id) on delete cascade, ++ filepath int4 not null references content_file_paths(id) on delete cascade, ++ filename int4 not null references content_file_names(id) on delete cascade ++ );""") ++ ++ c.execute("""CREATE FUNCTION comma_concat(text, text) RETURNS text ++ AS $_$select case ++ WHEN $2 is null or $2 = '' THEN $1 ++ WHEN $1 is null or $1 = '' THEN $2 ++ ELSE $1 || ',' || $2 ++ END$_$ ++ LANGUAGE sql""") ++ ++ c.execute("""CREATE AGGREGATE comma_separated_list ( ++ BASETYPE = text, ++ SFUNC = comma_concat, ++ STYPE = text, ++ INITCOND = '' ++ );""") ++ ++ c.execute("UPDATE config SET value = '2' WHERE name = 'db_revision'") ++ self.db.commit() ++ ++ print "REMINDER: Remember to fully regenerate the Contents files before running import-contents" ++ print "" ++ print "Pausing for five seconds ..." ++ time.sleep (5) ++ ++ except psycopg2.ProgrammingError, msg: ++ self.db.rollback() ++ print "FATAL: Unable to apply debversion table update 2!" ++ print "Error Message: " + str(msg) ++ print "Database changes have been rolled back." diff --cc dak/update_db.py index 6db74d9d,7d89e6bf..ee1e50f8 --- a/dak/update_db.py +++ b/dak/update_db.py @@@ -36,7 -36,7 +36,7 @@@ from daklib import util Cnf = None projectB = None - required_database_schema = 3 -required_database_schema = 2 ++required_database_schema = 4 ################################################################################