SHA256
3
0
forked from pool/rpm
rpm/mtime_policy_set.diff
Michael Schröder 4bb3c1092c - revert buildroot macro setting that did more harm than good
- add set_to_buildtime and set_to_source_date_epoch mtime policy
  support
  * new patch: mtime_policy_set.diff
- drop unused 0001-Add-option-to-set-mtime-of-files-in-rpms.patch
  patch

OBS-URL: https://build.opensuse.org/package/show/Base:System/rpm?expand=0&rev=691
2025-02-12 13:48:37 +00:00

35 lines
1.4 KiB
Diff

--- build/files.c.orig 2025-02-12 13:27:08.131721537 +0000
+++ build/files.c 2025-02-12 13:32:28.371151422 +0000
@@ -1049,10 +1049,10 @@ static void genCpioListAndHeader(FileLis
}
}
- if (!strcmp(mtime_policy_str, "clamp_to_buildtime")) {
+ if (!strcmp(mtime_policy_str, "clamp_to_buildtime") || !strcmp(mtime_policy_str, "set_to_buildtime")) {
mtime_clamp = spec->buildTime;
- override_date = 1;
- } else if (!strcmp(mtime_policy_str, "clamp_to_source_date_epoch")) {
+ override_date = mtime_policy_str[0] == 's' ? 2 : 1;
+ } else if (!strcmp(mtime_policy_str, "clamp_to_source_date_epoch") || !strcmp(mtime_policy_str, "set_to_source_date_epoch")) {
/* Limit the maximum date to SOURCE_DATE_EPOCH if defined
* similar to the tar --clamp-mtime option
* https://reproducible-builds.org/specs/source-date-epoch/
@@ -1065,7 +1065,7 @@ static void genCpioListAndHeader(FileLis
rpmlog(RPMLOG_ERR, _("unable to parse %s=%s\n"), "SOURCE_DATE_EPOCH", srcdate);
fl->processingFailed = 1;
}
- override_date = 1;
+ override_date = mtime_policy_str[0] == 's' ? 2 : 1;
}
} else if (*mtime_policy_str) {
rpmlog(RPMLOG_WARNING,
@@ -1214,7 +1214,7 @@ static void genCpioListAndHeader(FileLis
}
}
- if (override_date && flp->fl_mtime > mtime_clamp) {
+ if (override_date && (flp->fl_mtime > mtime_clamp || override_date == 2)) {
flp->fl_mtime = mtime_clamp;
}
/*