Honour an external definition of SOURCE_DATE_EPOCH when updating the embedded modification date in TTF/TTC files. --- a/lib/tatime.c +++ b/lib/tatime.c @@ -15,6 +15,8 @@ #include #include +#include +#include #include "ta.h" @@ -27,12 +29,51 @@ TA_get_current_time(FT_ULong* high, { /* there have been 24107 days between January 1st, 1904 (the epoch of */ /* OpenType), and January 1st, 1970 (the epoch of the `time' function) */ - TA_ULongLong seconds_to_1970 = 24107 * 24 * 60 * 60; - TA_ULongLong seconds_to_today = seconds_to_1970 + (TA_ULongLong)time(NULL); + const TA_ULongLong seconds_to_1970 = 24107 * 24 * 60 * 60; + TA_ULongLong seconds_to_build; + time_t now; + char *source_date_epoch, *endptr; + TA_ULongLong epoch; + source_date_epoch = getenv("SOURCE_DATE_EPOCH"); + if (source_date_epoch) { + errno = 0; + epoch = strtoull(source_date_epoch, &endptr, 10); + if ((errno == ERANGE && (epoch == ULLONG_MAX || epoch == 0)) + || (errno != 0 && epoch == 0)) { + fprintf(stderr, + "Environment variable $SOURCE_DATE_EPOCH: strtoull: %s\n", + strerror(errno)); + exit(EXIT_FAILURE); + } + if (endptr == source_date_epoch) { + fprintf(stderr, + "Environment variable $SOURCE_DATE_EPOCH: No digits were found: %s\n", + endptr); + exit(EXIT_FAILURE); + } + if (*endptr != '\0') { + fprintf(stderr, + "Environment variable $SOURCE_DATE_EPOCH: Trailing garbage: %s\n", + endptr); + exit(EXIT_FAILURE); + } + if (epoch > ULONG_MAX) { + fprintf(stderr, + "Environment variable $SOURCE_DATE_EPOCH: value must be smaller " + "than or equal to: %lu but was found to be: %llu \n", + ULONG_MAX, epoch); + exit(EXIT_FAILURE); + } + now = epoch; + } else { + now = time(NULL); + } - *high = (FT_ULong)(seconds_to_today >> 32); - *low = (FT_ULong)seconds_to_today; + seconds_to_build = seconds_to_1970 + (TA_ULongLong)now; + + *high = (FT_ULong)(seconds_to_build >> 32); + *low = (FT_ULong)seconds_to_build; } /* end of tatime.c */ 27f4ed14b44'>root/gnu/installer/newt/hostname.scm
AgeCommit message (Expand)Author
2019-01-17installer: Make sure every sentence is dot terminated....gnu/installer/newt/hostname.scm: Finish sentences by a dot. gnu/installer/newt/network.scm: Ditto. gnu/installer/newt/page.scm: Ditto. gnu/installer/newt/partition.scm: Ditto. gnu/installer/newt/user.scm: Ditto. gnu/installer/newt/wifi.scm: Ditto. Mathieu Othacehe
2019-01-17installer: Remove "selection" from all titles....* gnu/installer/newt/hostname.scm (run-hostname-page): Remove selection from page title, (run-variant-page): ditto. * gnu/installer/newt/keymap.scm (run-layout-page): Ditto. * gnu/installer/newt/locale.scm (run-layout-page): Ditto, (run-territory-page): ditto, (run-codeset-page): ditto, (run-modifier-page): ditto * gnu/installer/newt/network.scm (run-territory-page): Ditto. * gnu/installer/newt/timezone.scm (run-timezone-page): Ditto. * gnu/installer/newt/wifi.scm (run-wifi-page): Ditto. Mathieu Othacehe
2019-01-17gnu: Add graphical installer support....* configure.ac: Require that guile-newt is available. * gnu/installer.scm: New file. * gnu/installer/aux-files/logo.txt: New file. * gnu/installer/build-installer.scm: New file. * gnu/installer/connman.scm: New file. * gnu/installer/keymap.scm: New file. * gnu/installer/locale.scm: New file. * gnu/installer/newt.scm: New file. * gnu/installer/newt/ethernet.scm: New file. * gnu/installer/newt/hostname.scm: New file. * gnu/installer/newt/keymap.scm: New file. * gnu/installer/newt/locale.scm: New file. * gnu/installer/newt/menu.scm: New file. * gnu/installer/newt/network.scm: New file. * gnu/installer/newt/page.scm: New file. * gnu/installer/newt/timezone.scm: New file. * gnu/installer/newt/user.scm: New file. * gnu/installer/newt/utils.scm: New file. * gnu/installer/newt/welcome.scm: New file. * gnu/installer/newt/wifi.scm: New file. * gnu/installer/steps.scm: New file. * gnu/installer/timezone.scm: New file. * gnu/installer/utils.scm: New file. * gnu/local.mk (GNU_SYSTEM_MODULES): Add previous files. * gnu/system.scm: Export %root-account. * gnu/system/install.scm (%installation-services): Use kmscon instead of linux VT for all tty. (installation-os)[users]: Add the graphical installer as shell of the root account. [packages]: Add font related packages. * po/guix/POTFILES.in: Add installer files. Mathieu Othacehe