[packages/alacritty] up to 0.7.2
atler
atler at pld-linux.org
Tue Feb 23 20:28:16 CET 2021
commit 203362f23a495c7f27fdca0bbf85a13c73ace992
Author: Jan Palus <atler at pld-linux.org>
Date: Tue Feb 23 20:25:00 2021 +0100
up to 0.7.2
- adapted create-crates.sh script from delta
alacritty.spec | 13 +++++++----
create-crates.sh | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 78 insertions(+), 4 deletions(-)
---
diff --git a/alacritty.spec b/alacritty.spec
index 9cd5876..b850751 100644
--- a/alacritty.spec
+++ b/alacritty.spec
@@ -1,17 +1,19 @@
+%define crates_ver 0.7.2
+
Summary: A fast, cross-platform, OpenGL terminal emulator
Name: alacritty
-Version: 0.7.1
+Version: 0.7.2
Release: 1
License: Apache v2.0
Group: Applications
Source0: https://github.com/alacritty/alacritty/archive/v%{version}/%{name}-%{version}.tar.gz
-# Source0-md5: e4d0ac610b4e768102962ddac0c6a53b
+# Source0-md5: 959298871877c4a50e8e2789d23530c7
# cd alacritty-%{version}
# cargo vendor
# cd ..
# tar cJf alacritty-crates-%{version}.tar.xz alacritty-%{version}/{vendor,Cargo.lock}
Source1: %{name}-crates-%{version}.tar.xz
-# Source1-md5: 1279949ca954cd8219740baaa94c1bc5
+# Source1-md5: 4a52bca31af51ceb9214cb932a2d8f8c
URL: https://github.com/alacritty/alacritty
BuildRequires: cargo
BuildRequires: rpmbuild(macros) >= 1.752
@@ -70,7 +72,10 @@ ZSH completion for alacritty command line.
Dopełnianie linii poleceń programu alacritty dla powłoki ZSH.
%prep
-%setup -q -b1
+%setup -q -a1
+
+%{__mv} %{name}-%{crates_ver}/* .
+sed -i -e 's/@@VERSION@@/%{version}/' Cargo.lock
# use our offline registry
export CARGO_HOME="$(pwd)/.cargo"
diff --git a/create-crates.sh b/create-crates.sh
new file mode 100755
index 0000000..297913a
--- /dev/null
+++ b/create-crates.sh
@@ -0,0 +1,69 @@
+#!/bin/sh
+
+for cmd in bsdtar rpm-specdump cargo perl; do
+ if ! command -v $cmd > /dev/null 2> /dev/null; then
+ not_installed="$not_installed$cmd "
+ fi
+done
+
+if [ -n "$not_installed" ]; then
+ echo "ERROR: required commands not found: $not_installed" >&2
+ exit 1
+fi
+
+pkg_dir=$(readlink -f $(dirname "$0"))
+pkg_name=$(basename "$pkg_dir")
+
+if [ ! -f "$pkg_dir/$pkg_name.spec" ]; then
+ echo "ERROR: unable to determine package name" >&2
+ exit 1
+fi
+
+spec_dump=$(rpm-specdump "$pkg_dir/$pkg_name.spec")
+pkg_version=$(echo "$spec_dump" | grep PACKAGE_VERSION | cut -f3 -d' ')
+pkg_src=$(basename $(echo "$spec_dump" | grep SOURCEURL0 | cut -f3- -d' '))
+crates_file="$pkg_name-crates-$pkg_version.tar.xz"
+cargo_package=${force_cargo_package:-$pkg_name}
+
+if [ -e "$pkg_dir/$crates_file" ]; then
+ echo "ERROR: crates file $crates_file already exists" >&2
+ exit 1
+fi
+
+if [ ! -f "$pkg_dir/$pkg_src" ]; then
+ echo "ERROR: source file $pkg_src not found" >&2
+ exit 1
+fi
+
+tmpdir=$(mktemp -d)
+
+rm_tmpdir() {
+ if [ -n "$tmpdir" -a -d "$tmpdir" ]; then
+ rm -rf "$tmpdir"
+ fi
+}
+
+trap rm_tmpdir EXIT INT HUP
+
+cd "$tmpdir"
+bsdtar xf "$pkg_dir/$pkg_src"
+src_dir=$(ls)
+if [ $(echo "$src_dir" | wc -l) -ne 1 ]; then
+ echo "ERROR: unexpected source structure:\n$src_dir" >&2
+ exit 1
+fi
+
+cd "$src_dir"
+cargo vendor
+if [ $? -ne 0 ]; then
+ echo "ERROR: cargo vendor failed" >&2
+ exit 1
+fi
+
+# replace cargo package version with @@VERSION@@
+perl -pi -e 'BEGIN { undef $/;} s/(\[\[package\]\]\nname\s*=\s*"'"$cargo_package"'"\nversion\s*=\s*")[^"]+/$1\@\@VERSION\@\@/m' Cargo.lock
+
+cd ..
+tar cJf "$pkg_dir/$crates_file" "$src_dir"/{Cargo.lock,vendor}
+
+# vim: expandtab shiftwidth=2 tabstop=2
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/alacritty.git/commitdiff/203362f23a495c7f27fdca0bbf85a13c73ace992
More information about the pld-cvs-commit
mailing list