[tracker] Don't store path to the source tree in binaries



commit 14d02ddb43ee3ca368527ba68e6b2c5c09960d5c
Author: Sam Thursfield <sam afuera me uk>
Date:   Sat Feb 4 18:27:43 2017 +0100

    Don't store path to the source tree in binaries
    
    The tracker-needle & tracker-preferences tools had a developer
    convenience that would hardcode the path to the source tree into the
    binaries, so that while developing you could edit the .ui files without
    having to rerun `make install` afterwards.
    
    It's not good to enable this sort of thing in non-debug binaries, and
    also it prevents the binaries from being bit-for-bit reproducible.
    
    This problem was detected by the Debian reproducible builds CI system:
    
       https://tests.reproducible-builds.org/tracker

 src/tracker-needle/Makefile.am                   |    1 -
 src/tracker-needle/tracker-needle.vala           |   27 +++++++-------------
 src/tracker-needle/tracker-tags-view.vala        |   26 +++++++------------
 src/tracker-preferences/Makefile.am              |    1 -
 src/tracker-preferences/tracker-preferences.vala |   29 +++++++--------------
 5 files changed, 29 insertions(+), 55 deletions(-)
---
diff --git a/src/tracker-needle/Makefile.am b/src/tracker-needle/Makefile.am
index 14d65cd..f363895 100644
--- a/src/tracker-needle/Makefile.am
+++ b/src/tracker-needle/Makefile.am
@@ -16,7 +16,6 @@ AM_CPPFLAGS =                                          \
        -I$(top_builddir)/src                          \
        -DTRACKER_UI_DIR=\"$(datadir)/tracker/\"       \
        -DLOCALEDIR=\""$(localedir)"\"                 \
-       -DSRCDIR=\"$(abs_srcdir)/\"                    \
        $(TRACKER_NEEDLE_CFLAGS)                       \
        -include config.h
 
diff --git a/src/tracker-needle/tracker-needle.vala b/src/tracker-needle/tracker-needle.vala
index 4abf8d2..856d0d1 100644
--- a/src/tracker-needle/tracker-needle.vala
+++ b/src/tracker-needle/tracker-needle.vala
@@ -23,9 +23,6 @@ using Atk;
 [CCode (cname = "TRACKER_UI_DIR")]
 extern static const string UIDIR;
 
