def findGpgFingerprints(): # gpg is really really annoying the first time you run it # do this so the bits we care about are always atleast the second running # shut... up... gpg... command = "/usr/bin/gpg -q --list-keys > /dev/null 2>&1" fdno = os.popen(command) fdno.close() command = "/usr/bin/gpg %s --list-keys --with-colons" % rpmUtils.getGPGflags() fdno = os.popen(command) lines = fdno.readlines() fdno.close() fingerprints = [] for line in lines: parts = string.split(line, ":") if parts[0] == "pub": fingerprint = parts[4] fingerprints.append(fingerprint) return fingerprints
def findGpgFingerprints(): # gpg is really really annoying the first time you run it # do this so the bits we care about are always atleast the second running # shut... up... gpg... command = "/usr/bin/gpg -q --list-keys > /dev/null 2>&1" fdno = os.popen(command) fdno.close() command = "/usr/bin/gpg %s --list-keys --with-colons" % rpmUtils.getGPGflags( ) fdno = os.popen(command) lines = fdno.readlines() fdno.close() fingerprints = [] for line in lines: parts = string.split(line, ":") if parts[0] == "pub": fingerprint = parts[4] fingerprints.append(fingerprint) return fingerprints
def importGpgKeyring(): # gpg is really really annoying the first time you run it # do this so the bits we care about are always atleast the second running command = "/usr/bin/gpg -q --list-keys > /dev/null 2>&1" fdno = os.popen(command) fdno.close() # method to import an existing keyring into the new # rpm mechanism of storing supported keys as virtual # packages in the database for fingerprint in findGpgFingerprints(): if findKey(fingerprint): continue command = "/usr/bin/gpg %s --export %s" % (rpmUtils.getGPGflags(), fingerprint) # print command fdno = os.popen(command) pubkey = fdno.read() fdno.close() _ts = transaction.initReadOnlyTransaction() _ts.pgpImportPubkey(pubkey) #_ts.pgpPrtPkts(pubkey) return 0
def importGpgKeyring(): # gpg is really really annoying the first time you run it # do this so the bits we care about are always atleast the second running command = "/usr/bin/gpg -q --list-keys > /dev/null 2>&1" fdno = os.popen(command) fdno.close() # method to import an existing keyring into the new # rpm mechanism of storing supported keys as virtual # packages in the database for fingerprint in findGpgFingerprints(): if findKey(fingerprint): continue command = "/usr/bin/gpg %s --export %s" % ( rpmUtils.getGPGflags(), fingerprint) # print command fdno = os.popen(command) pubkey = fdno.read() fdno.close() _ts = transaction.initReadOnlyTransaction() _ts.pgpImportPubkey(pubkey) #_ts.pgpPrtPkts(pubkey) return 0