forked from pool/fontforge
- Add reproducible.patch to override font build dates (boo#1047218) - repack sources to .xz since we have to repack already OBS-URL: https://build.opensuse.org/request/show/626785 OBS-URL: https://build.opensuse.org/package/show/M17N/fontforge?expand=0&rev=68
179 lines
5.2 KiB
Diff
179 lines
5.2 KiB
Diff
From 4e850c134200d5a62bdecdd68a4ee31ef7688360 Mon Sep 17 00:00:00 2001
|
|
From: Gioele Barabucci <gioele@svario.it>
|
|
Date: Sat, 2 Sep 2017 12:08:06 +0200
|
|
Subject: [PATCH 1/3] Add GetTime function: override time(2) in case
|
|
SOURCE_DATE_EPOCH is set
|
|
|
|
---
|
|
fontforge/splinefont.c | 6 ++----
|
|
gutils/gutils.c | 10 ++++++++++
|
|
inc/gutils.h | 3 +++
|
|
3 files changed, 15 insertions(+), 4 deletions(-)
|
|
|
|
diff --git a/fontforge/splinefont.c b/fontforge/splinefont.c
|
|
index 4cd7d6a7b..92c8ef1c5 100644
|
|
--- a/fontforge/splinefont.c
|
|
+++ b/fontforge/splinefont.c
|
|
@@ -55,7 +55,7 @@
|
|
#include <sys/types.h>
|
|
#include <sys/stat.h>
|
|
#include <gfile.h>
|
|
-#include <time.h>
|
|
+#include <gutils.h>
|
|
#include "unicoderange.h"
|
|
#include "psfont.h"
|
|
#include <locale.h>
|
|
@@ -604,9 +604,7 @@ return( true );
|
|
}
|
|
|
|
void SFSetModTime(SplineFont *sf) {
|
|
- time_t now;
|
|
- time(&now);
|
|
- sf->modificationtime = now;
|
|
+ sf->modificationtime = GetTime();
|
|
}
|
|
|
|
static SplineFont *_SFReadPostScript(FILE *file,char *filename) {
|
|
diff --git a/gutils/gutils.c b/gutils/gutils.c
|
|
index bc945e8b9..72334fc2f 100644
|
|
--- a/gutils/gutils.c
|
|
+++ b/gutils/gutils.c
|
|
@@ -89,3 +89,13 @@ return( ret );
|
|
#endif
|
|
}
|
|
|
|
+time_t GetTime(void) {
|
|
+ time_t now;
|
|
+ if (getenv("SOURCE_DATE_EPOCH")) {
|
|
+ now = atol(getenv("SOURCE_DATE_EPOCH"));
|
|
+ } else {
|
|
+ now = time(NULL);
|
|
+ }
|
|
+
|
|
+ return now;
|
|
+}
|
|
diff --git a/inc/gutils.h b/inc/gutils.h
|
|
index 90b087641..112de734f 100644
|
|
--- a/inc/gutils.h
|
|
+++ b/inc/gutils.h
|
|
@@ -27,8 +27,11 @@
|
|
#ifndef _GUTILS_H
|
|
#define _GUTILS_H
|
|
|
|
+#include <time.h>
|
|
+
|
|
extern int16 div_tables[257][2];
|
|
|
|
extern const char *GetAuthor(void);
|
|
+extern time_t GetTime(void);
|
|
|
|
#endif
|
|
|
|
From 24aeddf65139ee50753537070e51b08c80346423 Mon Sep 17 00:00:00 2001
|
|
From: "Bernhard M. Wiedemann" <bwiedemann@suse.de>
|
|
Date: Mon, 18 Sep 2017 14:23:26 +0200
|
|
Subject: [PATCH 2/3] Improve GetTime function
|
|
|
|
to only call getenv once
|
|
---
|
|
gutils/gutils.c | 5 +++--
|
|
1 file changed, 3 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/gutils/gutils.c b/gutils/gutils.c
|
|
index 72334fc2f..de2c3e207 100644
|
|
--- a/gutils/gutils.c
|
|
+++ b/gutils/gutils.c
|
|
@@ -91,8 +91,9 @@ return( ret );
|
|
|
|
time_t GetTime(void) {
|
|
time_t now;
|
|
- if (getenv("SOURCE_DATE_EPOCH")) {
|
|
- now = atol(getenv("SOURCE_DATE_EPOCH"));
|
|
+ const char *source_date_epoch = getenv("SOURCE_DATE_EPOCH");
|
|
+ if (source_date_epoch) {
|
|
+ now = atol(source_date_epoch);
|
|
} else {
|
|
now = time(NULL);
|
|
}
|
|
|
|
From 078a1738a86717b46e02276bd85bb76893688eea Mon Sep 17 00:00:00 2001
|
|
From: "Bernhard M. Wiedemann" <bwiedemann@suse.de>
|
|
Date: Mon, 18 Sep 2017 14:34:32 +0200
|
|
Subject: [PATCH 3/3] Use GetTime in more places
|
|
|
|
in order to make more kinds of font operations reproducible
|
|
---
|
|
fontforge/dumppfa.c | 4 ++--
|
|
fontforge/splinesaveafm.c | 4 ++--
|
|
fontforge/tottf.c | 6 +++---
|
|
3 files changed, 7 insertions(+), 7 deletions(-)
|
|
|
|
diff --git a/fontforge/dumppfa.c b/fontforge/dumppfa.c
|
|
index 524b06f85..b88d124a8 100644
|
|
--- a/fontforge/dumppfa.c
|
|
+++ b/fontforge/dumppfa.c
|
|
@@ -52,7 +52,7 @@
|
|
# include <pwd.h>
|
|
#endif
|
|
#include <stdarg.h>
|
|
-#include <time.h>
|
|
+#include <gutils.h>
|
|
#include "psfont.h"
|
|
#include "splinefont.h"
|
|
#include <gdraw.h> /* For image defn */
|
|
@@ -1763,7 +1763,7 @@ static void dumpfontcomments(void (*dumpchar)(int ch,void *data), void *data,
|
|
time_t now;
|
|
const char *author = GetAuthor();
|
|
|
|
- time(&now);
|
|
+ now = GetTime();
|
|
/* Werner points out that the DSC Version comment has a very specific */
|
|
/* syntax. We can't just put in a random string, must be <real> <int> */
|
|
/* So we can sort of do that for CID fonts (give it a <revsion> of 0 */
|
|
diff --git a/fontforge/splinesaveafm.c b/fontforge/splinesaveafm.c
|
|
index d37a69f32..420770cb4 100644
|
|
--- a/fontforge/splinesaveafm.c
|
|
+++ b/fontforge/splinesaveafm.c
|
|
@@ -46,7 +46,7 @@
|
|
#include "splineutil.h"
|
|
#include <utype.h>
|
|
#include <ustring.h>
|
|
-#include <time.h>
|
|
+#include <gutils.h>
|
|
#include <math.h>
|
|
|
|
#include <sys/types.h> /* For stat */
|
|
@@ -1183,7 +1183,7 @@ static void AfmSplineFontHeader(FILE *afm, SplineFont *sf, int formattype,
|
|
iscid ? "StartFontMetrics 4.1\n" :
|
|
"StartFontMetrics 2.0\n" );
|
|
fprintf( afm, "Comment Generated by FontForge %d\n", FONTFORGE_VERSIONDATE_RAW );
|
|
- time(&now);
|
|
+ now = GetTime();
|
|
fprintf(afm,"Comment Creation Date: %s", ctime(&now));
|
|
fprintf( afm, "FontName %s\n", sf->fontname );
|
|
if ( sf->fullname!=NULL ) fprintf( afm, "FullName %s\n", sf->fullname );
|
|
diff --git a/fontforge/tottf.c b/fontforge/tottf.c
|
|
index f53da3fee..b3e065fdb 100644
|
|
--- a/fontforge/tottf.c
|
|
+++ b/fontforge/tottf.c
|
|
@@ -52,7 +52,7 @@
|
|
#include "ttfspecial.h"
|
|
#include <math.h>
|
|
#include <unistd.h>
|
|
-#include <time.h>
|
|
+#include <gutils.h>
|
|
#include <locale.h>
|
|
#include <utype.h>
|
|
#include <ustring.h>
|
|
@@ -3831,8 +3831,8 @@ void DefaultTTFEnglishNames(struct ttflangname *dummy, SplineFont *sf) {
|
|
if ( dummy->names[ttf_subfamily]==NULL || *dummy->names[ttf_subfamily]=='\0' )
|
|
dummy->names[ttf_subfamily] = utf8_verify_copy(SFGetModifiers(sf));
|
|
if ( dummy->names[ttf_uniqueid]==NULL || *dummy->names[ttf_uniqueid]=='\0' ) {
|
|
- time(&now);
|
|
- tm = localtime(&now);
|
|
+ now = GetTime();
|
|
+ tm = gmtime(&now);
|
|
snprintf( buffer, sizeof(buffer), "%s : %s : %d-%d-%d",
|
|
BDFFoundry?BDFFoundry:TTFFoundry?TTFFoundry:"FontForge 2.0",
|
|
sf->fullname!=NULL?sf->fullname:sf->fontname,
|