debversioncomp/run.py

23 lines
626 B
Python
Raw Normal View History

2014-06-01 08:31:24 +00:00
#!/usr/bin/env python
2014-06-25 18:15:31 +00:00
from __future__ import print_function
2014-06-01 08:31:24 +00:00
import deb822
2014-06-25 18:15:31 +00:00
import sys
2014-06-01 08:31:24 +00:00
versions = set()
2014-06-25 18:15:31 +00:00
with open(sys.argv[1]) as f:
for pkg in deb822.Deb822.iter_paragraphs(f):
2014-06-01 08:31:24 +00:00
ver = pkg.get('Version')
if ver:
versions.add(ver)
# create a list of all possible combinations of two versions by iterating
# through the list of versions and comparing every version with all that come
# after it
versions = sorted(versions)
2014-06-25 18:15:31 +00:00
l = len(versions)
2014-06-01 08:31:24 +00:00
for i,v1 in enumerate(versions):
2014-06-25 18:15:31 +00:00
print("%f %%\r"%((i*100.0)/l), file=sys.stderr, end="")
2014-06-01 08:31:24 +00:00
for v2 in versions[i+1:]:
print("%s\t%s"%(v1,v2))