diff --git a/add-brp-scripts-to-delete-rpath.patch b/add-brp-scripts-to-delete-rpath.patch new file mode 100644 index 0000000..5202579 --- /dev/null +++ b/add-brp-scripts-to-delete-rpath.patch @@ -0,0 +1,145 @@ +From bfd075e7478e87bed1fa0b3b7508a5ba8542c239 Mon Sep 17 00:00:00 2001 +From: gaoyi +Date: Fri, 6 Mar 2020 06:04:41 -0500 +Subject: [PATCH] add brp scripts to delete rpath + +Signed-off-by: gaoyi +Signed-off-by: xujing +--- + brp-chrpath | 103 ++++++++++++++++++++++++++++++++++++++++++++++++++++ + macros | 2 + + 2 files changed, 105 insertions(+) + create mode 100755 brp-chrpath + +diff --git a/brp-chrpath b/brp-chrpath +new file mode 100755 +index 0000000..6dd37de +--- /dev/null ++++ b/brp-chrpath +@@ -0,0 +1,103 @@ ++#!/usr/bin/sh ++# remove rpath specified ++ ++rpathSuffix=( ++ "/home/abuild/rpmbuild/BUILD" ++) ++ ++rpath=( ++ "/usr/lib64", ++ "/lib64", ++ "/usr/lib", ++ "/lib", ++ "/usr/lib/../lib64" ++) ++ ++buildroot=$1 ++ ++function rpathChange() ++{ ++ localSrcPath=$1 ++ localDstPath="" ++ ++ rpathArr=(`echo $localSrcPath | tr ':' ' '`) ++ ++ for path in ${rpathArr[*]} ++ do ++ localflag=0 ++ for suffix in ${rpathSuffix[*]} ++ do ++ if echo "$path" | grep $suffix &> /dev/null; then ++ localflag=1 ++ break ++ fi ++ done ++ ++ # Is the suffix path, delete ++ if [ $localflag -eq 1 ]; then ++ continue; ++ fi ++ ++ #Is the standard path, delete ++ if echo "${rpath[@]}" | grep -w $path &> /dev/null; then ++ continue ++ fi ++ ++ if [ x"$localDstPath" == x"" ]; then ++ localDstPath=$path ++ else ++ localDstPath=$localDstPath:$path ++ fi ++ done ++ ++ echo $localDstPath ++} ++ ++function removeRpathOrRunpath() ++{ ++ localfile=$1 ++ ++ rpathInfo=$(chrpath -l $localfile | grep "RPATH=") ++ runpathInfo=$(chrpath -l $localfile | grep "RUNPATH=") ++ ++ currPath="" ++ realPath="" ++ needCh=0 ++ if [ x"$rpathInfo" != x"" ]; then ++ needCh=1 ++ currPath=$(echo $rpathInfo | awk -F "RPATH=" '{print $2}') ++ realPath=$(rpathChange $currPath) ++ fi ++ ++ if [ x"$runpathInfo" != x"" ]; then ++ needCh=1 ++ currPath=$(echo $runpathInfo | awk -F "RUNPATH=" '{print $2}') ++ realPath=$(rpathChange $currPath) ++ fi ++ ++ if [ $needCh -eq 0 ]; then ++ return 0 ++ fi ++ ++ if [ x"$realPath" == x"" ]; then ++ chrpath -d $localfile ++ else ++ chrpath -r $realPath $localfile ++ fi ++ ++ return 0 ++} ++ ++for file in $(find $buildroot/ -executable -type f -exec file {} ';' | grep "\" | awk -F ':' '{print $1}') ++do ++ test -u $file ++ if [ $? -eq 0 ]; then ++ continue ++ fi ++ ++ if [ -w "$file" ]; then ++ removeRpathOrRunpath $file ++ fi ++done ++ ++exit 0 +diff --git a/macros b/macros +index 36621df..104556b 100644 +--- a/macros ++++ b/macros +@@ -89,6 +89,7 @@ + + # Build root policy macros. Standard naming: + # convert all '-' in basename to '_', add two leading underscores. ++%__brp_chrpath /usr/lib/rpm/brp-chrpath %{buildroot} + %__brp_ldconfig /usr/lib/rpm/brp-ldconfig + %__brp_compress /usr/lib/rpm/brp-compress + %__brp_strip /usr/lib/rpm/brp-strip %{__strip} +@@ -107,6 +108,7 @@ + %{?__brp_strip_static_archive} \ + %{?py_auto_byte_compile:%{?__brp_python_bytecompile}} \ + %{?__brp_python_hardlink} \ ++ %{?openeuler_delete_rpath:%{?__brp_chrpath}} \ + %{nil} + + %__spec_install_post\ +-- +2.33.0 + diff --git a/fix-the-ELF-file-cannot-be-found-due-to-escape-of.patch b/fix-the-ELF-file-cannot-be-found-due-to-escape-of.patch new file mode 100644 index 0000000..ae85c22 --- /dev/null +++ b/fix-the-ELF-file-cannot-be-found-due-to-escape-of.patch @@ -0,0 +1,25 @@ +From 4e1adcc36b0c2e379d6080ceb874f2413644c535 Mon Sep 17 00:00:00 2001 +From: xujing +Date: Wed, 15 Nov 2023 17:16:22 +0800 +Subject: [PATCH] fix the ELF file cannot be found due to escape of '\' + +--- + macros | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/macros b/macros +index 7cde63f..36621df 100644 +--- a/macros ++++ b/macros +@@ -275,7 +275,7 @@ find $RPM_BUILD_ROOT -type f -name "*.a" -delete + + %delete_la find $RPM_BUILD_ROOT -type f -name "*.la" -delete + +-%chrpath_delete find $RPM_BUILD_ROOT/ -type f -exec file {} ';' | grep "\" | awk -F ':' '{print $1}' | xargs -i chrpath --delete {} ++%chrpath_delete find $RPM_BUILD_ROOT/ -type f -exec file {} ';' | grep "\\" | awk -F ':' '{print $1}' | xargs -i chrpath --delete {} + + %package_help \ + %package help \ +-- +2.33.0 + diff --git a/openEuler-rpm-config.spec b/openEuler-rpm-config.spec index b245e9b..9c4159c 100644 --- a/openEuler-rpm-config.spec +++ b/openEuler-rpm-config.spec @@ -3,7 +3,7 @@ Name: %{vendor}-rpm-config Version: 30 -Release: 20 +Release: 21 License: GPL+ Summary: specific rpm configuration files URL: https://gitee.com/openeuler/openEuler-rpm-config @@ -16,7 +16,9 @@ Patch2: change-the-openEuler-to-generic-for-common-use.patch Patch3: exclude-kernel-source-and-EFI-files-in-digest-list-building.patch Patch4: check-if-the-file-is-a-symbolic-link-in-brp-digest-list.patch -Patch9002: openEuler-remove-fexceptions.patch +Patch9000: openEuler-remove-fexceptions.patch +Patch9001: fix-the-ELF-file-cannot-be-found-due-to-escape-of.patch +Patch9002: add-brp-scripts-to-delete-rpath.patch Provides: python-rpm-macros = %{?epoch:%{epoch}:}%{version}-%{release} Provides: python2-rpm-macros = %{?epoch:%{epoch}:}%{version}-%{release} @@ -113,6 +115,10 @@ mkdir -p %{buildroot}%{_fileattrsdir} %{_rpmconfigdir}/macros.d/macros.kmp %changelog +* Fri Nov 17 2023 xujing - 30-21 +- add brp script to delete rpath + fix the ELF file cannot be found due to escape of '\' + * Fri Nov 03 2023 fuanan - 30-20 - check if the file is a symbolic link in brp-digest-list