From 33a724059039606a8f18050ec0e838ff3bad41c3 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Mon, 3 Sep 2018 20:07:34 +0200 Subject: [PATCH] initial import Signed-off-by: Igor Gnatenko --- .gitignore | 1 + ...-0.3-and-take-advantage-of-serde-int.patch | 52 +++++++++++ rust-syntect.spec | 87 +++++++++++++++++++ sources | 1 + syntect-fix-metadata.diff | 29 +++++++ 5 files changed, 170 insertions(+) create mode 100644 .gitignore create mode 100644 0001-Upgrade-plist-to-0.3-and-take-advantage-of-serde-int.patch create mode 100644 rust-syntect.spec create mode 100644 sources create mode 100644 syntect-fix-metadata.diff diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3140c89 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/syntect-2.1.0.crate diff --git a/0001-Upgrade-plist-to-0.3-and-take-advantage-of-serde-int.patch b/0001-Upgrade-plist-to-0.3-and-take-advantage-of-serde-int.patch new file mode 100644 index 0000000..19e2b23 --- /dev/null +++ b/0001-Upgrade-plist-to-0.3-and-take-advantage-of-serde-int.patch @@ -0,0 +1,52 @@ +From f4aa3a1421d4213f8611af8bc243f2dcdf86146f Mon Sep 17 00:00:00 2001 +From: Robin Stocker +Date: Thu, 28 Jun 2018 12:50:41 +1000 +Subject: [PATCH] Upgrade plist to 0.3 and take advantage of serde integration + +--- + src/highlighting/settings.rs | 24 ++++-------------------- + 1 file changed, 4 insertions(+), 20 deletions(-) + +diff --git a/src/highlighting/settings.rs b/src/highlighting/settings.rs +index d0e7be7..da64fcf 100644 +--- a/src/highlighting/settings.rs ++++ b/src/highlighting/settings.rs +@@ -2,8 +2,8 @@ + /// released under the MIT license by @defuz + + use std::io::{Read, Seek}; +-use plist::{Plist, Error as PlistError}; +-use serde_json::Number; ++use plist::{Error as PlistError}; ++use plist::serde::deserialize; + + pub use serde_json::Value as Settings; + pub use serde_json::Value::Array as SettingsArray; +@@ -33,22 +33,6 @@ impl From for SettingsError { + } + + pub fn read_plist(reader: R) -> Result { +- let plist = Plist::read(reader)?; +- Ok(to_json(plist)) +-} +- +-fn to_json(plist: Plist) -> Settings { +- match plist { +- Plist::Array(elements) => +- SettingsArray(elements.into_iter().map(to_json).collect()), +- Plist::Dictionary(entries) => +- SettingsObject(entries.into_iter().map(|(k, v)| (k, to_json(v))).collect()), +- Plist::Boolean(value) => Settings::Bool(value), +- Plist::Data(bytes) => Settings::Array(bytes.into_iter().map(|b| b.into()).collect()), +- Plist::Date(value) => Settings::String(value.to_string()), +- Plist::Real(value) => +- Settings::Number(Number::from_f64(value).expect("Error converting plist real value to JSON number")), +- Plist::Integer(value) => Settings::Number(value.into()), +- Plist::String(s) => Settings::String(s), +- } ++ let settings = deserialize(reader)?; ++ Ok(settings) + } +-- +2.19.0.rc1 + diff --git a/rust-syntect.spec b/rust-syntect.spec new file mode 100644 index 0000000..b1b0882 --- /dev/null +++ b/rust-syntect.spec @@ -0,0 +1,87 @@ +# Generated by rust2rpm +# criterion is not packaged yet +%bcond_with check +%global debug_package %{nil} + +%global crate syntect + +Name: rust-%{crate} +Version: 2.1.0 +Release: 1%{?dist} +Summary: Library for high quality syntax highlighting and code intelligence + +License: MIT +URL: https://crates.io/crates/syntect +Source0: https://crates.io/api/v1/crates/%{crate}/%{version}/download#/%{crate}-%{version}.crate +# Initial patched metadata +# * Bump onig to 4.1, https://github.com/trishume/syntect/commit/6172cf925cbe87aa8984cb4362906808bd5cf437 +# * Bump regex-syntax to 0.6 and regex to 1.0, https://github.com/trishume/syntect/commit/5bd64c04aa236bfb0c03da9c101aa27ed63ed01e +# * Bump plist to 0.3, https://github.com/trishume/syntect/commit/f4aa3a1421d4213f8611af8bc243f2dcdf86146f +Patch0: syntect-fix-metadata.diff +# Make it work with new plist +Patch0001: 0001-Upgrade-plist-to-0.3-and-take-advantage-of-serde-int.patch + +ExclusiveArch: %{rust_arches} + +BuildRequires: rust-packaging +# [dependencies] +BuildRequires: (crate(bincode) >= 1.0.0 with crate(bincode) < 2.0.0) +BuildRequires: (crate(bitflags) >= 1.0.0 with crate(bitflags) < 2.0.0) +BuildRequires: (crate(flate2) >= 1.0.0 with crate(flate2) < 2.0.0) +BuildRequires: (crate(fnv) >= 1.0.0 with crate(fnv) < 2.0.0) +BuildRequires: (crate(lazy_static) >= 1.0.0 with crate(lazy_static) < 2.0.0) +BuildRequires: (crate(onig) >= 4.1.0 with crate(onig) < 5.0.0) +BuildRequires: (crate(plist) >= 0.3.0 with crate(plist) < 0.4.0) +BuildRequires: (crate(regex-syntax) >= 0.6.0 with crate(regex-syntax) < 0.7.0) +BuildRequires: ((crate(serde) >= 1.0.0 with crate(serde) < 2.0.0) with crate(serde/rc)) +BuildRequires: (crate(serde_derive) >= 1.0.0 with crate(serde_derive) < 2.0.0) +BuildRequires: (crate(serde_json) >= 1.0.0 with crate(serde_json) < 2.0.0) +BuildRequires: (crate(walkdir) >= 2.0.0 with crate(walkdir) < 3.0.0) +BuildRequires: (crate(yaml-rust) >= 0.4.0 with crate(yaml-rust) < 0.5.0) +%if %{with check} +# [dev-dependencies] +BuildRequires: (crate(criterion) >= 0.2.0 with crate(criterion) < 0.3.0) +BuildRequires: (crate(getopts) >= 0.2.0 with crate(getopts) < 0.3.0) +BuildRequires: (crate(pretty_assertions) >= 0.5.0 with crate(pretty_assertions) < 0.6.0) +BuildRequires: (crate(rayon) >= 1.0.0 with crate(rayon) < 2.0.0) +BuildRequires: (crate(regex) >= 1.0.0 with crate(regex) < 2.0.0) +%endif + +%description +%{summary}. + +%package devel +Summary: %{summary} +BuildArch: noarch + +%description devel +library for high quality syntax highlighting and code intelligence using +Sublime Text's grammars. + +This package contains library source intended for building other packages +which use %{crate} from crates.io. + +%prep +%autosetup -n %{crate}-%{version} -p1 +%cargo_prep + +%build +%cargo_build + +%install +%cargo_install + +%if %{with check} +%check +%cargo_test +%endif + +%files devel +%license LICENSE.txt +%doc Readme.md DESIGN.md +%{cargo_registry}/%{crate}-%{version}/ +%exclude %{cargo_registry}/%{crate}-%{version}/{codecov.yaml,Makefile,scripts} + +%changelog +* Mon Sep 03 2018 Igor Gnatenko - 2.1.0-1 +- Initial package diff --git a/sources b/sources new file mode 100644 index 0000000..36f7000 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (syntect-2.1.0.crate) = e672de4ba1016d3fdc0977c77dbd3ac3d43bbe3e51e492305f7e8b886d67c1fe8ba872850f8caacee5d35405454c32e931a224984450bc55dfc1f5414cd8f214 diff --git a/syntect-fix-metadata.diff b/syntect-fix-metadata.diff new file mode 100644 index 0000000..539dd50 --- /dev/null +++ b/syntect-fix-metadata.diff @@ -0,0 +1,29 @@ +--- syntect-2.1.0/Cargo.toml 1970-01-01T01:00:00+01:00 ++++ syntect-2.1.0/Cargo.toml 2018-09-03T08:43:04.539047+02:00 +@@ -54,14 +54,14 @@ + version = "1.0" + + [dependencies.onig] +-version = "3.2.1" ++version = "4.1" + optional = true + + [dependencies.plist] +-version = "0.2" ++version = "0.3" + + [dependencies.regex-syntax] +-version = "0.4" ++version = "0.6" + optional = true + + [dependencies.serde] +@@ -93,7 +93,7 @@ + version = "1.0.0" + + [dev-dependencies.regex] +-version = "0.2" ++version = "1.0" + + [features] + assets = []