Source: python-kafka Version: 0.9.5-2 Severity: wishlist Tags: patch User: reproducible-bui...@lists.alioth.debian.org Usertags: randomness X-Debbugs-Cc: reproducible-b...@lists.alioth.debian.org
Hi, Whilst working on the Reproducible Builds effort [0], we noticed that python-kafka could not be built reproducibly. This is because the code has an anonymous lambda which Sphinx outputs with a memory reference. Patch attached. [0] https://reproducible-builds.org/ Regards, -- ,''`. : :' : Chris Lamb `. `'` la...@debian.org / chris-lamb.co.uk `-
--- a/debian/patches/reproducible-build.patch 1970-01-01 01:00:00.000000000 +0100 --- b/debian/patches/reproducible-build.patch 2017-11-04 20:50:27.052966969 +0000 @@ -0,0 +1,45 @@ +Description: Make the build reproducible +Author: Chris Lamb <la...@debian.org> +Last-Update: 2017-11-04 + +--- python-kafka-0.9.5.orig/docs/usage.rst ++++ python-kafka-0.9.5/docs/usage.rst +@@ -152,7 +152,7 @@ messages (m) are namedtuples with attrib + bootstrap_servers=[], + socket_timeout_ms=30*1000, + auto_offset_reset='largest', +- deserializer_class=lambda msg: msg, ++ deserializer_class=None, + auto_commit_enable=False, + auto_commit_interval_ms=60 * 1000, + consumer_timeout_ms=-1 +--- python-kafka-0.9.5.orig/kafka/consumer/kafka.py ++++ python-kafka-0.9.5/kafka/consumer/kafka.py +@@ -32,7 +32,7 @@ DEFAULT_CONSUMER_CONFIG = { + 'fetch_min_bytes': 1, + 'fetch_wait_max_ms': 100, + 'refresh_leader_backoff_ms': 200, +- 'deserializer_class': lambda msg: msg, ++ 'deserializer_class': None, + 'auto_commit_enable': False, + 'auto_commit_interval_ms': 60 * 1000, + 'auto_commit_interval_messages': None, +@@ -93,7 +93,7 @@ class KafkaConsumer(object): + ofther value will raise the exception. Defaults to 'largest'. + deserializer_class (callable, optional): Any callable that takes a + raw message value and returns a deserialized value. Defaults to +- lambda msg: msg. ++ None (ie. lambda msg: msg). + auto_commit_enable (bool, optional): Enabling auto-commit will cause + the KafkaConsumer to periodically commit offsets without an + explicit call to commit(). Defaults to False. +@@ -119,6 +119,9 @@ class KafkaConsumer(object): + raise KafkaConfigurationError('Unknown configuration key(s): ' + + str(list(configs.keys()))) + ++ if self._config['deserializer_class']: ++ self._config['deserializer_class'] = lambda msg: msg ++ + if self._config['auto_commit_enable']: + if not self._config['group_id']: + raise KafkaConfigurationError( --- a/debian/patches/series 2017-11-04 20:40:18.110496358 +0000 --- b/debian/patches/series 2017-11-04 20:50:25.696961459 +0000 @@ -1 +1,2 @@ do-not-use-sphinxcontrib.napoleon-theme.patch +reproducible-build.patch