[Python-apps-commits] r14285 - in packages/cython/trunk/debian (3 files)

jelmer at users.alioth.debian.org jelmer at users.alioth.debian.org
Fri Jul 28 01:23:06 UTC 2017


    Date: Friday, July 28, 2017 @ 01:23:03
  Author: jelmer
Revision: 14285

* Team upload.
* Add patch relative-paths: encode relative paths in generated C code,
  to make it build reproducibly. Closes: #849328

Added:
  packages/cython/trunk/debian/patches/relative-paths
Modified:
  packages/cython/trunk/debian/changelog
  packages/cython/trunk/debian/patches/series

Modified: packages/cython/trunk/debian/changelog
===================================================================
--- packages/cython/trunk/debian/changelog	2017-07-27 20:36:14 UTC (rev 14284)
+++ packages/cython/trunk/debian/changelog	2017-07-28 01:23:03 UTC (rev 14285)
@@ -1,3 +1,11 @@
+cython (0.26~b0+git23-ga4fb856ac-2) UNRELEASED; urgency=medium
+
+  * Team upload.
+  * Add patch relative-paths: encode relative paths in generated C code,
+    to make it build reproducibly. Closes: #849328
+
+ -- Jelmer Vernooij <jelmer at debian.org>  Thu, 27 Jul 2017 20:18:22 +0000
+
 cython (0.26~b0+git23-ga4fb856ac-1) experimental; urgency=medium
 
   * Fresh upstream pre-release snapshot which hopefully resolves detected

Added: packages/cython/trunk/debian/patches/relative-paths
===================================================================
--- packages/cython/trunk/debian/patches/relative-paths	                        (rev 0)
+++ packages/cython/trunk/debian/patches/relative-paths	2017-07-28 01:23:03 UTC (rev 14285)
@@ -0,0 +1,28 @@
+Description: Encode relative path to working tree in code paths when possible.
+ This makes the build reproducible irregardless of the build path.
+Author: Jelmer Vernooij <jelmer at debian.org>
+Status: cherry-picked from upstream
+Bug: https://github.com/cython/cython/issues/1565
+Bug-Debian: https://bugs.debian.org/849328
+
+diff --git a/Cython/Compiler/ExprNodes.py b/Cython/Compiler/ExprNodes.py
+index 80a08c4bc..739d8037c 100644
+--- a/Cython/Compiler/ExprNodes.py
++++ b/Cython/Compiler/ExprNodes.py
+@@ -9040,7 +9040,15 @@ class CodeObjectNode(ExprNode):
+         func_name = code.get_py_string_const(
+             func.name, identifier=True, is_str=False, unicode_value=func.name)
+         # FIXME: better way to get the module file path at module init time? Encoding to use?
+-        file_path = StringEncoding.bytes_literal(func.pos[0].get_filenametable_entry().encode('utf8'), 'utf8')
++        file_abspath = func.pos[0].get_filenametable_entry()
++        # Prefer relative paths to current directory (which is most likely the project root)
++        # over absolute paths.
++        workdir = os.getcwd() + os.sep
++        if file_abspath.startswith(workdir):
++            file_path = file_abspath[len(workdir):]
++        else:
++            file_path = file_abspath
++        file_path = StringEncoding.bytes_literal(file_path.encode('utf8'), 'utf8')
+         file_path_const = code.get_py_string_const(file_path, identifier=False, is_str=True)
+ 
+         flags = []

Modified: packages/cython/trunk/debian/patches/series
===================================================================
--- packages/cython/trunk/debian/patches/series	2017-07-27 20:36:14 UTC (rev 14284)
+++ packages/cython/trunk/debian/patches/series	2017-07-28 01:23:03 UTC (rev 14285)
@@ -2,3 +2,4 @@
 deb_disable_googleanalytics
 honour_SOURCE_DATE_EPOCH_for_copyright_year
 debup_workaround_verify_resolution_GH1533
+relative-paths




More information about the Python-apps-commits mailing list