k list-all list all keyrings
k list-binary list all keyrings with a NULL source acl
k list-source list all keyrings with a non NULL source acl
+ k add-buildd NAME ARCH... add buildd keyring with upload permission
+ for the given architectures
architecture / a:
a list show a list of architectures
s show SUITE show config details for a suite
s add SUITE VERSION [ label=LABEL ] [ description=DESCRIPTION ]
[ origin=ORIGIN ] [ codename=CODENAME ]
- [ signingkey=SIGNINGKEY ]
+ [ signingkey=SIGNINGKEY ] [ archive=ARCHIVE ]
add suite SUITE, version VERSION.
label, description, origin, codename
and signingkey are optional.
s.commit()
+def __suite_rm(d, args):
+ die_arglen(args, 3, "E: removing a suite requires at least a name")
+ name = args[2]
+ print "Removing suite {0}".format(name)
+ if not dryrun:
+ try:
+ s = d.session()
+ su = get_suite(name.lower())
+ if su is None:
+ die("E: Cannot find suite {0}".format(name))
+ s.delete(su)
+ s.commit()
+ except IntegrityError as e:
+ die("E: Integrity error removing suite {0} (suite-arch entries probably still exist)".format(name))
+ except SQLAlchemyError as e:
+ die("E: Error removing suite {0} ({1})".format(name, e))
+ print "Suite {0} removed".format(name)
def suite(command):
args = [str(x) for x in command]
__suite_list(d, args)
elif mode == 'show':
__suite_show(d, args)
+ elif mode == 'rm':
+ __suite_rm(d, args)
elif mode == 'add':
__suite_add(d, args, False)
elif mode == 'add-all-arches':
def archive_rm(name):
session = DBConn().session()
- archive = session.query(Archive).filter_by(archive_name=name).one()
+ archive = get_archive(name, session)
session.delete(archive)
session.flush()
for k in q.all():
print k.keyring_name
-dispatch['keyring'] = show_keyring
-dispatch['k'] = show_keyring
+def keyring_add_buildd(command):
+ name = command[2]
+ arch_names = command[3:]
+
+ session = DBConn().session()
+ arches = session.query(Architecture).filter(Architecture.arch_string.in_(arch_names))
+
+ acl = ACL()
+ acl.name = 'buildd-{0}'.format('+'.join(arch_names))
+ acl.architectures.update(arches)
+ acl.allow_new = True
+ acl.allow_binary = True
+ acl.allow_binary_only = True
+ acl.allow_hijack = True
+ session.add(acl)
+
+ k = Keyring()
+ k.keyring_name = name
+ k.acl = acl
+ k.priority = 10
+ session.add(k)
+
+ session.commit()
+
+def keyring(command):
+ if command[1].startswith('list-'):
+ show_keyring(command)
+ elif command[1] == 'add-buildd':
+ keyring_add_buildd(command)
+ else:
+ die("E: keyring command unknown")
+
+dispatch['keyring'] = keyring
+dispatch['k'] = keyring
################################################################################