diff --git a/Modify-gradle-url-to-huaweicloud.patch b/Modify-gradle-url-to-huaweicloud.patch new file mode 100644 index 0000000000000000000000000000000000000000..c8d57e3af122bcd29f27ae50a982caa382ba0439 --- /dev/null +++ b/Modify-gradle-url-to-huaweicloud.patch @@ -0,0 +1,11 @@ +diff -Nur kafka-2.4.0-src/gradle/wrapper/gradle-wrapper.properties kafka-2.4.0-src_bak/gradle/wrapper/gradle-wrapper.properties +--- kafka-2.4.0-src/gradle/wrapper/gradle-wrapper.properties 2019-12-10 00:46:25.000000000 +0800 ++++ kafka-2.4.0-src_bak/gradle/wrapper/gradle-wrapper.properties 2021-07-15 19:07:47.787010158 +0800 +@@ -14,6 +14,6 @@ + # limitations under the License. + distributionBase=GRADLE_USER_HOME + distributionPath=wrapper/dists +-distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip ++distributionUrl=https\://mirrors.huaweicloud.com/gradle/gradle-5.6.2-all.zip + zipStoreBase=GRADLE_USER_HOME + zipStorePath=wrapper/dists diff --git a/Modify-gradle-wrapper-to-local-source.patch b/Modify-gradle-wrapper-to-local-source.patch new file mode 100644 index 0000000000000000000000000000000000000000..02a86eaf0f302ea2dd4ca41fbc4ecbbca54edd15 --- /dev/null +++ b/Modify-gradle-wrapper-to-local-source.patch @@ -0,0 +1,26 @@ +diff -Nur kafka-2.4.0-src/gradlew kafka-2.4.0-src_bak/gradlew +--- kafka-2.4.0-src/gradlew 2019-12-10 00:46:25.000000000 +0800 ++++ kafka-2.4.0-src_bak/gradlew 2021-07-15 17:04:42.769268304 +0800 +@@ -98,7 +98,8 @@ + # Loop in case we encounter an error. + for attempt in 1 2 3; do + if [ ! -e $APP_HOME/gradle/wrapper/gradle-wrapper.jar ]; then +- if ! curl -s -S --retry 3 -L -o "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" "https://raw.githubusercontent.com/gradle/gradle/v5.6.2/gradle/wrapper/gradle-wrapper.jar"; then ++# if ! curl -s -S --retry 3 -L -o "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" "https://raw.githubusercontent.com/gradle/gradle/v5.6.2/gradle/wrapper/gradle-wrapper.jar"; then ++ if ! curl -s -S --retry 3 -L -o "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" "file://absolute-prefix/gradle-wrapper.jar"; then + rm -f "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" + # Pause for a bit before looping in case the server throttled us. + sleep 5 +diff -Nur kafka-2.4.0-src/wrapper.gradle kafka-2.4.0-src_bak/wrapper.gradle +--- kafka-2.4.0-src/wrapper.gradle 2019-12-10 00:46:25.000000000 +0800 ++++ kafka-2.4.0-src_bak/wrapper.gradle 2021-07-15 17:02:19.466895555 +0800 +@@ -58,7 +58,8 @@ + // github.com servers deprecated TLSv1/TLSv1.1 support some time ago, so older versions + // of curl (built against OpenSSL library that doesn't support TLSv1.2) would fail to + // fetch the jar. +- def wrapperBaseUrl = "https://raw.githubusercontent.com/gradle/gradle/v$fullVersion/gradle/wrapper" ++// def wrapperBaseUrl = "https://raw.githubusercontent.com/gradle/gradle/v$fullVersion/gradle/wrapper" ++ def wrapperBaseUrl = "file://absolute-prefix" + def wrapperJarUrl = wrapperBaseUrl + "/gradle-wrapper.jar" + + def bootstrapString = """ diff --git a/Modify-maven-url-to-huaweicloud.patch b/Modify-maven-url-to-huaweicloud.patch new file mode 100644 index 0000000000000000000000000000000000000000..6d039712336521b02071245cdd57bf6ee106c705 --- /dev/null +++ b/Modify-maven-url-to-huaweicloud.patch @@ -0,0 +1,24 @@ +diff -Nur kafka-2.4.0-src/build.gradle ../kafka/kafka-2.4.0-src/build.gradle +--- kafka-2.4.0-src/build.gradle 2019-12-10 00:46:25.000000000 +0800 ++++ ../kafka/kafka-2.4.0-src/build.gradle 2021-07-15 18:14:53.000000000 +0800 +@@ -19,10 +19,8 @@ + + buildscript { + repositories { +- mavenCentral() +- jcenter() + maven { +- url "https://plugins.gradle.org/m2/" ++ url "https://mirrors.huaweicloud.com/repository/maven/" + } + } + apply from: file('gradle/buildscript.gradle'), to: buildscript +@@ -52,7 +50,7 @@ + allprojects { + + repositories { +- mavenCentral() ++ maven {url "https://mirrors.huaweicloud.com/repository/maven/"} + } + + apply plugin: 'idea' diff --git a/gradle-wrapper.jar b/gradle-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..5c2d1cf016b3885f6930543d57b744ea8c220a1a Binary files /dev/null and b/gradle-wrapper.jar differ diff --git a/kafka.spec b/kafka.spec index 7de1ed258981eba0977ef35ddf426f9d34de6c7a..67e42e7f5399ac7f881edbdb0515053d924b749c 100644 --- a/kafka.spec +++ b/kafka.spec @@ -4,12 +4,16 @@ Name: kafka Version: 2.4.0 -Release: 3 +Release: 4 Summary: A Distributed Streaming Platform. License: Apache License, Version 2.0 Source0: https://archive.apache.org/dist/%{name}/%{version}/%{name}-%{version}-src.tgz Source1: kafka.service +Source2: https://raw.githubusercontent.com/gradle/gradle/v5.6.2/gradle/wrapper/gradle-wrapper.jar +patch1: Modify-gradle-wrapper-to-local-source.patch +patch2: Modify-maven-url-to-huaweicloud.patch +patch3: Modify-gradle-url-to-huaweicloud.patch BuildRequires: systemd java-1.8.0-openjdk-devel Provides: kafka = %{version} @@ -30,6 +34,16 @@ exit 0 %prep %setup -q -n %{name}-%{version}-src +%patch1 -p1 +%patch2 -p1 +%patch3 -p1 +cp %{SOURCE2} ./ +echo `pwd` > absolute_prefix.log +sed -i 's/\//\\\//g' absolute_prefix.log +absolute_prefix=`head -n 1 absolute_prefix.log` +sed -i 's/absolute-prefix/'"$absolute_prefix"'/g' wrapper.gradle +sed -i 's/absolute-prefix/'"$absolute_prefix"'/g' gradlew + %build ./gradlew jar @@ -56,6 +70,11 @@ cp -n */*/build/dependant-libs*/* $RPM_BUILD_ROOT%{kafka_home}/libs rm -rf %{buildroot} %changelog +* Thu Jul 15 2021 liyanan - 2.4.0-4 +- fix gradle url to huaweicloud +- fix gradle wrapper to local source +- fix maven url to huaweicloud + * Thu Apr 2 2021 huanghaitao 2.4.0 - 3 - Declare kafka already include zookeeper