X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=dak%2Fadmin.py;h=4923234bb3f945168f23657769e28e4b8b81769b;hb=52eb03dccab0a9898bca4d36a0a96ebe377fb977;hp=8ba79797bdaf6345e6d5b1c3bd0206c8c3313c08;hpb=c66012218feeb5a9a4228890f44a9a27dcaafeca;p=dak.git diff --git a/dak/admin.py b/dak/admin.py index 8ba79797..4923234b 100755 --- a/dak/admin.py +++ b/dak/admin.py @@ -65,6 +65,8 @@ Perform administrative work on the dak database. 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 @@ -80,7 +82,7 @@ Perform administrative work on the dak database. 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. @@ -103,6 +105,7 @@ Perform administrative work on the dak database. primary mirror MIRROR. archive rm NAME remove archive NAME (will only work if there are no files and no suites in the archive) + archive rename OLD NEW rename archive OLD to NEW version-check / v-c: v-c list show version checks for all suites @@ -429,10 +432,23 @@ def archive_rm(name): else: session.commit() +def archive_rename(oldname, newname): + session = DBConn().session() + archive = get_archive(oldname, session) + archive.archive_name = newname + session.flush() + + if dryrun: + session.rollback() + else: + session.commit() + def archive(command): mode = command[1] if mode == 'list': archive_list() + elif mode == 'rename': + archive_rename(command[2], command[3]) elif mode == 'add': archive_add(command[2:]) elif mode == 'rm': @@ -595,8 +611,40 @@ def show_keyring(command): 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 ################################################################################