From 2aeb8de459210790d4d9a93014771c384b28afc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Thu, 4 Oct 2018 23:42:19 +0200 Subject: [PATCH] Make sure .treeinfo file is sorted MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- pungi.spec | 2 ++ pungi/gather.py | 5 +++++ setup.py | 1 + 3 files changed, 8 insertions(+) diff --git a/pungi.spec b/pungi.spec index a85295b4..d75a6db4 100644 --- a/pungi.spec +++ b/pungi.spec @@ -21,6 +21,7 @@ BuildRequires: python2-libcomps BuildRequires: python2-six BuildRequires: python2-multilib BuildRequires: python2-dogpile-cache +BuildRequires: python2-dict-sorted Requires: createrepo >= 0.4.11 Requires: yum => 3.4.3-28 @@ -51,6 +52,7 @@ Requires: python2-multilib Requires: python2-libcomps Requires: python2-six Requires: python2-dogpile-cache +Requires: python2-dict-sorted BuildArch: noarch diff --git a/pungi/gather.py b/pungi/gather.py index 86b22052..d0cacd87 100644 --- a/pungi/gather.py +++ b/pungi/gather.py @@ -26,6 +26,7 @@ import urlgrabber.progress import subprocess import createrepo import ConfigParser +from sdict import AlphaSortedDict from fnmatch import fnmatch import arch as arch_module @@ -89,6 +90,10 @@ def is_package(po): class MyConfigParser(ConfigParser.ConfigParser): """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): return optionstr diff --git a/setup.py b/setup.py index 40abe197..a946b488 100755 --- a/setup.py +++ b/setup.py @@ -63,6 +63,7 @@ setup( "productmd", "six", 'dogpile.cache', + 'dict.sorted', ], tests_require = [ "mock",