Make sure .treeinfo file is sorted

OrderedDict used by default by ConfigParser isn't enough because order
of entries being added may not be deterministic (depends on directory
list order). To solve this problem, use SortedDict as a base.

Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
This commit is contained in:
Marek Marczykowski-Górecki 2018-10-04 23:42:19 +02:00
parent d469cbfef5
commit 2aeb8de459
3 changed files with 8 additions and 0 deletions

View File

@ -21,6 +21,7 @@ BuildRequires: python2-libcomps
BuildRequires: python2-six BuildRequires: python2-six
BuildRequires: python2-multilib BuildRequires: python2-multilib
BuildRequires: python2-dogpile-cache BuildRequires: python2-dogpile-cache
BuildRequires: python2-dict-sorted
Requires: createrepo >= 0.4.11 Requires: createrepo >= 0.4.11
Requires: yum => 3.4.3-28 Requires: yum => 3.4.3-28
@ -51,6 +52,7 @@ Requires: python2-multilib
Requires: python2-libcomps Requires: python2-libcomps
Requires: python2-six Requires: python2-six
Requires: python2-dogpile-cache Requires: python2-dogpile-cache
Requires: python2-dict-sorted
BuildArch: noarch BuildArch: noarch

View File

@ -26,6 +26,7 @@ import urlgrabber.progress
import subprocess import subprocess
import createrepo import createrepo
import ConfigParser import ConfigParser
from sdict import AlphaSortedDict
from fnmatch import fnmatch from fnmatch import fnmatch
import arch as arch_module import arch as arch_module
@ -89,6 +90,10 @@ def is_package(po):
class MyConfigParser(ConfigParser.ConfigParser): class MyConfigParser(ConfigParser.ConfigParser):
"""A subclass of ConfigParser which does not lowercase options""" """A subclass of ConfigParser which does not lowercase options"""
def __init__(self, *args, **kwargs):
kwargs['dict_type'] = AlphaSortedDict
ConfigParser.ConfigParser.__init__(self, *args, **kwargs)
def optionxform(self, optionstr): def optionxform(self, optionstr):
return optionstr return optionstr

View File

@ -63,6 +63,7 @@ setup(
"productmd", "productmd",
"six", "six",
'dogpile.cache', 'dogpile.cache',
'dict.sorted',
], ],
tests_require = [ tests_require = [
"mock", "mock",