|
|
@@ -57,6 +57,7 @@ string dont_compress_str = "jpg,png,mp3,ogg";
|
|
|
// Default text extensions. May be overridden with -X.
|
|
|
string text_ext_str = "txt";
|
|
|
|
|
|
+time_t source_date_epoch = (time_t)-1;
|
|
|
bool got_record_timestamp_flag = false;
|
|
|
bool record_timestamp_flag = true;
|
|
|
|
|
|
@@ -430,6 +431,12 @@ add_files(const vector_string ¶ms) {
|
|
|
needs_repack = true;
|
|
|
}
|
|
|
|
|
|
+ if (multifile->get_record_timestamp() && source_date_epoch != (time_t)-1) {
|
|
|
+ if (multifile->get_timestamp() > source_date_epoch) {
|
|
|
+ multifile->set_timestamp(source_date_epoch);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
if (needs_repack) {
|
|
|
if (!multifile->repack()) {
|
|
|
cerr << "Failed to write " << multifile_name << ".\n";
|
|
|
@@ -533,6 +540,12 @@ kill_files(const vector_string ¶ms) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ if (multifile->get_record_timestamp() && source_date_epoch != (time_t)-1) {
|
|
|
+ if (multifile->get_timestamp() > source_date_epoch) {
|
|
|
+ multifile->set_timestamp(source_date_epoch);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
bool okflag = true;
|
|
|
|
|
|
if (multifile->needs_repack()) {
|
|
|
@@ -779,6 +792,11 @@ main(int argc, char **argv) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ const char *source_date_epoch_str = getenv("SOURCE_DATE_EPOCH");
|
|
|
+ if (source_date_epoch_str != nullptr && source_date_epoch_str[0] != 0) {
|
|
|
+ source_date_epoch = (time_t)strtoll(source_date_epoch_str, nullptr, 10);
|
|
|
+ }
|
|
|
+
|
|
|
extern char *optarg;
|
|
|
extern int optind;
|
|
|
static const char *optflags = "crutxkvz123456789Z:T:X:S:f:OC:ep:P:F:h";
|