Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package onefetch for openSUSE:Factory 
checked in at 2022-04-08 22:45:47
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/onefetch (Old)
 and      /work/SRC/openSUSE:Factory/.onefetch.new.1900 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "onefetch"

Fri Apr  8 22:45:47 2022 rev:13 rq:967704 version:2.11.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/onefetch/onefetch.changes        2022-03-04 
00:19:15.804305754 +0100
+++ /work/SRC/openSUSE:Factory/.onefetch.new.1900/onefetch.changes      
2022-04-08 22:45:57.542979115 +0200
@@ -1,0 +2,5 @@
+Thu Apr  7 13:28:06 UTC 2022 - Bernhard Wiedemann <[email protected]>
+
+- Add onefetch-fix-test.patch to fix build
+
+-------------------------------------------------------------------

New:
----
  onefetch-fix-test.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ onefetch.spec ++++++
--- /var/tmp/diff_new_pack.8kv5SH/_old  2022-04-08 22:45:58.294970768 +0200
+++ /var/tmp/diff_new_pack.8kv5SH/_new  2022-04-08 22:45:58.298970724 +0200
@@ -25,6 +25,8 @@
 URL:            https://github.com/o2sh/onefetch
 Source0:        https://github.com/o2sh/onefetch/archive/v%{version}.tar.gz
 Source1:        vendor.tar.xz
+# PATCH-FIX-UPSTREAM 
https://github.com/o2sh/onefetch/commit/2c1f2f0b2c666f6ce94af0299f88048dd1d83484
+Patch0:         onefetch-fix-test.patch
 BuildRequires:  cargo
 BuildRequires:  rust
 
@@ -34,6 +36,7 @@
 %prep
 %setup -q
 %setup -q -D -T -a 1
+%patch0 -p1
 mkdir -p .cargo
 cat >.cargo/config <<EOF
 [source.crates-io]

++++++ onefetch-fix-test.patch ++++++
>From 2c1f2f0b2c666f6ce94af0299f88048dd1d83484 Mon Sep 17 00:00:00 2001
From: Spenser Black <[email protected]>
Date: Mon, 14 Mar 2022 17:36:14 -0400
Subject: [PATCH] Make time test relative to current time (#613)

This test was failing after a year, because it was testing a conversion
of 2020/09/13 to "a year ago." This changes the test to be relative to
the current time, and subtract roughly a year.

Fixes #612
---
 src/info/repo.rs | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/info/repo.rs b/src/info/repo.rs
index e3453f42..1f949a71 100644
--- a/src/info/repo.rs
+++ b/src/info/repo.rs
@@ -364,7 +364,7 @@ mod tests {
 
     use super::*;
     use git2::Time;
-    use std::time::SystemTime;
+    use std::time::{Duration, SystemTime};
 
     #[test]
     fn display_time_as_human_time_current_time_now() {
@@ -379,8 +379,13 @@ mod tests {
 
     #[test]
     fn display_time_as_human_time_current_time_arbitrary() {
-        let time = 1600000000;
-        let time = Time::new(time, 0);
+        let day = Duration::from_secs(60 * 60 * 24);
+        let current_time = SystemTime::now()
+            .duration_since(SystemTime::UNIX_EPOCH)
+            .unwrap();
+        // NOTE 366 so that it's a year ago even with leap years.
+        let year_ago = current_time - (day * 366);
+        let time = Time::new(year_ago.as_secs() as i64, 0);
         let result = git_time_to_formatted_time(&time, false);
         assert_eq!(result, "a year ago");
     }

Reply via email to