Преглед на файлове

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
To be solved: 04-srand48_auto-from-SOURCE_DATE_EPOCH.patch
(see https://trac.osgeo.org/grass/ticket/3042)


git-svn-id: https://svn.osgeo.org/grass/grass/branches/releasebranch_7_0@69216 15284696-431f-4ddb-bdfa-cd5b030d7da7

Martin Landa преди 8 години
родител
ревизия
c02d89cc67
променени са 4 файла, в които са добавени 31 реда и са изтрити 18 реда
  1. 1 1
      gui/wxpython/tools/build_modules_xml.py
  2. 4 4
      include/Make/Vars.make
  3. 25 12
      lib/db/dbmi_base/dbmscap.c
  4. 1 1
      lib/proj/Makefile

+ 1 - 1
gui/wxpython/tools/build_modules_xml.py

@@ -51,7 +51,7 @@ def parse_modules(fd):
     # 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

+ 4 - 4
include/Make/Vars.make

@@ -13,10 +13,10 @@ LEX_SOURCES  := $(wildcard *.l)
 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)

+ 25 - 12
lib/db/dbmi_base/dbmscap.c

@@ -209,19 +209,22 @@ dbDbmscap *db_read_dbmscap(void)
     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)
 {
-    dbDbmscap *head, *cur, *tail;
+    /* add an entry to the list, so that the list remains ordered (by driverName) */
 
-    /* add this entry to the head of a linked list */
-    tail = head = *list;
-    while (tail && tail->next)
-	tail = tail->next;
-    *list = NULL;
+    dbDbmscap *head, *cur, *tail;
 
     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 @@ static void add_entry(dbDbmscap ** list, char *name, char *startup, char *commen
     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;
 }

+ 1 - 1
lib/proj/Makefile

@@ -37,7 +37,7 @@ $(FTOL_OBJ): $(OBJDIR)/ftol.o
 	$(INSTALL) $< $@
 endif
 
-$(NAD_DSTFILES): $(NAD_DIR)/%: $(NAD_BINFILES) | $(NAD_DIR)
+$(NAD_DSTFILES): $(NAD_DIR)/%: $(OBJDIR)/% | $(NAD_DIR)
 	$(INSTALL_DATA) $< $@
 
 $(NAD_BINFILES): $(OBJDIR)/%: %.lla