mirror of
https://github.com/gitui-org/gitui
synced 2026-05-23 08:58:21 +00:00
Allow to override build date with SOURCE_DATE_EPOCH (#2202)
to make builds reproducible. See https://reproducible-builds.org/ for why this is good and https://reproducible-builds.org/specs/source-date-epoch/ for the definition of this variable. This patch was done while working on reproducible builds for openSUSE. --------- Co-authored-by: extrawurst <mail@rusticorn.com>
This commit is contained in:
parent
3dca5feeec
commit
f56844501e
2 changed files with 12 additions and 1 deletions
|
|
@ -12,6 +12,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
* respect configuration for remote when fetching (also applies to pulling) [[@cruessler](https://github.com/cruessler)] ([#1093](https://github.com/extrawurst/gitui/issues/1093))
|
||||
* add `:` character to sign-off trailer to comply with Conventinoal Commits standard [@semioticrobotic](https://github.com/semioticrobotic) ([#2196](https://github.com/extrawurst/gitui/issues/2196))
|
||||
|
||||
### Added
|
||||
* support overriding `build_date` for [reproducible builds](https://reproducible-builds.org/) [[@bmwiedemann](https://github.com/bmwiedemann)] ([#2202](https://github.com/extrawurst/gitui/pull/2202))
|
||||
|
||||
## [0.26.0+1] - 2024-04-14
|
||||
|
||||
**0.26.1**
|
||||
|
|
|
|||
10
build.rs
10
build.rs
|
|
@ -1,3 +1,5 @@
|
|||
use chrono::TimeZone;
|
||||
|
||||
fn get_git_hash() -> String {
|
||||
use std::process::Command;
|
||||
|
||||
|
|
@ -18,7 +20,13 @@ fn get_git_hash() -> String {
|
|||
}
|
||||
|
||||
fn main() {
|
||||
let build_date = chrono::Local::now().date_naive();
|
||||
let now = match std::env::var("SOURCE_DATE_EPOCH") {
|
||||
Ok(val) => chrono::Local
|
||||
.timestamp_opt(val.parse::<i64>().unwrap(), 0)
|
||||
.unwrap(),
|
||||
Err(_) => chrono::Local::now(),
|
||||
};
|
||||
let build_date = now.date_naive();
|
||||
|
||||
let build_name = if std::env::var("GITUI_RELEASE").is_ok() {
|
||||
format!(
|
||||
|
|
|
|||
Loading…
Reference in a new issue