From a3ce466ca7d77db8108e37dbcbb68869914d6dbf Mon Sep 17 00:00:00 2001 From: Mikolaj Izdebski Date: Thu, 11 Jun 2015 08:31:32 +0200 Subject: [PATCH] Remove bundled code from SRPM (rhbz#991356) --- .gitignore | 1 + generate-tarball.sh | 28 ++++++++++++++++++++++++++++ jna.spec | 21 ++++----------------- sources | 2 +- 4 files changed, 34 insertions(+), 18 deletions(-) create mode 100755 generate-tarball.sh diff --git a/.gitignore b/.gitignore index 327ec58..c9ef048 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ jna-3.2.7.tar.bz2 /jna-4.0.tar.gz /jna-4.0.0.tar.gz /jna-4.1.0.tar.gz +/jna-4.1.0-clean.tar.xz diff --git a/generate-tarball.sh b/generate-tarball.sh new file mode 100755 index 0000000..45cbffd --- /dev/null +++ b/generate-tarball.sh @@ -0,0 +1,28 @@ +#!/bin/bash +set -e + +version=`grep Version: *spec | sed -e 's/Version:\s*\(.*\)/\1/'` + + +wget https://github.com/twall/jna/tarball/${version} -O jna-${version}.tar.gz +rm -rf jna-${version} +tar xf jna-${version}.tar.gz +mv twall-jna-* jna-${version} +# remove bundled things with unknown licensing +rm -rvf jna-${version}/{dist/*,www,native/libffi} +# jars in lib/native subdir need to be present in tarball so +# that final jar can be built. They can be empty and then have no +# effect on resulting jar. One jar (depending on architecture) will +# be replaced with full content (containing libjnidispatch.so) +for njar in jna-${version}/lib/native/*.jar; do + rm -v $njar + touch empty + jar cf $njar empty + rm -f empty +done + +find jna-${version} -iname '*jar' -size +1b -delete +find jna-${version} -name '*.class' -delete + +tar cf jna-${version}-clean.tar jna-${version} +xz -9 jna-${version}-clean.tar diff --git a/jna.spec b/jna.spec index 307e4e0..4ebdb44 100644 --- a/jna.spec +++ b/jna.spec @@ -7,15 +7,10 @@ Summary: Pure Java access to native libraries # which is pure Apache License 2.0. License: (LGPLv2 or ASL 2.0) and ASL 2.0 URL: https://github.com/twall/jna -# The source for this package was pulled from upstream's vcs. Use the -# following commands to generate the tarball: -# https://github.com/twall/jna/tarball/%{version} -# tar xzf twall-jna-%{version}*.tar.gz -# mv twall-jna-* jna-%{version} -# rm -rf jna-%{version}/{dist/*,www} -# tar cjf ~/rpm/SOURCES/jna-%{version}.tar.gz jna-%{version} -Source0: https://github.com/twall/jna/archive/%{name}-%{version}.tar.gz -Source1: package-list +# ./generate-tarball.sh +Source0: %{name}-%{version}-clean.tar.xz +Source1: package-list +Source2: generate-tarball.sh Patch0: jna-3.5.0-build.patch # This patch is Fedora-specific for now until we get the huge # JNI library location mess sorted upstream @@ -82,14 +77,6 @@ chmod -Rf a+rX,u+w,g-w,o-w . %patch6 -p1 -b .ffi %patch7 -p1 -# all java binaries must be removed from the sources -#find . -name '*.jar' -delete -rm lib/junit.jar -find . -name '*.class' -delete - -# remove internal copy of libffi -rm -rf native/libffi - # clean LICENSE.txt sed -i 's/\r//' LICENSE diff --git a/sources b/sources index 75a75d1..5ebcd67 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -b2cdb0d4ec2733690849b05d0f05b00b jna-4.1.0.tar.gz +a2a3f08c2fc34ca05a1f55480ce0a9bd jna-4.1.0-clean.tar.xz