diff --git a/.gitignore b/.gitignore index 9505927..fa0e379 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /termion-1.5.1.crate +/termion-1.5.2.crate diff --git a/0001-Update-numtoa.patch b/0001-Update-numtoa.patch new file mode 100644 index 0000000..d542d80 --- /dev/null +++ b/0001-Update-numtoa.patch @@ -0,0 +1,104 @@ +From d80ab4617f79f68b85cc1d113250ad3d791a66d5 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jonathan=20Schleu=C3=9Fer?= +Date: Sat, 29 Dec 2018 17:15:18 +0100 +Subject: [PATCH] Update numtoa + +This now allows byte slices with lengths different than 20, so +specific lengths based on the biggest possible value for each +number can be used. +--- + src/color.rs | 8 ++++---- + src/cursor.rs | 10 +++++----- + 2 files changed, 9 insertions(+), 9 deletions(-) + +diff --git a/src/color.rs b/src/color.rs +index 6c543b69561f..6c0055b5e9e3 100644 +--- a/src/color.rs ++++ b/src/color.rs +@@ -125,14 +125,14 @@ impl AnsiValue { + impl AnsiValue { + /// Returns the ANSI sequence as a string. + pub fn fg_string(self) -> String { +- let mut x = [0u8; 20]; ++ let mut x = [0u8; 3]; + let x = self.0.numtoa_str(10, &mut x); + [csi!("38;5;"), x, "m"].concat() + } + + /// Returns the ANSI sequence as a string. + pub fn bg_string(self) -> String { +- let mut x = [0u8; 20]; ++ let mut x = [0u8; 3]; + let x = self.0.numtoa_str(10, &mut x); + [csi!("48;5;"), x, "m"].concat() + } +@@ -157,7 +157,7 @@ pub struct Rgb(pub u8, pub u8, pub u8); + impl Rgb { + /// Returns the ANSI sequence as a string. + pub fn fg_string(self) -> String { +- let (mut x, mut y, mut z) = ([0u8; 20], [0u8; 20], [0u8; 20]); ++ let (mut x, mut y, mut z) = ([0u8; 3], [0u8; 3], [0u8; 3]); + let (x, y, z) = ( + self.0.numtoa_str(10, &mut x), + self.1.numtoa_str(10, &mut y), +@@ -169,7 +169,7 @@ impl Rgb { + + /// Returns the ANSI sequence as a string. + pub fn bg_string(self) -> String { +- let (mut x, mut y, mut z) = ([0u8; 20], [0u8; 20], [0u8; 20]); ++ let (mut x, mut y, mut z) = ([0u8; 3], [0u8; 3], [0u8; 3]); + let (x, y, z) = ( + self.0.numtoa_str(10, &mut x), + self.1.numtoa_str(10, &mut y), +diff --git a/src/cursor.rs b/src/cursor.rs +index bbc039406746..8596c3f47fab 100644 +--- a/src/cursor.rs ++++ b/src/cursor.rs +@@ -36,7 +36,7 @@ pub struct Goto(pub u16, pub u16); + + impl From for String { + fn from(this: Goto) -> String { +- let (mut x, mut y) = ([0u8; 20], [0u8; 20]); ++ let (mut x, mut y) = ([0u8; 5], [0u8; 5]); + ["\x1B[", this.1.numtoa_str(10, &mut x), ";", this.0.numtoa_str(10, &mut y), "H"].concat() + } + } +@@ -60,7 +60,7 @@ pub struct Left(pub u16); + + impl From for String { + fn from(this: Left) -> String { +- let mut buf = [0u8; 20]; ++ let mut buf = [0u8; 5]; + ["\x1B[", this.0.numtoa_str(10, &mut buf), "D"].concat() + } + } +@@ -77,7 +77,7 @@ pub struct Right(pub u16); + + impl From for String { + fn from(this: Right) -> String { +- let mut buf = [0u8; 20]; ++ let mut buf = [0u8; 5]; + ["\x1B[", this.0.numtoa_str(10, &mut buf), "C"].concat() + } + } +@@ -94,7 +94,7 @@ pub struct Up(pub u16); + + impl From for String { + fn from(this: Up) -> String { +- let mut buf = [0u8; 20]; ++ let mut buf = [0u8; 5]; + ["\x1B[", this.0.numtoa_str(10, &mut buf), "A"].concat() + } + } +@@ -111,7 +111,7 @@ pub struct Down(pub u16); + + impl From for String { + fn from(this: Down) -> String { +- let mut buf = [0u8; 20]; ++ let mut buf = [0u8; 5]; + ["\x1B[", this.0.numtoa_str(10, &mut buf), "B"].concat() + } + } +-- +2.21.0 + diff --git a/rust-termion.spec b/rust-termion.spec index 74b1cdf..cf6a9f2 100644 --- a/rust-termion.spec +++ b/rust-termion.spec @@ -1,4 +1,4 @@ -# Generated by rust2rpm +# Generated by rust2rpm-9-1.fc30 # * Tests rely on tty %bcond_with check %global debug_package %{nil} @@ -6,21 +6,26 @@ %global crate termion Name: rust-%{crate} -Version: 1.5.1 -Release: 6%{?dist} +Version: 1.5.2 +Release: 1%{?dist} Summary: Bindless library for manipulating terminals +# Upstream license specification: MIT License: MIT URL: https://crates.io/crates/termion Source: %{crates_source} # Initial patched metadata # * No redox +# * Update numtoa to 0.2.3 Patch0: termion-fix-metadata.diff +# https://gitlab.redox-os.org/redox-os/termion/merge_requests/153/diffs?commit_id=8c3378e1ff06c40fcd694ddfac93ebb8c272164b +Patch1: 0001-Update-numtoa.patch ExclusiveArch: %{rust_arches} BuildRequires: rust-packaging BuildRequires: (crate(libc/default) >= 0.2.8 with crate(libc/default) < 0.3.0) +BuildRequires: (crate(numtoa/default) >= 0.2.3 with crate(numtoa/default) < 0.3.0) %global _description \ A bindless library for manipulating terminals. @@ -70,6 +75,9 @@ which use "default" feature of "%{crate}" crate. %endif %changelog +* Mon Jun 03 2019 Josh Stone - 1.5.2-1 +- Update to 1.5.2 + * Sat Feb 02 2019 Fedora Release Engineering - 1.5.1-5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild diff --git a/sources b/sources index 70226bd..4618510 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (termion-1.5.1.crate) = 1d1536f08600c7c1f414b4579a1a6e7eff91f4c105504125118d3cadf71c7886a352d1c5f7e07f3d7c28aa8b4752f07b51eddb4d9adc6a9286f7b6bade2bec76 +SHA512 (termion-1.5.2.crate) = 573432550daf6b9edf60783a056df7f1b40ac51585194c8a6181a7b21b22a9d95d9389b3dbf90a050dbacc8988e7b1bbb189756fb5444e11cabd06b3d6c0119b diff --git a/termion-fix-metadata.diff b/termion-fix-metadata.diff index 7f09aff..e4b9f92 100644 --- a/termion-fix-metadata.diff +++ b/termion-fix-metadata.diff @@ -1,10 +1,16 @@ ---- termion-1.5.1/Cargo.toml 2017-08-04T00:12:31+02:00 -+++ termion-1.5.1/Cargo.toml 2019-03-09T15:32:09.243636+01:00 -@@ -11,7 +11,3 @@ - - [target.'cfg(not(target_os = "redox"))'.dependencies] - libc = "0.2.8" +--- termion-1.5.2/Cargo.toml 1970-01-01T00:00:00+00:00 ++++ termion-1.5.2/Cargo.toml 2019-06-03T18:22:14.839632+00:00 +@@ -21,12 +21,6 @@ + license = "MIT" + repository = "https://gitlab.redox-os.org/redox-os/termion" + [dependencies.numtoa] +-version = "0.1.0" +-features = ["std"] ++version = "0.2.3" + [target."cfg(not(target_os = \"redox\"))".dependencies.libc] + version = "0.2.8" +-[target."cfg(target_os = \"redox\")".dependencies.redox_syscall] +-version = "0.1" - --[target.'cfg(target_os = "redox")'.dependencies] --redox_syscall = "0.1" --redox_termios = "0.1" +-[target."cfg(target_os = \"redox\")".dependencies.redox_termios] +-version = "0.1"