[gdk-pixbuf] queryloaders: Make output more reproducible



commit a42302aeb4194d3ce3343495190409acea28540a
Author: Jussi Kukkonen <jussi kukkonen intel com>
Date:   Fri Jun 9 11:03:19 2017 +0300

    queryloaders: Make output more reproducible
    
    Reproducible builds are good: Sort the output by module name so that
    same input always leads to same output.
    
    This should also make gdk-pixbuf-print-mime-types output and
    gdk-pixbuf-thumbnailer.thumbnailer reproducible.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=783592

 gdk-pixbuf/queryloaders.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/gdk-pixbuf/queryloaders.c b/gdk-pixbuf/queryloaders.c
index a9ca015..a81c804 100644
--- a/gdk-pixbuf/queryloaders.c
+++ b/gdk-pixbuf/queryloaders.c
@@ -341,6 +341,7 @@ int main (int argc, char **argv)
 #ifdef USE_GMODULE
                 const char *path;
                 GDir *dir;
+                GList *l, *modules;
 
                 path = g_getenv ("GDK_PIXBUF_MODULEDIR");
 #ifdef G_OS_WIN32
@@ -352,6 +353,7 @@ int main (int argc, char **argv)
 
                 g_string_append_printf (contents, "# LoaderDir = %s\n#\n", path);
 
+                modules = NULL;
                 dir = g_dir_open (path, 0, NULL);
                 if (dir) {
                         const char *dent;
@@ -360,11 +362,16 @@ int main (int argc, char **argv)
                                 gint len = strlen (dent);
                                 if (len > SOEXT_LEN &&
                                     strcmp (dent + len - SOEXT_LEN, SOEXT) == 0) {
-                                        query_module (contents, path, dent);
+                                        modules = g_list_prepend (modules,
+                                                                  g_strdup (dent));
                                 }
                         }
                         g_dir_close (dir);
                 }
+                modules = g_list_sort (modules, (GCompareFunc)strcmp);
+                for (l = modules; l != NULL; l = l->next)
+                        query_module (contents, path, l->data);
+                g_list_free_full (modules, g_free);
 #else
                 g_string_append_printf (contents, "# dynamic loading of modules not supported\n");
 #endif


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]