[bin] add handy function atoms_to_keyslot

This commit is contained in:
Fabio Erculiani 2011-11-25 11:25:15 +01:00
parent 3a510a4143
commit 707d981c44
1 changed files with 17 additions and 0 deletions

17
bin/atoms_to_keylost Executable file
View File

@ -0,0 +1,17 @@
#!/usr/bin/python
import sys
import entropy.dep
atoms = sys.argv[1:]
keyslot_cache = set()
for atom in atoms:
key = entropy.dep.dep_getkey(atom)
with open("/var/db/pkg/%s/SLOT" % (atom,)) as slot_f:
slot = slot_f.readline().strip()
keyslot = "%s:%s" % (key, slot)
if keyslot in keyslot_cache:
continue
print(keyslot)
keyslot_cache.add(keyslot)