From 9747655f89997099ffc5a73f065d22201b1e24c1 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Sat, 7 Jan 2017 18:25:56 +0000 Subject: [PATCH] Make the pickled config (config.defines.dump) reproducible --- debian/changelog | 1 + debian/lib/python/debian_linux/config.py | 4 +++- debian/rules | 3 ++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index f37c74cb8..6bd28893b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,6 +3,7 @@ linux (4.9.1-1~exp2) UNRELEASED; urgency=medium * abiupdate.py: Use current config instead of downloading previous config * abiupdate.py: Update base URLs * abiupdate.py: Add support for incoming.ports.debian.org + * Make the pickled config (config.defines.dump) reproducible -- Ben Hutchings Sat, 07 Jan 2017 17:41:34 +0000 diff --git a/debian/lib/python/debian_linux/config.py b/debian/lib/python/debian_linux/config.py index 5e6ace178..004469af8 100644 --- a/debian/lib/python/debian_linux/config.py +++ b/debian/lib/python/debian_linux/config.py @@ -1,3 +1,4 @@ +import collections import os import os.path import pickle @@ -43,7 +44,8 @@ class SchemaItemList(object): return [j.strip() for j in re.split(self.type, i)] -class ConfigCore(dict): +# Using OrderedDict instead of dict makes the pickled config reproducible +class ConfigCore(collections.OrderedDict): def get_merge(self, section, arch, featureset, flavour, key, default=None): temp = [] diff --git a/debian/rules b/debian/rules index 486ea6970..8ee38b605 100755 --- a/debian/rules +++ b/debian/rules @@ -105,7 +105,8 @@ else endif debian/control-real: debian/bin/gencontrol.py $(CONTROL_FILES) - $< +# Hash randomisation makes the pickled config unreproducible + PYTHONHASHSEED=0 $< md5sum $^ > debian/control.md5sum @echo @echo This target is made to fail intentionally, to make sure