[GRASS-SVN] r69214 - in grass/trunk: gui/wxpython/tools include/Make lib/db/dbmi_base

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Aug 22 14:34:34 PDT 2016


Author: martinl
Date: 2016-08-22 14:34:34 -0700 (Mon, 22 Aug 2016)
New Revision: 69214

Modified:
   grass/trunk/gui/wxpython/tools/build_modules_xml.py
   grass/trunk/include/Make/Vars.make
   grass/trunk/lib/db/dbmi_base/dbmscap.c
Log:
Patches to make the build reproducible (fileordering, randomness)
Patches applied: 01-sort-build-modules-list.patch, 02-sort-dbmscap.patch, 03-sort-obj-files.patch (05-binary-nad-install.patch not needed any more)
To be solved: 04-srand48_auto-from-SOURCE_DATE_EPOCH.patch
(see #3042)


Modified: grass/trunk/gui/wxpython/tools/build_modules_xml.py
===================================================================
--- grass/trunk/gui/wxpython/tools/build_modules_xml.py	2016-08-22 15:46:20 UTC (rev 69213)
+++ grass/trunk/gui/wxpython/tools/build_modules_xml.py	2016-08-22 21:34:34 UTC (rev 69214)
@@ -51,7 +51,7 @@
     # TODO: what about ms windows? does gtask handle this?
     mlist = list(gcore.get_commands()[0])
     indent = 4
-    for m in mlist:
+    for m in sorted(mlist):
         # TODO: get rid of g.mapsets_picker.py
         if m == 'g.mapsets_picker.py' or m == 'g.parser':
             continue

Modified: grass/trunk/include/Make/Vars.make
===================================================================
--- grass/trunk/include/Make/Vars.make	2016-08-22 15:46:20 UTC (rev 69213)
+++ grass/trunk/include/Make/Vars.make	2016-08-22 21:34:34 UTC (rev 69214)
@@ -13,10 +13,10 @@
 YACC_SOURCES := $(wildcard *.y)
 
 AUTO_OBJS := \
-	$(subst .c,.o,$(C_SOURCES)) \
-	$(subst .cpp,.o,$(CPP_SOURCES)) \
-	$(subst .l,.yy.o,$(LEX_SOURCES)) \
-	$(subst .y,.tab.o,$(YACC_SOURCES))
+	$(sort $(subst .c,.o,$(C_SOURCES))) \
+	$(sort $(subst .cpp,.o,$(CPP_SOURCES))) \
+	$(sort $(subst .l,.yy.o,$(LEX_SOURCES))) \
+	$(sort $(subst .y,.tab.o,$(YACC_SOURCES)))
 
 ifndef MOD_OBJS
 MOD_OBJS = $(AUTO_OBJS)

Modified: grass/trunk/lib/db/dbmi_base/dbmscap.c
===================================================================
--- grass/trunk/lib/db/dbmi_base/dbmscap.c	2016-08-22 15:46:20 UTC (rev 69213)
+++ grass/trunk/lib/db/dbmi_base/dbmscap.c	2016-08-22 21:34:34 UTC (rev 69214)
@@ -209,19 +209,22 @@
     return list;
 }
 
+static int cmp_entry(dbDbmscap *a, dbDbmscap *b) {
+  return( a->driverName && b->driverName ? strcmp(a->driverName,b->driverName) : 0 );
+}
+
 static void add_entry(dbDbmscap ** list, char *name, char *startup, char *comment)
 {
+    /* add an entry to the list, so that the list remains ordered (by driverName) */
+
     dbDbmscap *head, *cur, *tail;
 
-    /* add this entry to the head of a linked list */
-    tail = head = *list;
-    while (tail && tail->next)
-	tail = tail->next;
-    *list = NULL;
-
     cur = (dbDbmscap *) db_malloc(sizeof(dbDbmscap));
-    if (cur == NULL)
-	return;			/* out of memory */
+    if (cur == NULL) {
+        *list = NULL;
+	return;
+        /* out of memory */
+    }
     cur->next = NULL;
 
     /* copy each item to the dbmscap structure */
@@ -229,11 +232,21 @@
     strcpy(cur->startup, startup);
     strcpy(cur->comment, comment);
 
+    /* find the last entry that is less than cur */
+    tail = head = *list;
+    while (tail && tail->next && cmp_entry(tail->next,cur)<0)
+	tail = tail->next;
+
     /* handle the first call (head == NULL) */
-    if (tail)
-	tail->next = cur;
-    else
-	head = cur;
+    if (tail && cmp_entry(tail,cur)<0) {
+        /* insert right after tail */
+        cur->next = tail->next;
+        tail->next = cur;
+    } else {
+        /* insert at first position */
+        cur->next = head;
+        head = cur;
+    }
 
     *list = head;
 }



More information about the grass-commit mailing list