diff -urNad fontconfig-2.11.0.orig/debian/fontconfig.postinst fontconfig-2.11.0/debian/fontconfig.postinst
--- fontconfig-2.11.0.orig/debian/fontconfig.postinst 2017-05-26 16:30:36.601878709 +0100
+++ fontconfig-2.11.0/debian/fontconfig.postinst 2017-05-26 18:46:26.833464257 +0100
@@ -2,10 +2,28 @@
set -e
+if [ -n "$SOURCE_DATE_EPOCH" ]; then
+ # fontconfig embeds the mtime of each font directory in a "checksum" member
+ # of a "_FcCache" struct. This is so that it can identify which cache files
+ # remain valid and/or require regeneration.
+ #
+ # We therefore "clamp" the mtimes of font directories to SOURCE_DATE_EPOCH
+ # prior to calling fc-cache to avoid these non-deterministic values appearing
+ # in the files themselves. This is safe as we force regeneration in
+ # subsequent fc-cache calls with -f.
+ #
+ # (We can't just replace the checksum value with SOURCE_DATE_EPOCH as it will
+ # result in fontconfig believing the cache to be outdated, defeating the
+ # entire point of generating them in the first place.
+ fc-cache -s --list-dirs | \
+ xargs -I{} find {} -type d -follow -newermt "@$SOURCE_DATE_EPOCH" -print0 2>/dev/null | \
+ xargs -0r touch --date="@$SOURCE_DATE_EPOCH"
+fi
+
if [ "$1" = triggered ]; then
# Force regeneration of all fontconfig cache files.
mkdir -p /var/cache/fontconfig
- fc-cache -s -v 1>/var/log/fontconfig.log 2>&1 || printf "fc-cache failed.\nSee /var/log/fontconfig.log for more information.\n"
+ fc-cache -s -f -v 1>/var/log/fontconfig.log 2>&1 || printf "fc-cache failed.\nSee /var/log/fontconfig.log for more information.\n"
exit 0
fi
diff -urNad fontconfig-2.11.0.orig/fc-cache/fc-cache.1 fontconfig-2.11.0/fc-cache/fc-cache.1
--- fontconfig-2.11.0.orig/fc-cache/fc-cache.1 2017-05-26 16:30:36.585878534 +0100
+++ fontconfig-2.11.0/fc-cache/fc-cache.1 2017-05-26 18:12:58.022734653 +0100
@@ -4,7 +4,7 @@
fc-cache \- build font information cache files
.SH SYNOPSIS
.sp
-\fBfc-cache\fR [ \fB-frsvVh\fR ] [ \fB--force\fR ] [ \fB--really-force\fR ] [ \fB--system-only\fR ] [ \fB--verbose\fR ] [ \fB--version\fR ] [ \fB--help\fR ] [ \fB\fIdir\fB\fR\fI...\fR ]
+\fBfc-cache\fR [ \fB-frsvVh\fR ] [ \fB--force\fR ] [ \fB--really-force\fR ] [ \fB--system-only\fR ] [ \fB--list-dirs\fR ] [ \fB--verbose\fR ] [ \fB--version\fR ] [ \fB--help\fR ] [ \fB\fIdir\fB\fR\fI...\fR ]
.SH "DESCRIPTION"
.PP
\fBfc-cache\fR scans the font directories on
@@ -39,6 +39,9 @@
Only scan system-wide directories, omitting the places
located in the user's home directory.
.TP
+\fB-l\fR
+Only list directories, don't regenerate anything.
+.TP
\fB-v\fR
Display status information while busy.
.TP
diff -urNad fontconfig-2.11.0.orig/fc-cache/fc-cache.c fontconfig-2.11.0/fc-cache/fc-cache.c
--- fontconfig-2.11.0.orig/fc-cache/fc-cache.c 2017-05-26 16:30:36.585878534 +0100
+++ fontconfig-2.11.0/fc-cache/fc-cache.c 2017-05-26 18:13:33.810917986 +0100
@@ -69,6 +69,7 @@
{"really-force", 0, 0, 'r'},
{"sysroot", 0, 0, 'y'},
{"system-only", 0, 0, 's'},
+ {"list-dirs", 0, 0, 'l'},
{"version", 0, 0, 'V'},
{"verbose", 0, 0, 'v'},
{"help", 0, 0, 'h'},
@@ -86,10 +87,10 @@
{
FILE *file = error ? stderr : stdout;
#if HAVE_GETOPT_LONG
- fprintf (file, "usage: %s [-frsvVh] [-y SYSROOT] [--force|--really-force] [--sysroot=SYSROOT] [--system-only] [--verbose] [--version] [--help] [dirs]\n",
+ fprintf (file, "usage: %s [-frsvVh] [-y SYSROOT] [--force|--really-force] [--sysroot=SYSROOT] [--system-only] [--list-dirs] [--verbose] [--version] [--help] [dirs]\n",
program);
#else
- fprintf (file, "usage: %s [-frsvVh] [-y SYSROOT] [dirs]\n",
+ fprintf (file, "usage: %s [-frslvVh] [-y SYSROOT] [dirs]\n",
program);
#endif
fprintf (file, "Build font information caches in [dirs]\n"
@@ -100,6 +101,7 @@
fprintf (file, " -r, --really-force erase all existing caches, then rescan\n");
fprintf (file, " -s, --system-only scan system-wide directories only\n");
fprintf (file, " -y, --sysroot=SYSROOT prepend SYSROOT to all paths for scanning\n");
+ fprintf (file, " -l, --list-dirs list directories only\n");
fprintf (file, " -v, --verbose display status information while busy\n");
fprintf (file, " -V, --version display font config version and exit\n");
fprintf (file, " -h, --help display this help and exit\n");
@@ -108,6 +110,7 @@
fprintf (file, " -r, (really force) erase all existing caches, then rescan\n");
fprintf (file, " -s (system) scan system-wide directories only\n");
fprintf (file, " -y SYSROOT (sysroot) prepend SYSROOT to all paths for scanning\n");
+ fprintf (file, " -l (list-dirs) list directories only\n");
fprintf (file, " -v (verbose) display status information while busy\n");
fprintf (file, " -V (version) display font config version and exit\n");
fprintf (file, " -h (help) display this help and exit\n");
@@ -277,18 +280,20 @@
FcBool force = FcFalse;
FcBool really_force = FcFalse;
FcBool systemOnly = FcFalse;
+ FcBool listDirs = FcFalse;
FcConfig *config;
FcChar8 *sysroot = NULL;
+ FcChar8 *dir;
int i;
int changed;
- int ret;
+ int ret = 0;
#if HAVE_GETOPT_LONG || HAVE_GETOPT
int c;
#if HAVE_GETOPT_LONG
- while ((c = getopt_long (argc, argv, "frsy:Vvh", longopts, NULL)) != -1)
+ while ((c = getopt_long (argc, argv, "frsly:Vvh", longopts, NULL)) != -1)
#else
- while ((c = getopt (argc, argv, "frsy:Vvh")) != -1)
+ while ((c = getopt (argc, argv, "frsly:Vvh")) != -1)
#endif
{
switch (c) {
@@ -304,6 +309,9 @@
case 'y':
sysroot = FcStrCopy ((const FcChar8 *)optarg);
break;
+ case 'l':
+ listDirs = FcTrue;
+ break;
case 'V':
fprintf (stderr, "fontconfig version %d.%d.%d\n",
FC_MAJOR, FC_MINOR, FC_REVISION);
@@ -365,6 +373,13 @@
else
list = FcConfigGetConfigDirs (config);
+ if (listDirs)
+ {
+ while ((dir = FcStrListNext (list)))
+ printf ("%s\n", dir);
+ goto done;
+ }
+
if ((processed_dirs = FcStrSetCreate()) == NULL) {
fprintf(stderr, "Cannot malloc\n");
return 1;
@@ -388,6 +403,7 @@
cleanCacheDirectories (config, verbose);
+done:
FcConfigDestroy (config);
FcFini ();
/*
diff -urNad fontconfig-2.11.0.orig/fc-cache/fc-cache.sgml fontconfig-2.11.0/fc-cache/fc-cache.sgml
--- fontconfig-2.11.0.orig/fc-cache/fc-cache.sgml 2017-05-26 16:30:36.585878534 +0100
+++ fontconfig-2.11.0/fc-cache/fc-cache.sgml 2017-05-26 18:10:26.789976370 +0100
@@ -67,6 +67,7 @@
+
@@ -129,6 +130,14 @@
+
+
+
+
+ Only list directories, don't regenerate anything.
+
+
+