Compare commits

...

11 Commits

Author SHA1 Message Date
Jiayi Yin
7ae12120a2 init 2025-04-30 06:54:17 +00:00
openeuler-ci-bot
fcca3decb1
!221 don't delete the commented code in macros
From: @xujing99 
Reviewed-by: @openeuler-basic 
Signed-off-by: @openeuler-basic
2024-04-29 07:54:07 +00:00
xujing
15359be6d3 don't delete the commented code in macros 2024-03-21 20:00:05 +08:00
openeuler-ci-bot
f27ee55f26
!194 删除无用的注释性代码
From: @hongjinghao 
Reviewed-by: @licunlong 
Signed-off-by: @licunlong
2024-03-06 03:32:12 +00:00
hongjinghao
c29b312161 Delete the commented code 2024-03-05 20:43:37 +08:00
openeuler-ci-bot
63bc8eb857
!169 excute brp_chrpath before arch_install_post
From: @xujing99 
Reviewed-by: @licunlong 
Signed-off-by: @licunlong
2023-11-21 07:10:51 +00:00
xujing
81eca82434 excute brp_chrpath before arch_install_post 2023-11-21 14:35:55 +08:00
openeuler-ci-bot
fc749173fa
!165 add the scanning path of the rpath
From: @xujing99 
Reviewed-by: @licunlong 
Signed-off-by: @licunlong
2023-11-20 06:22:44 +00:00
xujing
a32a977b35 add the scanning path of the rpath
By the way, use vendor name to determine whether to delete rpath.
2023-11-20 11:08:16 +08:00
openeuler-ci-bot
70da5d445b
!164 add brp script to delete rpath
From: @xujing99 
Reviewed-by: @openeuler-basic 
Signed-off-by: @openeuler-basic
2023-11-17 09:54:21 +00:00
xujing
200b9d19a4 add brp script to delete rpath
By the way, fix the ELF file cannot be found due to escape of '\'.
2023-11-17 16:21:12 +08:00
5 changed files with 221 additions and 3 deletions

View File

@ -0,0 +1,24 @@
From c7605385b9d838be78a87de02a48eaaa6e69b4b2 Mon Sep 17 00:00:00 2001
From: hongjinghao <hongjinghao@huawei.com>
Date: Tue, 5 Mar 2024 20:22:59 +0800
Subject: [PATCH] Delete the commented code
---
brp-digest-list | 1 -
1 file changed, 1 deletion(-)
diff --git a/brp-digest-list b/brp-digest-list
index 77248c9..7de42b7 100644
--- a/brp-digest-list
+++ b/brp-digest-list
@@ -9,7 +9,6 @@ if [ -z "$RPM_BUILD_ROOT" -o "$RPM_BUILD_ROOT" = "/" ]; then
fi
# Create temporary file listing files in the manifest
-#[ -n "$TMPDIR" ] || TMPDIR="/tmp"
TMPDIR="/tmp"
BIN_PKG_FILES=${TMPDIR}/${3%%.rpm}
cat - > $BIN_PKG_FILES
--
2.33.0

View File

@ -0,0 +1,146 @@
From 3247ab3820c98cee1b47f1c0bf5f0714c3324fde Mon Sep 17 00:00:00 2001
From: gaoyi <gaoyi15@huawei.com>
Date: Fri, 6 Mar 2020 06:04:41 -0500
Subject: [PATCH] add brp scripts to delete rpath
Signed-off-by: gaoyi <gaoyi15@huawei.com>
Signed-off-by: xujing <xujing125@huawei.com>
---
brp-chrpath | 104 ++++++++++++++++++++++++++++++++++++++++++++++++++++
macros | 2 +
2 files changed, 106 insertions(+)
create mode 100755 brp-chrpath
diff --git a/brp-chrpath b/brp-chrpath
new file mode 100755
index 0000000..dc48351
--- /dev/null
+++ b/brp-chrpath
@@ -0,0 +1,104 @@
+#!/usr/bin/sh
+# remove rpath specified
+
+rpathSuffix=(
+ "/home/abuild/rpmbuild/BUILD",
+ "/home/lkp/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 "\<ELF\>" | 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..a316be9 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}
@@ -111,6 +112,7 @@
%__spec_install_post\
%{?__debug_package:%{__debug_install_post}}\
+ %{?__vendor_delete_rpath:%{?__brp_chrpath}} \
%{__arch_install_post}\
%{__os_install_post}\
%{nil}
--
2.33.0

View File

@ -0,0 +1,25 @@
From 4e1adcc36b0c2e379d6080ceb874f2413644c535 Mon Sep 17 00:00:00 2001
From: xujing <xujing125@huawei.com>
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 "\<ELF\>" | awk -F ':' '{print $1}' | xargs -i chrpath --delete {}
+%chrpath_delete find $RPM_BUILD_ROOT/ -type f -exec file {} ';' | grep "\\<ELF\\>" | awk -F ':' '{print $1}' | xargs -i chrpath --delete {}
%package_help \
%package help \
--
2.33.0

View File

@ -1,9 +1,9 @@
%global vendor %{?_vendor:%{_vendor}}%{!?_vendor:openEuler}
%global vendor {os_name}
%global rpmvdir /usr/lib/rpm/%{vendor}
Name: %{vendor}-rpm-config
Version: 30
Release: 20
Release: 25
License: GPL+
Summary: specific rpm configuration files
URL: https://gitee.com/openeuler/openEuler-rpm-config
@ -16,7 +16,10 @@ 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
Patch9003: Delete-the-commented-code.patch
Provides: python-rpm-macros = %{?epoch:%{epoch}:}%{version}-%{release}
Provides: python2-rpm-macros = %{?epoch:%{epoch}:}%{version}-%{release}
@ -96,6 +99,9 @@ install -p -m 644 -t %{buildroot}%{_rpmconfigdir}/macros.d/ macros.perl macros.p
mkdir -p %{buildroot}%{_fileattrsdir}
# Adaptive according to vendor
sed -i "s/__vendor/%{vendor}/g" `grep "__vendor" -rl %{buildroot}%{_rpmconfigdir}`
%files
%dir %{rpmvdir}
%{rpmvdir}/macros
@ -113,6 +119,23 @@ mkdir -p %{buildroot}%{_fileattrsdir}
%{_rpmconfigdir}/macros.d/macros.kmp
%changelog
* Mon Apr 29 2024 xujing <xujing125@huawei.com> - 30-25
- don't delete the commented code in macros
* Tue Mar 5 2024 hongjinghao <hongjinghao@huawei.com> - 30-24
- Delete the commented code
* Tue Nov 21 2023 xujing <xujing125@huawei.com> - 30-23
- excute brp_chrpath before arch_install_post
* Mon Nov 20 2023 xujing <xujing125@huawei.com> - 30-22
- add the scanning path of the rpath
use vendor name to determine whether to delete rpath
* Fri Nov 17 2023 xujing <xujing125@huawei.com> - 30-21
- add brp script to delete rpath
fix the ELF file cannot be found due to escape of '\'
* Fri Nov 03 2023 fuanan <fuanan3@h-partners.com> - 30-20
- check if the file is a symbolic link in brp-digest-list