]> git.ipfire.org Git - people/ms/pakfire.git/commitdiff
Add option to delete keys from keyring.
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 11 Feb 2012 12:47:01 +0000 (13:47 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 11 Feb 2012 12:47:01 +0000 (13:47 +0100)
po/pakfire.pot
python/pakfire/api.py
python/pakfire/cli.py
python/pakfire/keyring.py

index 5bac065ff8a4c1bb6fcd1c41ea41e12c8015fa71..cdda061b97c4b330640ac6a678eb6d249e7b70b6 100644 (file)
@@ -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 <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\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 ""
index 87886ca2e1a82bf51b6ae0fa7491178afb2b6b89..734e09f8ef87cc10c8e1f3a6b7f90e0627ba9b27 100644 (file)
@@ -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)
 
index f611c9f61c0e18cc8384888da04a8035b714d504..de5203d3c9216488e63f8b5f7a272be913a1e319 100644 (file)
@@ -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)
 
index 492591d602addb57dee95f9a7a97586d1484e9eb..50154554c015a8e767ea8f173a13896e5d731c52 100644 (file)
@@ -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 = []