From c2fc62a232800d3a4b60174bddacf6812ffb3a44c32c6d81f2e644bf8cff6312 Mon Sep 17 00:00:00 2001 From: OBS User mrdocs Date: Fri, 3 Aug 2018 03:17:57 +0000 Subject: [PATCH] Accepting request 626785 from home:bmwiedemann:reproducible - 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 --- fontforge-20170731-repacked.tar.gz | 3 - fontforge-20170731-repacked.tar.xz | 3 + fontforge.changes | 6 + fontforge.spec | 7 +- get-source.sh | 3 +- reproducible.patch | 178 +++++++++++++++++++++++++++++ 6 files changed, 194 insertions(+), 6 deletions(-) delete mode 100644 fontforge-20170731-repacked.tar.gz create mode 100644 fontforge-20170731-repacked.tar.xz create mode 100644 reproducible.patch diff --git a/fontforge-20170731-repacked.tar.gz b/fontforge-20170731-repacked.tar.gz deleted file mode 100644 index 0ff178c..0000000 --- a/fontforge-20170731-repacked.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:15cabf350fddf7b231c52ba6dcf3ae607ed2b71f87c8f231a5b345406e289bfa -size 43916570 diff --git a/fontforge-20170731-repacked.tar.xz b/fontforge-20170731-repacked.tar.xz new file mode 100644 index 0000000..200d494 --- /dev/null +++ b/fontforge-20170731-repacked.tar.xz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8d9737722d06501228af2c9f3b25bf40bc54bf7411503b93761f0b87a76750fc +size 30215008 diff --git a/fontforge.changes b/fontforge.changes index 8372150..3393bb7 100644 --- a/fontforge.changes +++ b/fontforge.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Wed Aug 1 03:37:01 UTC 2018 - bwiedemann@suse.com + +- Add reproducible.patch to override font build dates (boo#1047218) +- repack sources to .xz since we have to repack already + ------------------------------------------------------------------- Mon Dec 18 10:41:08 UTC 2017 - pgajdos@suse.com diff --git a/fontforge.spec b/fontforge.spec index 2dda05d..d44d535 100644 --- a/fontforge.spec +++ b/fontforge.spec @@ -24,12 +24,14 @@ License: GPL-3.0+ Group: Productivity/Graphics/Vector Editors Url: http://fontforge.org/ # Source: https://github.com/fontforge/fontforge/archive/%{version}.tar.gz -# see bug 926061, fontforge-*-repacked.tar.gz does not contain fontforge-*/win/gold/libX11-*.noarch.rpm -Source0: fontforge-%{version}-repacked.tar.gz +# see bug 926061, fontforge-*-repacked.tar.xz does not contain fontforge-*/win/gold/libX11-*.noarch.rpm +Source0: fontforge-%{version}-repacked.tar.xz Source1: get-source.sh # workardound for bug 930076, imho upstream should fix this # https://github.com/fontforge/fontforge/issues/2270 Patch0: fontforge-version.patch +# PATCH-FIX-UPSTREAM bmwiedemann https://github.com/fontforge/fontforge/pull/3152 +Patch1: reproducible.patch BuildRequires: autoconf BuildRequires: automake BuildRequires: cairo-devel @@ -96,6 +98,7 @@ to develop applications that use FontForge libraries. %prep %setup -q %patch0 +%patch1 -p1 sed -i 's/\r$//' doc/html/{Big5.txt,corpchar.txt} # workaround for bug 930076; we just need the _version_of_the_release_! (see also fontforge-version.patch) --- grep 'doversion(FONTFORGE_MODTIME_STR)' fontforgeexe/startnoui.c && \ diff --git a/get-source.sh b/get-source.sh index 3f98200..637fcc0 100644 --- a/get-source.sh +++ b/get-source.sh @@ -17,11 +17,12 @@ tar xf $VERSION.tar.gz pushd fontforge-$VERSION # do not depend on git git clone https://github.com/troydhanson/uthash +git clone --depth 1 https://github.com/coreutils/gnulib.git gnulib # remove not shippable files (bug 926061) rm win/gold/libX11-*.noarch.rpm ./bootstrap --copy --force popd -tar czf fontforge-$VERSION-repacked.tar.gz fontforge-$VERSION +tar cJf fontforge-$VERSION-repacked.tar.xz fontforge-$VERSION rm -rf fontforge-$VERSION rm $VERSION.tar.gz diff --git a/reproducible.patch b/reproducible.patch new file mode 100644 index 0000000..013b50b --- /dev/null +++ b/reproducible.patch @@ -0,0 +1,178 @@ +From 4e850c134200d5a62bdecdd68a4ee31ef7688360 Mon Sep 17 00:00:00 2001 +From: Gioele Barabucci +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 + #include + #include +-#include ++#include + #include "unicoderange.h" + #include "psfont.h" + #include +@@ -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 ++ + 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" +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" +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 + #endif + #include +-#include ++#include + #include "psfont.h" + #include "splinefont.h" + #include /* 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 */ + /* So we can sort of do that for CID fonts (give it a 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 + #include +-#include ++#include + #include + + #include /* 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 + #include +-#include ++#include + #include + #include + #include +@@ -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,