New environment variable SOURCE_DATE_EPOCH
This commit is contained in:
@@ -2549,10 +2549,70 @@ ex:;
|
||||
}
|
||||
|
||||
|
||||
/* https://reproducible-builds.org/specs/source-date-epoch/
|
||||
and reproducible-builds@lists.alioth.debian.org in august 2016
|
||||
*/
|
||||
int Xorriso_source_date_epoch(struct XorrisO *xorriso, int flag)
|
||||
{
|
||||
char *sec_text, double_text[40];
|
||||
double dsec= -1.0;
|
||||
time_t tsec;
|
||||
struct tm *gmt;
|
||||
|
||||
sec_text= getenv("SOURCE_DATE_EPOCH");
|
||||
if(sec_text == NULL)
|
||||
return(2);
|
||||
|
||||
sscanf(sec_text, "%lf", &dsec);
|
||||
sprintf(double_text, "%.f", dsec);
|
||||
tsec= dsec;
|
||||
if(dsec < 0 || ((double) tsec) != dsec ||
|
||||
strcmp(sec_text, double_text) != 0) {
|
||||
malformed:;
|
||||
Xorriso_msgs_submit(xorriso, 0,
|
||||
"Malformed environment variable SOURCE_DATE_EPOCH encountered",
|
||||
0, "SORRY", 0);
|
||||
Xorriso_msgs_submit(xorriso, 0,
|
||||
"Unset SOURCE_DATE_EPOCH before starting xorriso or see https://reproducible-builds.org/specs/source-date-epoch/",
|
||||
0, "HINT", 0);
|
||||
return(0);
|
||||
}
|
||||
gmt= gmtime(&tsec);
|
||||
if(gmt == NULL)
|
||||
goto malformed;
|
||||
sprintf(xorriso->vol_uuid, "%4.4d%2.2d%2.2d%2.2d%2.2d%2.2d00",
|
||||
1900 + gmt->tm_year, gmt->tm_mon + 1, gmt->tm_mday,
|
||||
gmt->tm_hour, gmt->tm_min, gmt->tm_sec);
|
||||
xorriso->gpt_guid_mode= 2; /* Disk GUID from vol_uuid */
|
||||
strcpy(xorriso->all_file_dates, xorriso->vol_uuid);
|
||||
sprintf(xorriso->info_text,
|
||||
"Environment variable SOURCE_DATE_EPOCH encountered with value %s",
|
||||
sec_text);
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0);
|
||||
sprintf(xorriso->info_text, "SOURCE_DATE_EPOCH : -volume_date uuid %s",
|
||||
xorriso->vol_uuid);
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0);
|
||||
sprintf(xorriso->info_text,
|
||||
"SOURCE_DATE_EPOCH : -volume_date all_file_dates %s",
|
||||
xorriso->all_file_dates);
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0);
|
||||
sprintf(xorriso->info_text,
|
||||
"SOURCE_DATE_EPOCH : -boot_image any volume_date_uuid");
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0);
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
||||
int Xorriso_read_rc(struct XorrisO *xorriso, int flag)
|
||||
{
|
||||
int ret,i,was_failure= 0,fret;
|
||||
|
||||
/* Interpret environment variable SOURCE_DATE_EPOCH */
|
||||
ret= Xorriso_source_date_epoch(xorriso, 0);
|
||||
ret= Xorriso_eval_problem_status(xorriso, ret, 0);
|
||||
if(ret < 0)
|
||||
return(0);
|
||||
|
||||
if(xorriso->no_rc)
|
||||
return(1);
|
||||
i= xorriso->rc_filename_count-1;
|
||||
|
Reference in New Issue
Block a user