From: Michael Tremer Date: Sat, 11 Feb 2012 12:47:01 +0000 (+0100) Subject: Add option to delete keys from keyring. X-Git-Tag: 0.9.22~60^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=eaf999ef9c70980fd03e719fc80f41f3ad491224;p=pakfire.git Add option to delete keys from keyring. --- diff --git a/po/pakfire.pot b/po/pakfire.pot index 5bac065ff..cdda061b9 100644 --- a/po/pakfire.pot +++ b/po/pakfire.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-02-11 12:47+0100\n" +"POT-Creation-Date: 2012-02-11 13:45+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -605,94 +605,102 @@ msgstr "" msgid "Pakfire key command line interface." msgstr "" -#: ../python/pakfire/cli.py:996 +#: ../python/pakfire/cli.py:998 msgid "Initialize the local keyring." msgstr "" -#: ../python/pakfire/cli.py:1002 ../python/pakfire/cli.py:1012 +#: ../python/pakfire/cli.py:1004 ../python/pakfire/cli.py:1014 msgid "Import a key from file." msgstr "" -#: ../python/pakfire/cli.py:1004 +#: ../python/pakfire/cli.py:1006 msgid "The real name of the owner of this key." msgstr "" -#: ../python/pakfire/cli.py:1006 +#: ../python/pakfire/cli.py:1008 msgid "The email address of the owner of this key." msgstr "" -#: ../python/pakfire/cli.py:1014 +#: ../python/pakfire/cli.py:1016 msgid "Filename of that key to import." msgstr "" -#: ../python/pakfire/cli.py:1020 +#: ../python/pakfire/cli.py:1022 msgid "Export a key to a file." msgstr "" -#: ../python/pakfire/cli.py:1022 +#: ../python/pakfire/cli.py:1024 msgid "The ID of the key to export." msgstr "" -#: ../python/pakfire/cli.py:1024 +#: ../python/pakfire/cli.py:1026 msgid "Write the key to this file." msgstr "" -#: ../python/pakfire/cli.py:1030 +#: ../python/pakfire/cli.py:1032 +msgid "Delete a key from the local keyring." +msgstr "" + +#: ../python/pakfire/cli.py:1034 +msgid "The ID of the key to delete." +msgstr "" + +#: ../python/pakfire/cli.py:1040 msgid "List all imported keys." msgstr "" -#: ../python/pakfire/cli.py:1036 +#: ../python/pakfire/cli.py:1046 msgid "Sign one or more packages." msgstr "" -#: ../python/pakfire/cli.py:1038 +#: ../python/pakfire/cli.py:1048 msgid "Key that is used sign the package(s)." msgstr "" -#: ../python/pakfire/cli.py:1040 +#: ../python/pakfire/cli.py:1050 msgid "Package(s) to sign." msgstr "" -#: ../python/pakfire/cli.py:1046 +#: ../python/pakfire/cli.py:1056 msgid "Verify one or more packages." msgstr "" -#: ../python/pakfire/cli.py:1050 +#: ../python/pakfire/cli.py:1060 msgid "Package(s) to verify." msgstr "" -#: ../python/pakfire/cli.py:1061 +#: ../python/pakfire/cli.py:1071 msgid "Generating the key may take a moment..." msgstr "" -#: ../python/pakfire/cli.py:1108 +#: ../python/pakfire/cli.py:1123 #, python-format msgid "Signing %s..." msgstr "" -#: ../python/pakfire/cli.py:1125 +#: ../python/pakfire/cli.py:1140 #, python-format msgid "Verifying %s..." msgstr "" -#: ../python/pakfire/cli.py:1135 +#: ../python/pakfire/cli.py:1150 msgid "This signature is valid." msgstr "" -#: ../python/pakfire/cli.py:1138 +#: ../python/pakfire/cli.py:1153 msgid "Unknown key" msgstr "" -#: ../python/pakfire/cli.py:1139 +#: ../python/pakfire/cli.py:1154 msgid "Could not check if this signature is valid." msgstr "" -#: ../python/pakfire/cli.py:1142 ../python/pakfire/keyring.py:94 +#: ../python/pakfire/cli.py:1157 ../python/pakfire/keyring.py:94 #, python-format msgid "Created: %s" msgstr "" -#: ../python/pakfire/cli.py:1146 ../python/pakfire/keyring.py:97 +#: ../python/pakfire/cli.py:1161 ../python/pakfire/keyring.py:97 #, python-format msgid "Expires: %s" msgstr "" @@ -735,10 +743,15 @@ msgstr "" msgid "Loaded from files:" msgstr "" -#: ../python/pakfire/downloader.py:134 +#: ../python/pakfire/downloader.py:137 msgid "Downloading source files:" msgstr "" +#: ../python/pakfire/downloader.py:160 +#, python-format +msgid "Downloaded empty file: %s" +msgstr "" + #: ../python/pakfire/errors.py:30 msgid "An unhandled error occured." msgstr "" @@ -928,6 +941,11 @@ msgstr "" msgid "Could not remove file: /%s" msgstr "" +#: ../python/pakfire/packages/lexer.py:722 +#, python-format +msgid "Template does not exist: %s" +msgstr "" + #: ../python/pakfire/packages/make.py:79 msgid "Package name is undefined." msgstr "" @@ -936,18 +954,18 @@ msgstr "" msgid "Package version is undefined." msgstr "" -#: ../python/pakfire/packages/make.py:416 +#: ../python/pakfire/packages/make.py:412 #, python-format msgid "Searching for automatic dependencies for %s..." msgstr "" -#: ../python/pakfire/packages/make.py:464 +#: ../python/pakfire/packages/make.py:460 #, python-format msgid "Regular experession is invalid and has been skipped: %s" msgstr "" #. Let the user know what has been done. -#: ../python/pakfire/packages/make.py:480 +#: ../python/pakfire/packages/make.py:476 #, python-format msgid "Filter '%s' filtered %s." msgstr "" diff --git a/python/pakfire/api.py b/python/pakfire/api.py index 87886ca2e..734e09f8e 100644 --- a/python/pakfire/api.py +++ b/python/pakfire/api.py @@ -160,6 +160,11 @@ def key_export(keyid, keyfile, **pakfire_args): return pakfire.keyring.export_key(keyid, keyfile) +def key_delete(keyid, **pakfire_args): + pakfire = Pakfire(**pakfire_args) + + return pakfire.keyring.delete_key(keyid) + def key_list(**pakfire_args): pakfire = Pakfire(**pakfire_args) diff --git a/python/pakfire/cli.py b/python/pakfire/cli.py index f611c9f61..de5203d3c 100644 --- a/python/pakfire/cli.py +++ b/python/pakfire/cli.py @@ -962,6 +962,7 @@ class CliKey(Cli): self.parse_command_generate() self.parse_command_import() self.parse_command_export() + self.parse_command_delete() self.parse_command_list() self.parse_command_sign() self.parse_command_verify() @@ -977,6 +978,7 @@ class CliKey(Cli): "generate" : self.handle_generate, "import" : self.handle_import, "export" : self.handle_export, + "delete" : self.handle_delete, "list" : self.handle_list, "sign" : self.handle_sign, "verify" : self.handle_verify, @@ -1024,6 +1026,14 @@ class CliKey(Cli): help=_("Write the key to this file.")) sub_export.add_argument("action", action="store_const", const="export") + def parse_command_delete(self): + # Parse "delete" command. + sub_del = self.sub_commands.add_parser("delete", + help=_("Delete a key from the local keyring.")) + sub_del.add_argument("keyid", nargs=1, + help=_("The ID of the key to delete.")) + sub_del.add_argument("action", action="store_const", const="delete") + def parse_command_list(self): # Parse "list" command. sub_list = self.sub_commands.add_parser("list", @@ -1080,6 +1090,11 @@ class CliKey(Cli): pakfire.key_export(keyid, filename, **self.pakfire_args) + def handle_delete(self): + keyid = self.args.keyid[0] + + pakfire.key_delete(keyid, **self.pakfire_args) + def handle_list(self): lines = pakfire.key_list(**self.pakfire_args) diff --git a/python/pakfire/keyring.py b/python/pakfire/keyring.py index 492591d60..50154554c 100644 --- a/python/pakfire/keyring.py +++ b/python/pakfire/keyring.py @@ -156,6 +156,12 @@ class Keyring(object): f.write(keydata.getvalue()) f.close() + def delete_key(self, keyid): + ctx = gpgme.Context() + + key = ctx.get_key(keyid) + ctx.delete(key, True) + def list_keys(self): ret = []