Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE
dc3dd
reproducible.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File reproducible.patch of Package dc3dd
Index: root/osc/openSUSE:Factory/dc3dd/dc3dd-7.2.641/man/help2man =================================================================== --- dc3dd-7.2.641/man/help2man +++ dc3dd-7.2.641/man/help2man @@ -242,7 +242,7 @@ $version_text ||= get_option_value $ARGV # the English version expands to the month as a word and the full year. It # is used on the footer of the generated manual pages. If in doubt, you may # just use %x as the value (which should be the full locale-specific date). -my $date = enc strftime _("%B %Y"), localtime; +my $date = enc strftime _("%B %Y"), gmtime($ENV{SOURCE_DATE_EPOCH} || time); (my $program = $ARGV[0]) =~ s!.*/!!; my $package = $program; my $version; Index: root/osc/openSUSE:Factory/dc3dd/dc3dd-7.2.641/src/dc3dd.c =================================================================== --- dc3dd-7.2.641/src/dc3dd.c +++ dc3dd-7.2.641/src/dc3dd.c @@ -637,13 +637,48 @@ report_error(int status, int errnum, con usage(status); } +time_t reproducible_time() +{ + time_t now; + char *source_date_epoch; + unsigned long long epoch; + char *endptr; + + 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); + } + return now; +} + // End code copied (and modified) from ../lib/error.c static char* get_formatted_time_string() { // Get the current local time. - time_t t = time(NULL); + time_t t = reproducible_time(); struct tm tm; struct tm* ret = localtime_r(&t, &tm); if (ret == NULL)
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor