New -volume_date mode "all_file_dates"

This commit is contained in:
Thomas Schmitt 2016-08-16 13:13:05 +00:00
parent f88d9702de
commit 3f12f030e9
7 changed files with 52 additions and 23 deletions

View File

@ -304,6 +304,7 @@ int Xorriso_new(struct XorrisO ** xorriso,char *progname, int flag)
m->vol_expiration_time= 0; m->vol_expiration_time= 0;
m->vol_effective_time= 0; m->vol_effective_time= 0;
m->vol_uuid[0]= 0; m->vol_uuid[0]= 0;
m->all_file_dates[0]= 0;
#ifdef Xorriso_with_libjtE #ifdef Xorriso_with_libjtE
m->libjte_handle= NULL; m->libjte_handle= NULL;

View File

@ -1282,7 +1282,6 @@ int Xorriso_genisofs(struct XorrisO *xorriso, char *whom,
int *delay_opt_list= NULL, delay_opt_count= 0; int *delay_opt_list= NULL, delay_opt_count= 0;
char *sfe= NULL, *adr= NULL, ra_text[80], *pathspec= NULL, *sort_file= NULL; char *sfe= NULL, *adr= NULL, ra_text[80], *pathspec= NULL, *sort_file= NULL;
char *ept, *add_pt, *eff_path= NULL, *indev= NULL, msc[80], *cpt; char *ept, *add_pt, *eff_path= NULL, *indev= NULL, msc[80], *cpt;
char *all_file_dates= NULL;
char *old_root= NULL, *argpt, *hargv[1]; char *old_root= NULL, *argpt, *hargv[1];
char *boot_path, partno_text[8], *iso_rr_pt, *disk_pt, *rpt, *wpt; char *boot_path, partno_text[8], *iso_rr_pt, *disk_pt, *rpt, *wpt;
char *rm_merge_args[3], *rr_reloc_dir_pt= NULL; char *rm_merge_args[3], *rr_reloc_dir_pt= NULL;
@ -1925,11 +1924,12 @@ not_enough_args:;
if(i+1>=argc) if(i+1>=argc)
goto not_enough_args; goto not_enough_args;
i++; i++;
if(all_file_dates != NULL) if(strlen(argv[i]) >= sizeof(xorriso->all_file_dates)) {
Xorriso_free_meM(all_file_dates); sprintf(xorriso->info_text, "--set_all_file_dates: time text too long");
all_file_dates= NULL; Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
Xorriso_alloc_meM(all_file_dates, char, strlen(argv[i]) + 1); ret= 0; goto problem_handler_2;
strcpy(all_file_dates, argv[i]); }
strcpy(xorriso->all_file_dates, argv[i]);
} else if(strcmp(argpt, "-input-charset")==0) { } else if(strcmp(argpt, "-input-charset")==0) {
i++; i++;
@ -2631,21 +2631,6 @@ problem_handler_boot:;
if(xorriso->no_emul_toc & 1) if(xorriso->no_emul_toc & 1)
xorriso->do_padding_by_libisofs= 1; xorriso->do_padding_by_libisofs= 1;
if(all_file_dates != NULL) if(all_file_dates[0] != 0) {
hargv[0]= "/";
idx= 0;
ret= Xorriso_option_alter_date(xorriso, "b", all_file_dates, 1, hargv,
&idx, 1);
if(ret <= 0)
was_failure= 1;
idx= 0;
ret= Xorriso_option_alter_date(xorriso, "c", all_file_dates, 1, hargv,
&idx, 1);
if(ret <= 0)
was_failure= 1;
Xorriso_relax_compliance(xorriso, "always_gmt", 0);
}
if(do_print_size) { if(do_print_size) {
ret= Xorriso_option_print_size(xorriso, 1); ret= Xorriso_option_print_size(xorriso, 1);
goto ex; goto ex;
@ -2662,7 +2647,6 @@ ex:;
free(weight_list); free(weight_list);
if(delay_opt_list != NULL) if(delay_opt_list != NULL)
free(delay_opt_list); free(delay_opt_list);
Xorriso_free_meM(all_file_dates);
Xorriso_free_meM(sort_file); Xorriso_free_meM(sort_file);
Xorriso_free_meM(sfe); Xorriso_free_meM(sfe);
Xorriso_free_meM(adr); Xorriso_free_meM(adr);

View File

@ -2133,6 +2133,15 @@ int Xorriso_option_volume_date(struct XorrisO *xorriso,
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0);
} }
} else if(strcmp(time_type, "all_file_dates") == 0) {
if(t == 0) {
xorriso->all_file_dates[0]= 0;
ret= 1; goto ex;
}
strncpy(xorriso->all_file_dates, timestring,
sizeof(xorriso->all_file_dates) - 1);
xorriso->all_file_dates[sizeof(xorriso->all_file_dates) - 1]= 0;
} else if(strcmp(time_type, "c") == 0) { } else if(strcmp(time_type, "c") == 0) {
xorriso->vol_creation_time= t; xorriso->vol_creation_time= t;
} else if(strcmp(time_type, "m") == 0) { } else if(strcmp(time_type, "m") == 0) {

View File

@ -3286,6 +3286,12 @@ int Xorriso_status(struct XorrisO *xorriso, char *filter, FILE *fp, int flag)
if(!(is_default && no_defaults)) if(!(is_default && no_defaults))
Xorriso_status_result(xorriso,filter,fp,flag&2); Xorriso_status_result(xorriso,filter,fp,flag&2);
is_default= (xorriso->all_file_dates[0] == 0);
sprintf(line,"-volume_date all_file_dates %s\n",
Text_shellsafe(xorriso->all_file_dates,sfe,0));
if(!(is_default && no_defaults))
Xorriso_status_result(xorriso,filter,fp,flag&2);
is_default= (xorriso->copyright_file[0] == 0); is_default= (xorriso->copyright_file[0] == 0);
sprintf(line,"-copyright_file %s\n", sprintf(line,"-copyright_file %s\n",
Text_shellsafe(xorriso->copyright_file,sfe,0)); Text_shellsafe(xorriso->copyright_file,sfe,0));

View File

@ -1028,6 +1028,29 @@ ex:;
} }
int Xorriso_set_all_file_dates(struct XorrisO *xorriso, int flag)
{
int idx, ret, was_failure= 0;
char *hargv[1];
if(xorriso->all_file_dates[0] == 0)
return(2);
hargv[0]= "/";
idx= 0;
ret= Xorriso_option_alter_date(xorriso, "b", xorriso->all_file_dates,
1, hargv, &idx, 1);
if(ret <= 0)
was_failure= 1;
idx= 0;
ret= Xorriso_option_alter_date(xorriso, "c", xorriso->all_file_dates,
1, hargv, &idx, 1);
if(ret <= 0)
was_failure= 1;
Xorriso_relax_compliance(xorriso, "always_gmt", 0);
return(!was_failure);
}
/* @param flag bit0= do not write but only prepare and return size in sectors /* @param flag bit0= do not write but only prepare and return size in sectors
@return <=0 error , 1= success @return <=0 error , 1= success
2= failure with DVD-RW, please call Xorriso_retry_write_session() 2= failure with DVD-RW, please call Xorriso_retry_write_session()
@ -1061,6 +1084,10 @@ int Xorriso_write_session(struct XorrisO *xorriso, int flag)
if(ret <= 0) if(ret <= 0)
goto ex; goto ex;
ret= Xorriso_set_all_file_dates(xorriso, 1);
if(ret <= 0)
goto ex;
out_cs= xorriso->out_charset; out_cs= xorriso->out_charset;
if(out_cs == NULL) if(out_cs == NULL)
Xorriso_get_local_charset(xorriso, &out_cs, 0); Xorriso_get_local_charset(xorriso, &out_cs, 0);

View File

@ -528,6 +528,8 @@ struct XorrisO { /* the global context of xorriso */
/* To eventually override vol_modification_time by unconverted string /* To eventually override vol_modification_time by unconverted string
and timezone 0 */ and timezone 0 */
char vol_uuid[17]; char vol_uuid[17];
/* To flatly set all file timestamps to the same value */
char all_file_dates[80];
#ifdef Xorriso_with_libjtE #ifdef Xorriso_with_libjtE
/* Parameters and state of Jigdo Template Export environment */ /* Parameters and state of Jigdo Template Export environment */

View File

@ -1 +1 @@
#define Xorriso_timestamP "2016.08.15.175002" #define Xorriso_timestamP "2016.08.16.131434"