[gimp] Stop leaking properties of the distcheck machine into the tarball



commit 452b1bd5584b619ae6c575fd2a19dd767222f96d
Author: Michael Natterer <mitch gimp org>
Date:   Fri Mar 30 12:45:27 2018 +0200

    Stop leaking properties of the distcheck machine into the tarball
    
    Some gimprc properties' default values depend on the machine where
    "make dist" in run. We had an ugly hack in place to force
    (num-processors 1) in the installed system gimprc and its manpage, but
    were still leaking "tile-cache-size" and "mypaint-brush-path".
    
    The files are generated by the hidden options --dump-gimprc-system
    and --dump-gimprc-manpage which exist only for this purpose.
    
    In gimpconfig-dump.c, special case the three properties in
    dump_gimprc_system() and dump_gimprc_manpage() to output constant
    default values for "num-processors" and "tile-cache-size" and
    output @mypaint_brushes_dir@ in "mypaint-brush-path" which can
    be replaced at configure time.
    
    Also introduce etc/gimprc.in so @mypaint_brushes_dir@ can actually be
    substituted for the installed system gimprc.

 app/Makefile.am              |   16 ++++-------
 app/config/gimpconfig-dump.c |   61 ++++++++++++++++++++++++++++++++++++++++-
 configure.ac                 |    1 +
 docs/gimprc.5.in             |    2 +-
 etc/.gitignore               |    1 +
 etc/Makefile.am              |    9 ++++--
 etc/{gimprc => gimprc.in}    |    4 +-
 7 files changed, 76 insertions(+), 18 deletions(-)
---
diff --git a/app/Makefile.am b/app/Makefile.am
index 5cc6dfb..605a270 100644
--- a/app/Makefile.am
+++ b/app/Makefile.am
@@ -245,16 +245,12 @@ endif
 #
 dist-dump-gimprc: gimp-console-$(GIMP_APP_VERSION)$(EXEEXT)
        ./$< --dump-gimprc-system > gimprc.tmp  \
-               && sed -e "s/num-processors [0-9]*/num-processors 1/"   \
-                  gimprc.tmp > gimprc.tmp2                             \
-               && (cmp -s gimprc.tmp2 $(top_srcdir)/etc/gimprc ||      \
-                   cp gimprc.tmp2 $(top_srcdir)/etc/gimprc)            \
-               && rm gimprc.tmp gimprc.tmp2
+               && (cmp -s gimprc.tmp $(top_srcdir)/etc/gimprc.in ||    \
+                   cp gimprc.tmp $(top_srcdir)/etc/gimprc.in)          \
+               && rm gimprc.tmp
        ./$< --dump-gimprc-manpage > gimprc.tmp \
-               && sed -e "s/num-processors [0-9]*/num-processors 1/"   \
-                  gimprc.tmp > gimprc.tmp2                             \
-               && (cmp -s gimprc.tmp2 $(top_srcdir)/docs/gimprc.5.in ||\
-                   cp gimprc.tmp2 $(top_srcdir)/docs/gimprc.5.in)      \
-               && rm gimprc.tmp gimprc.tmp2
+               && (cmp -s gimprc.tmp $(top_srcdir)/docs/gimprc.5.in ||\
+                   cp gimprc.tmp $(top_srcdir)/docs/gimprc.5.in)       \
+               && rm gimprc.tmp
 
 dist-hook: dist-check-gimp-console dist-dump-gimprc
diff --git a/app/config/gimpconfig-dump.c b/app/config/gimpconfig-dump.c
index ee1bad3..3f23795 100644
--- a/app/config/gimpconfig-dump.c
+++ b/app/config/gimpconfig-dump.c
@@ -159,7 +159,31 @@ dump_gimprc_system (GimpConfig       *rc,
       gimp_config_writer_comment_mode (writer, TRUE);
       gimp_config_writer_linefeed (writer);
 
-      gimp_config_serialize_property (rc, prop_spec, writer);
+      if (! strcmp (prop_spec->name, "num-processors"))
+        {
+          gimp_config_writer_open (writer, "num-processors");
+          gimp_config_writer_printf (writer, "1");
+          gimp_config_writer_close (writer);
+        }
+      else if (! strcmp (prop_spec->name, "tile-cache-size"))
+        {
+          gimp_config_writer_open (writer, "tile-cache-size");
+          gimp_config_writer_printf (writer, "2g");
+          gimp_config_writer_close (writer);
+        }
+      else if (! strcmp (prop_spec->name, "mypaint-brush-path"))
+        {
+          gimp_config_writer_open (writer, "mypaint-brush-path");
+          gimp_config_writer_printf (writer,
+                                     "\"@mypaint_brushes_dir@%s"
+                                     "~/.mypaint/brushes\"",
+                                     G_SEARCHPATH_SEPARATOR_S);
+          gimp_config_writer_close (writer);
+        }
+      else
+        {
+          gimp_config_serialize_property (rc, prop_spec, writer);
+        }
 
       gimp_config_writer_comment_mode (writer, FALSE);
       gimp_config_writer_linefeed (writer);
@@ -273,6 +297,7 @@ dump_gimprc_manpage (GimpConfig       *rc,
     {
       GParamSpec *prop_spec = property_specs[i];
       gchar      *desc;
+      gboolean    success;
 
       if (! (prop_spec->flags & GIMP_CONFIG_PARAM_SERIALIZE))
         continue;
@@ -283,7 +308,39 @@ dump_gimprc_manpage (GimpConfig       *rc,
       g_output_stream_printf (output, NULL, NULL, NULL,
                               ".TP\n");
 
-      if (gimp_config_serialize_property (rc, prop_spec, writer))
+      if (! strcmp (prop_spec->name, "num-processors"))
+        {
+          gimp_config_writer_open (writer, "num-processors");
+          gimp_config_writer_printf (writer, "1");
+          gimp_config_writer_close (writer);
+
+          success = TRUE;
+        }
+      else if (! strcmp (prop_spec->name, "tile-cache-size"))
+        {
+          gimp_config_writer_open (writer, "tile-cache-size");
+          gimp_config_writer_printf (writer, "2g");
+          gimp_config_writer_close (writer);
+
+          success = TRUE;
+        }
+      else if (! strcmp (prop_spec->name, "mypaint-brush-path"))
+        {
+          gimp_config_writer_open (writer, "mypaint-brush-path");
+          gimp_config_writer_printf (writer,
+                                     "\"@mypaint_brushes_dir@%s"
+                                     "~/.mypaint/brushes\"",
+                                     G_SEARCHPATH_SEPARATOR_S);
+          gimp_config_writer_close (writer);
+
+          success = TRUE;
+        }
+      else
+        {
+          success = gimp_config_serialize_property (rc, prop_spec, writer);
+        }
+
+      if (success)
         {
           g_output_stream_printf (output, NULL, NULL, NULL,
                                   "\n");
diff --git a/configure.ac b/configure.ac
index 9bbc0b8..e8e04f2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2668,6 +2668,7 @@ desktop/Makefile
 desktop/gimp.desktop.in
 desktop/org.gimp.GIMP.appdata.xml.in
 etc/Makefile
+etc/gimprc
 m4macros/Makefile
 po/Makefile.in
 po-libgimp/Makefile.in
diff --git a/docs/gimprc.5.in b/docs/gimprc.5.in
index b4ee89a..1c233f7 100644
--- a/docs/gimprc.5.in
+++ b/docs/gimprc.5.in
@@ -60,7 +60,7 @@ Sets how many threads GIMP should use for operations that support it.  This is
 an integer value.
 
 .TP
-(tile-cache-size 6115246k)
+(tile-cache-size 2g)
 
 When the amount of pixel data exceeds this limit, GIMP will start to swap
 tiles to disk.  This is a lot slower but it makes it possible to work on
diff --git a/etc/.gitignore b/etc/.gitignore
index b336cc7..67d7d09 100644
--- a/etc/.gitignore
+++ b/etc/.gitignore
@@ -1,2 +1,3 @@
 /Makefile
 /Makefile.in
+/gimprc
diff --git a/etc/Makefile.am b/etc/Makefile.am
index 7ab896a..2e8af80 100644
--- a/etc/Makefile.am
+++ b/etc/Makefile.am
@@ -1,13 +1,16 @@
 ## Makefile.am for gimp/etc
 
-gimpsysconf_DATA = \
+gimpsysconf = \
        controllerrc    \
-       gimprc          \
        gtkrc           \
        menurc          \
        sessionrc       \
        templaterc      \
        unitrc
 
+gimpsysconf_DATA = \
+       $(gimpsysconf)  \
+       gimprc
+
 EXTRA_DIST = \
-       $(gimpsysconf_DATA)
+       $(gimpsysconf)
diff --git a/etc/gimprc b/etc/gimprc.in
similarity index 99%
rename from etc/gimprc
rename to etc/gimprc.in
index 1f6245c..516deb1 100644
--- a/etc/gimprc
+++ b/etc/gimprc.in
@@ -42,7 +42,7 @@
 # specified in bytes, kilobytes, megabytes or gigabytes. If no suffix is
 # specified the size defaults to being specified in kilobytes.
 # 
-# (tile-cache-size 6115246k)
+# (tile-cache-size 2g)
 
 # When enabled, uses OpenCL for some operations.  Possible values are yes and
 # no.
@@ -108,7 +108,7 @@
 # Sets the brush search path.  This is a colon-separated list of folders to
 # search.
 # 
-# (mypaint-brush-path "/local/head/share/mypaint-data/1.0/brushes:~/.mypaint/brushes")
+# (mypaint-brush-path "@mypaint_brushes_dir@:~/.mypaint/brushes")
 
 # This is a colon-separated list of folders to search.
 # 


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