summaryrefslogtreecommitdiffstats
path: root/pym/portage/gpg.py
diff options
context:
space:
mode:
Diffstat (limited to 'pym/portage/gpg.py')
-rw-r--r--pym/portage/gpg.py44
1 files changed, 22 insertions, 22 deletions
diff --git a/pym/portage/gpg.py b/pym/portage/gpg.py
index 04ed60046..7dd758506 100644
--- a/pym/portage/gpg.py
+++ b/pym/portage/gpg.py
@@ -1,4 +1,4 @@
-# portage_gpg.py -- core Portage functionality
+# portage.gpg.py -- core Portage functionality
# Copyright 2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$
@@ -8,8 +8,8 @@ import os
import copy
import types
import commands
-import portage_exception
-import portage_checksum
+import portage.exception
+import portage.checksum
GPG_BINARY = "/usr/bin/gpg"
GPG_OPTIONS = " --lock-never --no-random-seed-file --no-greeting --no-sig-cache "
@@ -26,7 +26,7 @@ def fileStats(filepath):
mya = []
for x in os.stat(filepath):
mya.append(x)
- mya.append(portage_checksum.perform_checksum(filepath))
+ mya.append(portage.checksum.perform_checksum(filepath))
return mya
@@ -42,34 +42,34 @@ class FileChecker:
if (keydir != None):
# Verify that the keydir is valid.
if type(keydir) != types.StringType:
- raise portage_exception.InvalidDataType, "keydir argument: %s" % keydir
+ raise portage.exception.InvalidDataType, "keydir argument: %s" % keydir
if not os.path.isdir(keydir):
- raise portage_exception.DirectoryNotFound, "keydir: %s" % keydir
+ raise portage.exception.DirectoryNotFound, "keydir: %s" % keydir
self.keydir = copy.deepcopy(keydir)
if (keyring != None):
# Verify that the keyring is a valid filename and exists.
if type(keyring) != types.StringType:
- raise portage_exception.InvalidDataType, "keyring argument: %s" % keyring
+ raise portage.exception.InvalidDataType, "keyring argument: %s" % keyring
if keyring.find("/") != -1:
- raise portage_exception.InvalidData, "keyring: %s" % keyring
+ raise portage.exception.InvalidData, "keyring: %s" % keyring
pathname = ""
if keydir:
pathname = keydir + "/" + keyring
if not os.path.isfile(pathname):
- raise portage_exception.FileNotFound, "keyring missing: %s (dev.gentoo.org/~carpaski/gpg/)" % pathname
+ raise portage.exception.FileNotFound, "keyring missing: %s (dev.gentoo.org/~carpaski/gpg/)" % pathname
keyringPath = keydir+"/"+keyring
if not keyring or not keyringPath and requireSignedRing:
- raise portage_exception.MissingParameter
+ raise portage.exception.MissingParameter
self.keyringStats = fileStats(keyringPath)
self.minimumTrust = TRUSTED
if not self.verify(keyringPath, keyringPath+".asc"):
self.keyringIsTrusted = False
if requireSignedRing:
- raise portage_exception.InvalidSignature, "Required keyring verification: "+keyringPath
+ raise portage.exception.InvalidSignature, "Required keyring verification: "+keyringPath
else:
self.keyringIsTrusted = True
@@ -81,27 +81,27 @@ class FileChecker:
if self.keyringStats and self.keyringPath:
new_stats = fileStats(self.keyringPath)
if new_stats != self.keyringStats:
- raise portage_exception.SecurityViolation, "GPG keyring changed!"
+ raise portage.exception.SecurityViolation, "GPG keyring changed!"
def verify(self, filename, sigfile=None):
"""Uses minimumTrust to determine if it is Valid/True or Invalid/False"""
self._verifyKeyring()
if not os.path.isfile(filename):
- raise portage_exception.FileNotFound, filename
+ raise portage.exception.FileNotFound, filename
if sigfile and not os.path.isfile(sigfile):
- raise portage_exception.FileNotFound, sigfile
+ raise portage.exception.FileNotFound, sigfile
if self.keydir and not os.path.isdir(self.keydir):
- raise portage_exception.DirectoryNotFound, filename
+ raise portage.exception.DirectoryNotFound, filename
if self.keyringPath:
if not os.path.isfile(self.keyringPath):
- raise portage_exception.FileNotFound, self.keyringPath
+ raise portage.exception.FileNotFound, self.keyringPath
if not os.path.isfile(filename):
- raise portage_exception.CommandNotFound, filename
+ raise portage.exception.CommandNotFound, filename
command = GPG_BINARY + GPG_VERIFY_FLAGS + GPG_OPTIONS
if self.keydir:
@@ -127,22 +127,22 @@ class FileChecker:
#if output.find("WARNING") != -1:
# trustLevel = MARGINAL
if output.find("BAD") != -1:
- raise portage_exception.InvalidSignature, filename
+ raise portage.exception.InvalidSignature, filename
elif result == 1:
trustLevel = EXISTS
if output.find("BAD") != -1:
- raise portage_exception.InvalidSignature, filename
+ raise portage.exception.InvalidSignature, filename
elif result == 2:
trustLevel = UNTRUSTED
if output.find("could not be verified") != -1:
- raise portage_exception.MissingSignature, filename
+ raise portage.exception.MissingSignature, filename
if output.find("public key not found") != -1:
if self.keyringIsTrusted: # We trust the ring, but not the key specifically.
trustLevel = MARGINAL
else:
- raise portage_exception.InvalidSignature, filename+" (Unknown Signature)"
+ raise portage.exception.InvalidSignature, filename+" (Unknown Signature)"
else:
- raise portage_exception.UnknownCondition, "GPG returned unknown result: %d" % (result)
+ raise portage.exception.UnknownCondition, "GPG returned unknown result: %d" % (result)
if trustLevel >= self.minimumTrust:
return True