f0b0be2c1f
as a preparation to fix bugs in the interaction between p11-kit-trust and Mozilla applications, such as Firefox, Thunderbird etc. - Changed update-ca-trust to add comments to extracted PEM format files. - Added an utility to help with comparing output of the trust dump command.
35 lines
825 B
Python
35 lines
825 B
Python
#!/usr/bin/python
|
|
|
|
# Expected input is a file, where blocks of lines are separated by newline.
|
|
# Blocks will be sorted.
|
|
# Intention is to prepare files for comparison, were lines inside each block are
|
|
# in stable order, but the order of blocks is random.
|
|
|
|
import sys
|
|
import string
|
|
|
|
if (len(sys.argv) != 2):
|
|
print "syntax: " + sys.argv[0] + " input-filename"
|
|
sys.exit(1)
|
|
|
|
filename = sys.argv[1]
|
|
|
|
block = []
|
|
block_list = []
|
|
with open(filename, 'r') as f:
|
|
for line in f:
|
|
if (len(line) == 1):
|
|
if len(block) == 0:
|
|
continue
|
|
else:
|
|
combined_string = string.join(block, '')
|
|
block_list.append(combined_string)
|
|
block = []
|
|
else:
|
|
block.append(line)
|
|
|
|
block_list.sort()
|
|
|
|
for block in block_list:
|
|
print block
|