changeset 23419:75a4b9a34999

Ensure generated source files are deterministic and reproducible * mk-builtins.pl: Sort the list of dispatch types for built-in functions to ensure that the contents of libinterp/builtins.cc are reproducible. * mk-errno-list: Sort the list of system error codes in the embedded perl and python scripts to ensure that the contents of libinterp/corefcn/oct-errno.cc are reproducible. Update the python script to be Python 3 compatible.
author Mike Miller <mtmiller@octave.org>
date Thu, 20 Apr 2017 20:02:23 -0700
parents 0412433f016f
children 1fee389bd04b
files build-aux/mk-builtins.pl libinterp/mk-errno-list
diffstat 2 files changed, 6 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/build-aux/mk-builtins.pl	Thu Apr 20 00:16:08 2017 -0400
+++ b/build-aux/mk-builtins.pl	Thu Apr 20 20:02:23 2017 -0700
@@ -274,7 +274,7 @@
       }
     }
 
-    foreach $fcn (keys %dispatch_map)
+    foreach $fcn (sort (keys (%dispatch_map)))
     {
       print "\n";
 
--- a/libinterp/mk-errno-list	Thu Apr 20 00:16:08 2017 -0400
+++ b/libinterp/mk-errno-list	Thu Apr 20 20:02:23 2017 -0700
@@ -25,7 +25,7 @@
 
 if [ $1 = "--perl" ]; then
   PERL="$2"
-  $PERL -e 'foreach $key (keys(%!)) {
+  $PERL -e 'foreach $key (sort (keys (%!))) {
     $x .= "#if defined ($key)\n    { \"$key\", $key, },\n#endif\n";
   }
   while (<>) {
@@ -37,15 +37,15 @@
   PYTHON="$2"
   $PYTHON -c '
 from errno import errorcode
-from sys import stdin
+from sys import stdin, stdout
 
 t = "#if defined (%s)\n    { \"%s\", %s, },\n#endif\n"
 errstr = ""
-for k in errorcode.keys ():
-    errstr += t % tuple(3*[errorcode[k]])
+for v in sorted (errorcode.values ()):
+    errstr += t % tuple (3 * [v])
 
 for l in stdin:
-    print l.replace("@SYSDEP_ERRNO_LIST@", errstr),
+    stdout.write (l.replace ("@SYSDEP_ERRNO_LIST@", errstr))
 '
 fi