add suite SUITE, version VERSION. label,
description, origin and codename are optional.
+ s add-all-arches SUITE VERSION... as "s add" but adds suite-architecture
+ relationships for all architectures
+
suite-architecture / s-a:
s-a list show the architectures for all suites
s-a list-suite ARCH show the suites an ARCH is in
print su.details()
-def __suite_add(d, args):
+def __suite_add(d, args, addallarches=False):
die_arglen(args, 4, "E: adding a suite requires at least a name and a version")
suite_name = args[2].lower()
version = args[3]
suite.origin = get_field('origin')
suite.codename = get_field('codename')
s.add(suite)
- s.commit()
+ s.flush()
except IntegrityError, e:
die("E: Integrity error adding suite %s (it probably already exists)" % suite_name)
except SQLAlchemyError, e:
die("E: Error adding suite %s (%s)" % (suite_name, e))
print "Suite %s added" % (suite_name)
+ if addallarches:
+ arches = []
+ q = s.query(Architecture).order_by('arch_string')
+ for arch in q.all():
+ suite.architectures.append(arch)
+ arches.append(arch.arch_string)
+
+ print "Architectures %s added to %s" % (','.join(arches), suite_name)
+
+ s.commit()
+
+
def suite(command):
args = [str(x) for x in command]
Cnf = utils.get_conf()
elif mode == 'show':
__suite_show(d, args)
elif mode == 'add':
- __suite_add(d, args)
+ __suite_add(d, args, False)
+ elif mode == 'add-all-arches':
+ __suite_add(d, args, True)
else:
die("E: suite command unknown")
--- /dev/null
+#!/usr/bin/env python
+# coding=utf8
+
+"""
+Ensure that suite_name is unique!
+
+@contact: Debian FTP Master <ftpmaster@debian.org>
+@copyright: 2011 Mark Hymers <mhy@debian.org>
+@license: GNU General Public License version 2 or later
+"""
+
+# 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
+
+################################################################################
+
+import psycopg2
+from daklib.dak_exceptions import DBUpdateError
+
+################################################################################
+def do_update(self):
+ """
+ Ensure that suite_name is unique
+ """
+ print __doc__
+ try:
+ c = self.db.cursor()
+
+ c.execute("ALTER TABLE suite ADD CONSTRAINT suite_name_unique UNIQUE (suite_name)")
+
+ c.execute("UPDATE config SET value = '62' WHERE name = 'db_revision'")
+ self.db.commit()
+
+ except psycopg2.ProgrammingError, msg:
+ self.db.rollback()
+ raise DBUpdateError, 'Unable to apply sick update 62, rollback issued. Error message : %s' % (str(msg))
################################################################################
Cnf = None
-required_database_schema = 61
+required_database_schema = 62
################################################################################
# dak admin architecture add i386 "Intel x86 port"
# dak admin architecture add amd64 "AMD64 port"
+Add a suite (origin=, label= and codename= are optional)
+# dak admin suite add-all-arches unstable x.y.z origin=MyDistro label=Master codename=sid