From dad3101d843a88d3156eeaea520738f91286cba7 Mon Sep 17 00:00:00 2001 From: Fabio Valentini Date: Mon, 3 Jun 2024 00:04:52 +0200 Subject: [PATCH] Adapt license tags, document bundled Sublime Text grammars and themes --- bat-fix-metadata-auto.diff | 6 +- bat-fix-metadata.diff | 29 +++--- rust-bat.spec | 187 +++++++++++++++++++++++++++++++++++-- rust2rpm.toml | 28 ++++++ 4 files changed, 225 insertions(+), 25 deletions(-) create mode 100644 rust2rpm.toml diff --git a/bat-fix-metadata-auto.diff b/bat-fix-metadata-auto.diff index 9331cfb..93fefc2 100644 --- a/bat-fix-metadata-auto.diff +++ b/bat-fix-metadata-auto.diff @@ -1,6 +1,6 @@ --- bat-0.24.0/Cargo.toml 1970-01-01T00:00:01+00:00 -+++ bat-0.24.0/Cargo.toml 2023-10-29T19:40:03.835368+00:00 -@@ -199,12 +199,6 @@ ++++ bat-0.24.0/Cargo.toml 2024-06-02T20:59:58.535240+00:00 +@@ -199,13 +199,8 @@ regex-fancy = ["syntect/regex-fancy"] regex-onig = ["syntect/regex-onig"] @@ -13,3 +13,5 @@ [target."cfg(unix)".dev-dependencies.nix] version = "0.26.2" features = ["term"] + default-features = false ++ diff --git a/bat-fix-metadata.diff b/bat-fix-metadata.diff index 7b93390..e541d3b 100644 --- a/bat-fix-metadata.diff +++ b/bat-fix-metadata.diff @@ -1,14 +1,15 @@ ---- a/Cargo.toml -+++ b/Cargo.toml -@@ -30,7 +30,6 @@ repository = "https://github.com/sharkdp - [profile.release] - lto = true - codegen-units = 1 --strip = true +--- bat-0.24.0/Cargo.toml 1970-01-01T00:00:01+00:00 ++++ bat-0.24.0/Cargo.toml 2024-06-02T21:00:30.381361+00:00 +@@ -24,7 +24,7 @@ + homepage = "https://github.com/sharkdp/bat" + readme = "README.md" + categories = ["command-line-utilities"] +-license = "MIT OR Apache-2.0" ++license = "(MIT OR Apache-2.0) AND Apache-2.0 AND BSD-2-Clause AND BSD-2-Clause-Views AND BSD-3-Clause AND CC-BY-SA-3.0 AND MIT AND Unlicense AND WTFPL" + repository = "https://github.com/sharkdp/bat" - [dependencies.ansi_colours] - version = "^1.2" -@@ -85,18 +84,17 @@ version = "0.1.9" + [profile.release] +@@ -85,18 +85,17 @@ optional = true [dependencies.nu-ansi-term] @@ -20,12 +21,14 @@ [dependencies.os_str_bytes] -version = "~6.4" -+version = "~6.6" - optional = true - +-optional = true +- -[dependencies.path_abs] -version = "0.5" -default-features = false ++version = "6.4" ++optional = true ++ +[dependencies.path-absolutize] +version = "3" diff --git a/rust-bat.spec b/rust-bat.spec index 25e9425..9195d3e 100644 --- a/rust-bat.spec +++ b/rust-bat.spec @@ -1,4 +1,4 @@ -# Generated by rust2rpm 24 +# Generated by rust2rpm 26 %bcond_without check %global crate bat @@ -8,30 +8,195 @@ Version: 0.24.0 Release: %autorelease Summary: Cat(1) clone with wings -License: MIT OR Apache-2.0 +# * bat crate: MIT OR Apache-2.0 +# * bundled content: Apache-2.0, BSD-2-Clause, BSD-2-Clause-Views, BSD-3-Clause, CC-BY-SA-3.0, MIT, Unlicense, WTFPL, UltraPermissive +License: (MIT OR Apache-2.0) AND Apache-2.0 AND BSD-2-Clause AND BSD-2-Clause-Views AND BSD-3-Clause AND CC-BY-SA-3.0 AND MIT AND Unlicense AND WTFPL AND LicenseRef-Fedora-UltraPermissive URL: https://crates.io/crates/bat Source: %{crates_source} -# Automatically generated patch to strip foreign dependencies +# Automatically generated patch to strip dependencies and normalize metadata Patch: bat-fix-metadata-auto.diff # Manually created patch for downstream crate metadata changes -# * remove compiler settings that are incompatible with RPM packaging -# * Port from path_abs to path-absolutize: +# * port from path_abs to path-absolutize: # https://github.com/sharkdp/bat/pull/1025 -# * Bump nu-ansi-term from 0.49.0 to 0.50.0 -# * Bump os_str_bytes from 6.4 to 6.6 +# * bump nu-ansi-term from 0.49.0 to 0.50.0 +# * relax os_str_bytes dependency from ~6.4 to ^6.4 +# * adapt license tag to reflect bundled content Patch: bat-fix-metadata.diff Patch: 0001-port-from-path_abs-to-path-absolutize.patch -BuildRequires: rust-packaging >= 23 +BuildRequires: cargo-rpm-macros >= 24 %global _description %{expand: A cat(1) clone with wings.} +%global _bundled_deps %{expand: +# Sublime Text 3 language definitions for syntax highlighting +# from: https://github.com/sublimehq/Packages/tree/759d6ee +# - all except Rust: LicenseRef-Fedora-UltraPermissive +# https://gitlab.com/fedora/legal/fedora-license-data/-/issues/516 +# - Rust: MIT +Provides: bundled(sublime-syntax) = 4075~git759d6ee + +# third-party language definitions for syntax highlighting +# AWK: MIT +Provides: bundled(sublime-syntax-AWK) +# Ada: MIT +Provides: bundled(sublime-syntax-Ada) +# Apache: BSD-2-Clause-Views +Provides: bundled(sublime-syntax-Apache) +# AsciiDoc: MIT +Provides: bundled(sublime-syntax-AsciiDoc) +# CMake: MIT +Provides: bundled(sublime-syntax-CMake) +# CoffeeScript: MIT +Provides: bundled(sublime-syntax-CoffeeScript) +# Crontab: MIT +Provides: bundled(sublime-syntax-Crontab) +# Crontab/cron_descriptor: MIT +Provides: bundled(sublime-syntax-Crontab-cron_descriptor) +# Crystal: Apache-2.0 +Provides: bundled(sublime-syntax-Crystal) +# Dart: MIT +Provides: bundled(sublime-syntax-Dart) +# Docker: MIT +Provides: bundled(sublime-syntax-Docker) +# DotENV: MIT +Provides: bundled(sublime-syntax-DotENV) +# Elixir: MIT +Provides: bundled(sublime-syntax-Elixir) +# Elm: MIT +Provides: bundled(sublime-syntax-Elm) +# Email: MIT +Provides: bundled(sublime-syntax-Email) +# Fish: MIT +Provides: bundled(sublime-syntax-Fish) +# GLSL: Unlicense +Provides: bundled(sublime-syntax-GLSL) +# GraphQL: WTFPL +Provides: bundled(sublime-syntax-GraphQL) +# Groff: MIT +Provides: bundled(sublime-syntax-Groff) +# HTML (Twig): BSD-3-Clause +Provides: bundled(sublime-syntax-HTML-Twig) +# JavaScript (Babel): MIT +Provides: bundled(sublime-syntax-JavaScript-Babel) +# Jsonnet: Apache-2.0 +Provides: bundled(sublime-syntax-Jsonnet) +# Julia: MIT +Provides: bundled(sublime-syntax-Julia) +# Kotlin: Apache-2.0 +Provides: bundled(sublime-syntax-Kotlin) +# LLVM: MIT +Provides: bundled(sublime-syntax-LLVM) +# Lean: Apache-2.0 +Provides: bundled(sublime-syntax-Lean) +# LiveScript: MIT +Provides: bundled(sublime-syntax-LiveScript) +# MediaWiki: MIT +Provides: bundled(sublime-syntax-MediaWiki) +# NSIS: Apache-2.0 +Provides: bundled(sublime-syntax-NSIS) +# Nginx: MIT +Provides: bundled(sublime-syntax-Nginx) +# Ninja: MIT +Provides: bundled(sublime-syntax-Ninja) +# Nix: MIT +Provides: bundled(sublime-syntax-Nix) +# Org mode: BSD-2-Clause +Provides: bundled(sublime-syntax-Org-mode) +# PowerShell: MIT +Provides: bundled(sublime-syntax-PowerShell) +# Protobuf: MIT +Provides: bundled(sublime-syntax-Protobuf) +# Puppet: MIT +Provides: bundled(sublime-syntax-Puppet) +# PureScript: MIT AND Unlicense +Provides: bundled(sublime-syntax-PureScript) +# QML: MIT +Provides: bundled(sublime-syntax-QML) +# Robot: MIT +Provides: bundled(sublime-syntax-Robot) +# SCSS_Sass: MIT +Provides: bundled(sublime-syntax-SCSS_Sass) +# SLS: Apache-2.0 +Provides: bundled(sublime-syntax-SLS) +# Slim: MIT +Provides: bundled(sublime-syntax-Slim) +# Stylus: MIT +Provides: bundled(sublime-syntax-Stylus) +# SublimeEthereum: MIT +Provides: bundled(sublime-syntax-SublimeEthereum) +# Svelte: MIT +Provides: bundled(sublime-syntax-Svelte) +# Swift: MIT +Provides: bundled(sublime-syntax-Swift) +# SystemVerilog: MIT +Provides: bundled(sublime-syntax-SystemVerilog) +# TOML: MIT +Provides: bundled(sublime-syntax-TOML) +# Terraform: MIT +Provides: bundled(sublime-syntax-Terraform) +# TypeScript: MIT +Provides: bundled(sublime-syntax-TypeScript) +# VimL: MIT +Provides: bundled(sublime-syntax-VimL) +# Vue: MIT +Provides: bundled(sublime-syntax-Vue) +# Zig: MIT +Provides: bundled(sublime-syntax-Zig) +# cmd-help: MIT +Provides: bundled(sublime-syntax-cmd-help) +# gnuplot: MIT +Provides: bundled(sublime-syntax-gnuplot) +# hosts: MIT +Provides: bundled(sublime-syntax-hosts) +# http-request-response: MIT +Provides: bundled(sublime-syntax-http-request-response) +# varlink: MIT +Provides: bundled(sublime-syntax-varlink) +# vscode-wgsl: MIT +Provides: bundled(sublime-syntax-vscode-wgsl) + +# third-party themes for syntax highlighting +# 1337-Scheme: MIT +Provides: bundled(sublime-theme-1337-Scheme) +# Coldark: MIT +Provides: bundled(sublime-theme-Coldark) +# DarkNeon: CC-BY-SA-3.0 +Provides: bundled(sublime-theme-DarkNeon) +# Nord-sublime: MIT, https://github.com/sharkdp/bat/issues/2987 +Provides: bundled(sublime-theme-Nord-sublime) +# Solarized: MIT +Provides: bundled(sublime-theme-Solarized) +# TwoDark: MIT +Provides: bundled(sublime-theme-TwoDark) +# dracula-sublime: MIT +Provides: bundled(sublime-theme-dracula-sublime) +# github-sublime-theme: https://github.com/sharkdp/bat/issues/2984 +Provides: bundled(sublime-theme-github-sublime-theme) +# gruvbox: MIT +Provides: bundled(sublime-theme-gruvbox) +# onehalf: MIT +Provides: bundled(sublime-theme-onehalf) +# sublime-monokai-extended: MIT +Provides: bundled(sublime-theme-sublime-monokai-extended) +# sublime-snazzy: https://github.com/sharkdp/bat/issues/2985 +Provides: bundled(sublime-theme-sublime-snazzy) +# visual-studio-dark-plus: https://github.com/sharkdp/bat/issues/2986 +Provides: bundled(sublime-theme-visual-studio-dark-plus) +# zenburn: BSD-2-Clause-Views +Provides: bundled(sublime-theme-zenburn) +} + %description %{_description} %package -n %{crate} Summary: %{summary} + +%{_bundled_deps} + # (Apache-2.0 OR MIT) AND BSD-3-Clause +# (MIT OR Apache-2.0) AND Apache-2.0 AND BSD-2-Clause AND BSD-2-Clause-Views AND BSD-3-Clause AND CC-BY-SA-3.0 AND MIT AND Unlicense AND WTFPL # (MIT OR Apache-2.0) AND BSD-3-Clause AND GPL-2.0-only WITH GCC-exception-2.0 AND MIT # (MIT OR Apache-2.0) AND Unicode-DFS-2016 # 0BSD OR MIT OR Apache-2.0 @@ -47,7 +212,7 @@ Summary: %{summary} # MIT OR Zlib OR Apache-2.0 # Unlicense OR MIT # Zlib OR Apache-2.0 OR MIT -License: Apache-2.0 AND BSD-2-Clause AND BSD-3-Clause AND CC0-1.0 AND GPL-2.0-only WITH GCC-exception-2.0 AND LGPL-3.0-or-later AND MIT AND Unicode-DFS-2016 AND (0BSD OR MIT OR Apache-2.0) AND (Apache-2.0 OR BSL-1.0) AND (Apache-2.0 OR MIT) AND (Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT) AND (MIT OR Apache-2.0 OR Zlib) AND (Unlicense OR MIT) +License: Apache-2.0 AND BSD-2-Clause AND BSD-2-Clause-Views AND BSD-3-Clause AND CC-BY-SA-3.0 AND LGPL-3.0-or-later AND GPL-2.0-only WITH GCC-exception-2.0 AND MIT AND Unicode-DFS-2016 AND Unlicense AND WTFPL AND (0BSD OR MIT OR Apache-2.0) AND (Apache-2.0 OR BSL-1.0) AND (Apache-2.0 OR MIT) AND (Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT) AND (MIT OR Apache-2.0 OR Zlib) AND (Unlicense OR MIT) # LICENSE.dependencies contains a full license breakdown %description -n %{crate} %{_description} @@ -70,6 +235,8 @@ License: Apache-2.0 AND BSD-2-Clause AND BSD-3-Clause AND CC0-1.0 AND GPL Summary: %{summary} BuildArch: noarch +%{_bundled_deps} + %description devel %{_description} This package contains library source intended for building other packages which @@ -325,7 +492,7 @@ use the "wild" feature of the "%{crate}" crate. %ghost %{crate_instdir}/Cargo.toml %prep -%autosetup -n %{crate}-%{version_no_tilde} -p1 +%autosetup -n %{crate}-%{version} -p1 %cargo_prep %generate_buildrequires diff --git a/rust2rpm.toml b/rust2rpm.toml new file mode 100644 index 0000000..593cb2b --- /dev/null +++ b/rust2rpm.toml @@ -0,0 +1,28 @@ +[package] +cargo-toml-patch-comments = [ + "port from path_abs to path-absolutize: https://github.com/sharkdp/bat/pull/1025", + "bump nu-ansi-term from 0.49.0 to 0.50.0", + "relax os_str_bytes dependency from ~6.4 to ^6.4", + "adapt license tag to reflect bundled content", +] +extra-files = [ + "%{_mandir}/man1/bat.1*", + "%{bash_completions_dir}/bat.bash", + "%{fish_completions_dir}/bat.fish", + "%{zsh_completions_dir}/_bat", +] + +[scripts] +install.post = [ + "# install man page", + "install -Dpm0644 target/release/build/%{crate}-*/out/assets/manual/bat.1 \\", + " -t %{buildroot}%{_mandir}/man1/", + "# install shell completions", + "install -Dpm0644 target/release/build/%{crate}-*/out/assets/completions/bat.bash \\", + " %{buildroot}/%{bash_completions_dir}/bat.bash", + "install -Dpm0644 target/release/build/%{crate}-*/out/assets/completions/bat.fish \\", + " %{buildroot}/%{fish_completions_dir}/bat.fish", + "install -Dpm0644 target/release/build/%{crate}-*/out/assets/completions/bat.zsh \\", + " %{buildroot}/%{zsh_completions_dir}/_bat", +] +