From a51874008c21a462cf8a48f2d095c1ff80f5d43e Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Fri, 1 Jul 2022 07:12:17 +0200 Subject: use cargo vendor feature to reduce sources size --- makedeps.sh | 4 +--- php-pecl-skywalking.spec | 28 ++++++++++++++++++++++++++-- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/makedeps.sh b/makedeps.sh index 205b292..1179dbb 100755 --- a/makedeps.sh +++ b/makedeps.sh @@ -10,9 +10,7 @@ if [ -f skywalking-$1.tgz ]; then pushd skywalking-$1 echo "+ Fetch" - mkdir mycargo - export CARGO_HOME=$PWD/mycargo - cargo fetch + cargo vendor mycargo echo "+ Pack" tar czf ../skywalking-deps-$1.tgz mycargo diff --git a/php-pecl-skywalking.spec b/php-pecl-skywalking.spec index 6558781..958ef0b 100644 --- a/php-pecl-skywalking.spec +++ b/php-pecl-skywalking.spec @@ -19,7 +19,7 @@ Summary: The PHP instrument agent for Apache SkyWalking Name: %{?sub_prefix}php-pecl-%{pecl_name} Version: 5.0.1 -Release: 1%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')} +Release: 2%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')} License: ASL 2.0 URL: https://pecl.php.net/package/%{pecl_name} @@ -44,6 +44,7 @@ BuildRequires: %{?scl_prefix}php-pcre BuildRequires: libcurl-devel BuildRequires: cargo BuildRequires: rustfmt +BuildRequires: rust-packaging # Using system rust registry #BuildRequires: (crate(anyhow/default) >= 1.0.57 with crate(anyhow/default) < 2.0.0~) #BuildRequires: (crate(cbindgen/default) >= 0.23.0 with crate(cbindgen/default) < 0.24.0~) @@ -65,7 +66,6 @@ BuildRequires: rustfmt #*************: (crate(tonic/default) >= 0.5.2 with crate(tonic/default) < 0.6.0~) #BuildRequires: (crate(uuid/default) >= 1.0.0 with crate(uuid/default) < 2.0.0~) #BuildRequires: (crate(uuid/v4) >= 1.0.0 with crate(uuid/v4) < 2.0.0~) -#BuildRequires: rust-packaging Requires: %{?scl_prefix}php(zend-abi) = %{php_zend_api} Requires: %{?scl_prefix}php(api) = %{php_core_api} @@ -101,6 +101,27 @@ sed -e 's/role="test"/role="src"/' \ -i package.xml pushd NTS +# Create cargo configuration to use vendor directory +mkdir .cargo +cat << EOF | tee .cargo/config.toml +[build] +rustc = "%{__rustc}" + +[env] +CFLAGS = "%{build_cflags}" +CXXFLAGS = "%{build_cxxflags}" +LDFLAGS = "%{build_ldflags}" + +[term] +verbose = true + +[source.crates-io] +replace-with = "vendored-sources" + +[source.vendored-sources] +directory = "$(dirname $PWD)/mycargo" +EOF + : Check version extver=$(sed -n '/#define PHP_SKYWALKING_VERSION /{s/.* "//;s/".*$//;p}' php_skywalking.h) if test "x${extver}" != "x%{version}%{?prever}"; then @@ -240,6 +261,9 @@ OPT="-n -d extension=curl.so -d extension=json.so" %changelog +* Fri Jul 1 2022 Remi Collet - 5.0.1-2 +- use cargo vendor feature to reduce sources size + * Thu Jun 30 2022 Remi Collet - 5.0.1-1 - update to 5.0.1 - use bundled rust registry -- cgit