-[CCode (cname = "SRCDIR")]
-extern static const string SRCDIR;
-
 public class Tracker.Needle {
        private GLib.Settings settings_needle = null;
        private const string UI_FILE = "tracker-needle.ui";
@@ -271,22 +268,16 @@ public class Tracker.Needle {
                Paned paned;
 
                try {
-                       //try load from source tree first.
-                       builder.add_from_file (SRCDIR + UI_FILE);
+                       builder.add_from_file (UIDIR + UI_FILE);
                } catch (GLib.Error e) {
-                       //now the install location
-                       try {
-                               builder.add_from_file (UIDIR + UI_FILE);
-                       } catch (GLib.Error e) {
-                               var msg = new MessageDialog (null,
-                                                            DialogFlags.MODAL,
-                                                            MessageType.ERROR,
-                                                            ButtonsType.CANCEL,
-                                                            "Failed to load UI file, %s\n",
-                                                            e.message);
-                               msg.run ();
-                               Gtk.main_quit();
-                       }
+                       var msg = new MessageDialog (null,
+                                                    DialogFlags.MODAL,
+                                                    MessageType.ERROR,
+                                                    ButtonsType.CANCEL,
+                                                    "Failed to load UI file, %s\n",
+                                                    e.message);
+                       msg.run ();
+                       Gtk.main_quit();
                }
 
                Gtk.icon_size_lookup (Gtk.IconSize.MENU, out size_small, null);
diff --git a/src/tracker-needle/tracker-tags-view.vala b/src/tracker-needle/tracker-tags-view.vala
index 4ecffb9..40e9f19 100644
--- a/src/tracker-needle/tracker-tags-view.vala
+++ b/src/tracker-needle/tracker-tags-view.vala
@@ -260,23 +260,17 @@ public class TrackerTagsView : Box {
                var builder = new Gtk.Builder ();
 
                try {
-                       debug ("Trying to use UI file:'%s'", SRCDIR + UI_FILE);
-                       builder.add_from_file (SRCDIR + UI_FILE);
+                       debug ("Trying to use UI file:'%s'", UIDIR + UI_FILE);
+                       builder.add_from_file (UIDIR + UI_FILE);
                } catch (GLib.Error e) {
-                       //now the install location
-                       try {
-                               debug ("Trying to use UI file:'%s'", UIDIR + UI_FILE);
-                               builder.add_from_file (UIDIR + UI_FILE);
-                       } catch (GLib.Error e) {
-                               var msg = new MessageDialog (null,
-                                                            DialogFlags.MODAL,
-                                                            MessageType.ERROR,
-                                                            ButtonsType.CANCEL,
-                                                            "Failed to load UI file, %s\n",
-                                                            e.message);
-                               msg.run ();
-                               Gtk.main_quit ();
-                       }
+                       var msg = new MessageDialog (null,
+                                                    DialogFlags.MODAL,
+                                                    MessageType.ERROR,
+                                                    ButtonsType.CANCEL,
+                                                    "Failed to load UI file, %s\n",
+                                                    e.message);
+                       msg.run ();
+                       Gtk.main_quit ();
                }
 
                // Get widgets from .ui file
diff --git a/src/tracker-preferences/Makefile.am b/src/tracker-preferences/Makefile.am
index 09b32a6..4a23191 100644
--- a/src/tracker-preferences/Makefile.am
+++ b/src/tracker-preferences/Makefile.am
@@ -22,7 +22,6 @@ AM_CPPFLAGS =                                          \
        -I$(top_builddir)/src                          \
        -DTRACKER_UI_DIR=\"$(datadir)/tracker/\"       \
        -DLOCALEDIR=\""$(localedir)"\"                 \
-       -DSRCDIR=\"$(abs_srcdir)/\"                    \
        $(TRACKER_PREFERENCES_CFLAGS)                  \
        -include config.h
 
diff --git a/src/tracker-preferences/tracker-preferences.vala 
b/src/tracker-preferences/tracker-preferences.vala
index f6bfff0..10b92a0 100644
--- a/src/tracker-preferences/tracker-preferences.vala
+++ b/src/tracker-preferences/tracker-preferences.vala
@@ -26,9 +26,6 @@ using Posix;
 [CCode (cname = "TRACKER_UI_DIR")]
 extern static const string UIDIR;
 
-[CCode (cname = "SRCDIR")]
-extern static const string SRCDIR;
-
 public class Tracker.Preferences {
        private GLib.Settings settings_fts = null;
        private GLib.Settings settings_miner_fs = null;
@@ -107,23 +104,17 @@ public class Tracker.Preferences {
                var builder = new Gtk.Builder ();
 
                try {
-                       debug ("Trying to use UI file:'%s'", SRCDIR + UI_FILE);
-                       builder.add_from_file (SRCDIR + UI_FILE);
+                       debug ("Trying to use UI file:'%s'", UIDIR + UI_FILE);
+                       builder.add_from_file (UIDIR + UI_FILE);
                } catch (GLib.Error e) {
-                       //now the install location
-                       try {
-                               debug ("Trying to use UI file:'%s'", UIDIR + UI_FILE);
-                               builder.add_from_file (UIDIR + UI_FILE);
-                       } catch (GLib.Error e) {
-                               var msg = new MessageDialog (null,
-                                                            DialogFlags.MODAL,
-                                                            MessageType.ERROR,
-                                                            ButtonsType.CANCEL,
-                                                            "Failed to load UI file, %s\n",
-                                                            e.message);
-                               msg.run ();
-                               Gtk.main_quit();
-                       }
+                       var msg = new MessageDialog (null,
+                                                    DialogFlags.MODAL,
+                                                    MessageType.ERROR,
+                                                    ButtonsType.CANCEL,
+                                                    "Failed to load UI file, %s\n",
+                                                    e.message);
+                       msg.run ();
+                       Gtk.main_quit();
                }
 
                // Get widgets from .ui file


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