View | Details | Raw Unified | Return to bug 34200
Collapse All | Expand All

(-)a/build/files.c (-2 / +26 lines)
Lines 8-13 Link Here
8
8
9
#define	MYALLPERMS	07777
9
#define	MYALLPERMS	07777
10
10
11
#include <stdlib.h>
11
#include <regex.h>
12
#include <regex.h>
12
#include <signal.h>	/* getOutputFrom() */
13
#include <signal.h>	/* getOutputFrom() */
13
14
Lines 997-1003 static void genCpioListAndHeader(Spec spec, /*@partial@*/ FileList fl, Link Here
997
    FileListRec flp;
998
    FileListRec flp;
998
    char buf[BUFSIZ];
999
    char buf[BUFSIZ];
999
    int i;
1000
    int i;
1000
    
1001
    int override_date = 0;
1002
    time_t source_date_epoch;
1003
    const char *srcdate = getenv("SOURCE_DATE_EPOCH");
1004
1005
    /* Limit the maximum date to SOURCE_DATE_EPOCH if defined
1006
     * similar to the tar --clamp-mtime option
1007
     * https://reproducible-builds.org/specs/source-date-epoch/
1008
     */
1009
    if (srcdate && *srcdate) {
1010
	char *endptr;
1011
	errno = 0;
1012
	source_date_epoch = strtol(srcdate, &endptr, 10);
1013
	if (srcdate == endptr || *endptr
1014
	    || ((source_date_epoch == LONG_MIN || source_date_epoch == LONG_MAX)
1015
		&& errno != 0)) {
1016
	    rpmlog(RPMLOG_ERR, _("unable to parse %s=%s\n"), "SOURCE_DATE_EPOCH", srcdate);
1017
	} else {
1018
	    override_date = 1;
1019
	}
1020
    }
1021
1001
    /* Sort the big list */
1022
    /* Sort the big list */
1002
    qsort(fl->fileList, fl->fileListRecsUsed,
1023
    qsort(fl->fileList, fl->fileListRecsUsed,
1003
	  sizeof(*(fl->fileList)), compareFileListRecs);
1024
	  sizeof(*(fl->fileList)), compareFileListRecs);
Lines 1068-1073 static void genCpioListAndHeader(Spec spec, /*@partial@*/ FileList fl, Link Here
1068
	    continue;
1089
	    continue;
1069
	}
1090
	}
1070
1091
1092
	if (override_date && flp->fl_mtime > source_date_epoch) {
1093
	    flp->fl_mtime = source_date_epoch;
1094
	}
1095
1071
	/* Omit '/' and/or URL prefix, leave room for "./" prefix */
1096
	/* Omit '/' and/or URL prefix, leave room for "./" prefix */
1072
	apathlen += (strlen(flp->fileURL) - skipLen + (_addDotSlash ? 3 : 1));
1097
	apathlen += (strlen(flp->fileURL) - skipLen + (_addDotSlash ? 3 : 1));
1073
1098
1074
- 

Return to bug 34200