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.
This commit is contained in:
Michael Natterer 2018-03-30 12:45:27 +02:00
parent 4698529dbe
commit 452b1bd558
7 changed files with 76 additions and 18 deletions

View file

@ -245,16 +245,12 @@ endif
# #
dist-dump-gimprc: gimp-console-$(GIMP_APP_VERSION)$(EXEEXT) dist-dump-gimprc: gimp-console-$(GIMP_APP_VERSION)$(EXEEXT)
./$< --dump-gimprc-system > gimprc.tmp \ ./$< --dump-gimprc-system > gimprc.tmp \
&& sed -e "s/num-processors [0-9]*/num-processors 1/" \ && (cmp -s gimprc.tmp $(top_srcdir)/etc/gimprc.in || \
gimprc.tmp > gimprc.tmp2 \ cp gimprc.tmp $(top_srcdir)/etc/gimprc.in) \
&& (cmp -s gimprc.tmp2 $(top_srcdir)/etc/gimprc || \ && rm gimprc.tmp
cp gimprc.tmp2 $(top_srcdir)/etc/gimprc) \
&& rm gimprc.tmp gimprc.tmp2
./$< --dump-gimprc-manpage > gimprc.tmp \ ./$< --dump-gimprc-manpage > gimprc.tmp \
&& sed -e "s/num-processors [0-9]*/num-processors 1/" \ && (cmp -s gimprc.tmp $(top_srcdir)/docs/gimprc.5.in ||\
gimprc.tmp > gimprc.tmp2 \ cp gimprc.tmp $(top_srcdir)/docs/gimprc.5.in) \
&& (cmp -s gimprc.tmp2 $(top_srcdir)/docs/gimprc.5.in ||\ && rm gimprc.tmp
cp gimprc.tmp2 $(top_srcdir)/docs/gimprc.5.in) \
&& rm gimprc.tmp gimprc.tmp2
dist-hook: dist-check-gimp-console dist-dump-gimprc dist-hook: dist-check-gimp-console dist-dump-gimprc

View file

@ -159,7 +159,31 @@ dump_gimprc_system (GimpConfig *rc,
gimp_config_writer_comment_mode (writer, TRUE); gimp_config_writer_comment_mode (writer, TRUE);
gimp_config_writer_linefeed (writer); 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_comment_mode (writer, FALSE);
gimp_config_writer_linefeed (writer); gimp_config_writer_linefeed (writer);
@ -273,6 +297,7 @@ dump_gimprc_manpage (GimpConfig *rc,
{ {
GParamSpec *prop_spec = property_specs[i]; GParamSpec *prop_spec = property_specs[i];
gchar *desc; gchar *desc;
gboolean success;
if (! (prop_spec->flags & GIMP_CONFIG_PARAM_SERIALIZE)) if (! (prop_spec->flags & GIMP_CONFIG_PARAM_SERIALIZE))
continue; continue;
@ -283,7 +308,39 @@ dump_gimprc_manpage (GimpConfig *rc,
g_output_stream_printf (output, NULL, NULL, NULL, g_output_stream_printf (output, NULL, NULL, NULL,
".TP\n"); ".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, g_output_stream_printf (output, NULL, NULL, NULL,
"\n"); "\n");

View file

@ -2668,6 +2668,7 @@ desktop/Makefile
desktop/gimp.desktop.in desktop/gimp.desktop.in
desktop/org.gimp.GIMP.appdata.xml.in desktop/org.gimp.GIMP.appdata.xml.in
etc/Makefile etc/Makefile
etc/gimprc
m4macros/Makefile m4macros/Makefile
po/Makefile.in po/Makefile.in
po-libgimp/Makefile.in po-libgimp/Makefile.in

View file

@ -60,7 +60,7 @@ Sets how many threads GIMP should use for operations that support it. This is
an integer value. an integer value.
.TP .TP
(tile-cache-size 6115246k) (tile-cache-size 2g)
When the amount of pixel data exceeds this limit, GIMP will start to swap 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 tiles to disk. This is a lot slower but it makes it possible to work on

1
etc/.gitignore vendored
View file

@ -1,2 +1,3 @@
/Makefile /Makefile
/Makefile.in /Makefile.in
/gimprc

View file

@ -1,13 +1,16 @@
## Makefile.am for gimp/etc ## Makefile.am for gimp/etc
gimpsysconf_DATA = \ gimpsysconf = \
controllerrc \ controllerrc \
gimprc \
gtkrc \ gtkrc \
menurc \ menurc \
sessionrc \ sessionrc \
templaterc \ templaterc \
unitrc unitrc
gimpsysconf_DATA = \
$(gimpsysconf) \
gimprc
EXTRA_DIST = \ EXTRA_DIST = \
$(gimpsysconf_DATA) $(gimpsysconf)

View file

@ -42,7 +42,7 @@
# specified in bytes, kilobytes, megabytes or gigabytes. If no suffix is # specified in bytes, kilobytes, megabytes or gigabytes. If no suffix is
# specified the size defaults to being specified in kilobytes. # 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 # When enabled, uses OpenCL for some operations. Possible values are yes and
# no. # no.
@ -108,7 +108,7 @@
# Sets the brush search path. This is a colon-separated list of folders to # Sets the brush search path. This is a colon-separated list of folders to
# search. # 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. # This is a colon-separated list of folders to search.
# #