summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2025-01-15 06:47:29 +0000
committerCoprDistGit <infra@openeuler.org>2025-01-15 06:47:29 +0000
commit1e503e91e0cc9e3793f1c558c56cc10e1c93fb98 (patch)
tree70292c74c2ab4db698615e7d823d9357eeaced7f
parentf71cf5357e1a2dc350cbef90c63632f7f26b2f6d (diff)
automatic import of openEuler-rpm-config
-rw-r--r--.gitignore1
-rw-r--r--0001-support-sw_64-arch.patch44
-rwxr-xr-xbrp-digest-list38
-rw-r--r--brp-llvm-compile-lto-elf57
-rw-r--r--macros4
-rw-r--r--macros.python18
-rw-r--r--macros.shell-completions3
-rw-r--r--openEuler-rpm-config.spec27
-rw-r--r--sources1
9 files changed, 172 insertions, 21 deletions
diff --git a/.gitignore b/.gitignore
index b3547b5..e69de29 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +0,0 @@
-/30.tar.gz
diff --git a/0001-support-sw_64-arch.patch b/0001-support-sw_64-arch.patch
new file mode 100644
index 0000000..2e150e4
--- /dev/null
+++ b/0001-support-sw_64-arch.patch
@@ -0,0 +1,44 @@
+From 62d742713b0d6ed67fad52821541a7d83f4ce702 Mon Sep 17 00:00:00 2001
+From: Funda Wang <fundawang@yeah.net>
+Date: Sun, 12 Jan 2025 23:02:47 +0800
+Subject: [PATCH] support sw_64 arch
+
+---
+ config.guess | 8 ++++++++
+ config.sub | 1 +
+ 2 files changed, 9 insertions(+)
+
+diff --git a/config.guess b/config.guess
+index 48a6846..b8fc0ac 100755
+--- a/config.guess
++++ b/config.guess
+@@ -1194,6 +1186,14 @@ EOF
+ sparc:Linux:*:* | sparc64:Linux:*:*)
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+ ;;
++ sw_64:Linux:*:*)
++ case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in
++ sw) UNAME_MACHINE=sw_64 ;;
++ esac
++ objdump --private-headers /bin/sh | grep -q ld.so.1
++ if test "$?" = 0 ; then LIBC=gnulibc1 ; fi
++ GUESS=$UNAME_MACHINE-sunway-linux-$LIBC
++ ;;
+ tile*:Linux:*:*)
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+ ;;
+diff --git a/config.sub b/config.sub
+index 4aaae46..d49ee9b 100755
+--- a/config.sub
++++ b/config.sub
+@@ -1432,6 +1431,7 @@ case $cpu-$vendor in
+ | sparcv9v \
+ | spu \
+ | sv1 \
++ | sw_64 \
+ | sx* \
+ | tahoe \
+ | thumbv7* \
+--
+2.46.0
+
diff --git a/brp-digest-list b/brp-digest-list
index 2f0681d..645f5e4 100755
--- a/brp-digest-list
+++ b/brp-digest-list
@@ -68,10 +68,6 @@ DIGEST_LIST_TLV_PATH="$DIGEST_LIST_DIR.tlv/0-metadata_list-compact_tlv-$(basenam
chmod 644 $DIGEST_LIST_TLV_PATH
echo $DIGEST_LIST_TLV_PATH
-#if [[ "$(basename $BIN_PKG_FILES)" =~ "digest-list-tools" && \
-# ! $(basename $BIN_PKG_FILES) =~ "debug" ]]; then
-# Generate digest list for the user space parsers
-
# do EBS sign
export PUBLISHER_HOST=$(grep PUBLISHER_HOST /lkp/scheduled/job.yaml | awk '{print $2}')
export PUBLISHER_PORT=$(grep PUBLISHER_PORT /lkp/scheduled/job.yaml | awk '{print $2}')
@@ -85,14 +81,28 @@ if [[ -n "$PUBLISHER_HOST" && -n "$PUBLISHER_PORT" ]]; then
fi
# do OBS sign
-[ -f /usr/lib/rpm/brp-suse.d/brp-99-pesign ] || exit 0
-
-export BRP_PESIGN_FILES="$2/etc/ima/digest_lists/*"
-export RPM_BUILD_ROOT
-export RPM_PACKAGE_NAME="digest-list-tools"
-export RPM_SOURCE_DIR="$(rpm --eval %_topdir)/SOURCES"
-
-if [ -f "/usr/lib/rpm/brp-suse.d/brp-99-pesign" ]; then
- /usr/lib/rpm/brp-suse.d/brp-99-pesign &> /dev/null
+if [[ "$(basename $BIN_PKG_FILES)" =~ "digest-list-tools" && \
+ ! $(basename $BIN_PKG_FILES) =~ "debug" ]]; then
+ # Generate digest list for the user space parsers
+ LD_LIBRARY_PATH=$RPM_BUILD_ROOT/usr/lib64 \
+ $RPM_BUILD_ROOT/usr/bin/gen_digest_lists \
+ -d $DIGEST_LIST_DIR -t parser -f compact -m immutable \
+ -i I:$RPM_BUILD_ROOT/usr/libexec -o add -p -1 -i i:
+
+ f="$DIGEST_LIST_DIR/0-parser_list-compact-libexec"
+ [ -f $f ] || exit 0
+
+ chmod 644 $f
+ echo $f
+
+ [ -f /usr/lib/rpm/brp-suse.d/brp-99-pesign ] || exit 0
+
+ export BRP_PESIGN_FILES="$2/etc/ima/digest_lists/*"
+ export RPM_BUILD_ROOT
+ export RPM_PACKAGE_NAME="digest-list-tools"
+ export RPM_SOURCE_DIR="$(rpm --eval %_topdir)/SOURCES"
+
+ if [ -f "/usr/lib/rpm/brp-suse.d/brp-99-pesign" ]; then
+ /usr/lib/rpm/brp-suse.d/brp-99-pesign &> /dev/null
+ fi
fi
-#fi
diff --git a/brp-llvm-compile-lto-elf b/brp-llvm-compile-lto-elf
new file mode 100644
index 0000000..9ef4d40
--- /dev/null
+++ b/brp-llvm-compile-lto-elf
@@ -0,0 +1,57 @@
+#!/usr/bin/bash -eu
+# From fedora:
+# https://src.fedoraproject.org/rpms/redhat-rpm-config
+# version 287
+
+
+if [ -z "$RPM_BUILD_ROOT" ] || [ "$RPM_BUILD_ROOT" = "/" ]; then
+ exit 0
+fi
+
+CLANG_FLAGS=$@
+NCPUS=${RPM_BUILD_NCPUS:-1}
+
+check_convert_bitcode () {
+ local file_name=$(realpath ${1})
+ local file_type=$(file ${file_name})
+
+ shift
+ CLANG_FLAGS="$@"
+
+ if [[ "${file_type}" == *"LLVM IR bitcode"* ]]; then
+ # Check the output of llvm-strings for the command line, which is in the LLVM bitcode because
+ # we pass -frecord-gcc-switches.
+ # Check for a line that has "-flto" after (or without) "-fno-lto".
+ llvm-strings ${file_name} | while read line ; do
+ flto=$(echo $line | grep -o -b -e -flto | tail -n 1 | cut -d : -f 1)
+ fnolto=$(echo $line | grep -o -b -e -fno-lto | tail -n 1 | cut -d : -f 1)
+
+ if test -n "$flto" && { test -z "$fnolto" || test "$flto" -gt "$fnolto"; } ; then
+ echo "Compiling LLVM bitcode file ${file_name}."
+ clang ${CLANG_FLAGS} -fno-lto -Wno-unused-command-line-argument \
+ -x ir ${file_name} -c -o ${file_name}
+ break
+ fi
+ done
+ elif [[ "${file_type}" == *"current ar archive"* ]]; then
+ echo "Unpacking ar archive ${file_name} to check for LLVM bitcode components."
+ # create archive stage for objects
+ local archive_stage=$(mktemp -d)
+ local archive=${file_name}
+ pushd ${archive_stage}
+ ar x ${archive}
+ for archived_file in $(find -not -type d); do
+ check_convert_bitcode ${archived_file} ${CLANG_FLAGS}
+ echo "Repacking ${archived_file} into ${archive}."
+ ar r ${archive} ${archived_file}
+ done
+ popd
+ fi
+}
+
+echo "Checking for LLVM bitcode artifacts"
+export -f check_convert_bitcode
+# Deduplicate by device:inode to avoid processing hardlinks in parallel.
+find "$RPM_BUILD_ROOT" -type f -name "*.[ao]" -printf "%D:%i %p\n" | \
+ awk '!seen[$1]++' | cut -d" " -f2- | \
+ xargs -d"\n" -r -n1 -P$NCPUS sh -c "check_convert_bitcode \$@ $CLANG_FLAGS" ARG0
diff --git a/macros b/macros
index 6ff7d6a..47926b5 100644
--- a/macros
+++ b/macros
@@ -260,6 +260,7 @@ for k,_ in pairs(stripped_flags) do print(k .. " ") end
%__brp_remove_la_files /usr/lib/rpm/brp-remove-la-files
%__brp_remove_info_dir /usr/lib/rpm/brp-remove-info-dir
%__brp_clean_perl_files /usr/lib/rpm/brp-clean-perl-files
+%__brp_llvm_compile_lto_elf /usr/lib/rpm/brp-llvm-compile-lto-elf %{build_cflags} %{build_ldflags}
%__os_install_post \
%{?__brp_ldconfig} \
@@ -279,6 +280,7 @@ for k,_ in pairs(stripped_flags) do print(k .. " ") end
%{nil}
%__spec_install_post\
+ %[ "%{toolchain}" == "clang" ? "%{?__brp_llvm_compile_lto_elf}" : "%{nil}" ] \
%{?__debug_package:%{__debug_install_post}}\
%{?@VENDOR@_delete_rpath:%{?__brp_chrpath}} \
%{__arch_install_post}\
@@ -410,7 +412,7 @@ for k,_ in pairs(stripped_flags) do print(k .. " ") end
%pkg_vcmp() (%{expand:%%{pkg_version_cmp %1 %3}} %2 0)
#arches macros
-%generic_arches %{ix86} x86_64 %{arm} aarch64 loongarch64 powerpc64le ppc64le
+%generic_arches %{ix86} x86_64 %{arm} aarch64 loongarch64 powerpc64le ppc64le sw_64
%ldc_arches %{generic_arches}
%valgrind_arches %{generic_arches}
%nodejs_arches %{generic_arches} riscv64
diff --git a/macros.python b/macros.python
index 334c0ab..59df735 100644
--- a/macros.python
+++ b/macros.python
@@ -63,7 +63,14 @@ find $bytecode_compilation_path -type f -a -name "*.py" -print0 | xargs -0 $pyth
}
%py_install_wheel() %{expand:\\\
- pip install -I dist/%{1} --root %{buildroot} --strip-file-prefix %{buildroot} --no-deps
+ %{__python} -m pip install -I dist/%{1} --root %{buildroot} --prefix %{_prefix} --no-deps --no-index --no-warn-script-location
+ rm -rfv %{buildroot}%{_bindir}/__pycache__
+ for distinfo in %{buildroot}%{python_sitelib}/*.dist-info %{buildroot}%{python_sitearch}/*.dist-info; do
+ if [ -f ${distinfo}/direct_url.json ]; then
+ rm -fv ${distinfo}/direct_url.json
+ sed -i '/direct_url.json/d' ${distinfo}/RECORD
+ fi
+ done
}
%python_provide() %{lua:
@@ -189,7 +196,14 @@ find $bytecode_compilation_path -type f -a -name "*.py" -print0 | xargs -0 $pyth
}
%py3_install_wheel() %{expand:\\\
- pip%{python3_version} install -I dist/%{1} --root %{buildroot} --no-deps
+ %{__python3} -m pip install -I dist/%{1} --root %{buildroot} --prefix %{_prefix} --no-deps --no-index --no-warn-script-location
+ rm -rfv %{buildroot}%{_bindir}/__pycache__
+ for distinfo in %{buildroot}%{python3_sitelib}/*.dist-info %{buildroot}%{python3_sitearch}/*.dist-info; do
+ if [ -f ${distinfo}/direct_url.json ]; then
+ rm -fv ${distinfo}/direct_url.json
+ sed -i '/direct_url.json/d' ${distinfo}/RECORD
+ fi
+ done
}
# python3_pkgversion specifies the version of Python 3 in the distro. It can be
# a specific version (e.g. 34 in Fedora EPEL7)
diff --git a/macros.shell-completions b/macros.shell-completions
new file mode 100644
index 0000000..8e505d7
--- /dev/null
+++ b/macros.shell-completions
@@ -0,0 +1,3 @@
+%bash_completions_dir %{_datadir}/bash-completion/completions
+%zsh_completions_dir %{_datadir}/zsh/site-functions
+%fish_completions_dir %{_datadir}/fish/vendor_completions.d
diff --git a/openEuler-rpm-config.spec b/openEuler-rpm-config.spec
index b721b52..a36338f 100644
--- a/openEuler-rpm-config.spec
+++ b/openEuler-rpm-config.spec
@@ -3,7 +3,7 @@
Name: %{vendor}-rpm-config
Version: 31
-Release: 7
+Release: 12
License: GPL+
Summary: specific rpm configuration files
URL: https://gitee.com/src-openeuler/openEuler-rpm-config
@@ -30,6 +30,7 @@ Source101: macros.forge
Source102: macros.go
Source103: macros.python
Source104: macros.kmp
+Source105: macros.shell-completions
# Dependency generator scripts
Source200: find-requires.ksyms
@@ -46,6 +47,7 @@ Source303: fix-libtool-from-moving-options-after-libs
# Snapshots from http://git.savannah.gnu.org/gitweb/?p=config.git
Source500: config.guess
Source501: config.sub
+Patch0001: 0001-support-sw_64-arch.patch
# BRPs
Source700: brp-chrpath
@@ -56,6 +58,7 @@ Source704: brp-remove-info-dir
Source705: brp-check-elf-files
Source706: brp-strip-lto
Source707: brp-clean-perl-files
+Source708: brp-llvm-compile-lto-elf
# Convenience lua functions
Source800: common.lua
@@ -113,6 +116,10 @@ Requires: %{_bindir}/xargs
Requires: %{_bindir}/chrpath
Requires: %{_bindir}/eu-elfclassify
+# for brp-llvm-compile-lto-elf
+Requires: (llvm if clang)
+Requires: (gawk if clang)
+
Requires: coreutils
# -fstack-clash-protection and -fcf-protection require GCC 8.
@@ -147,7 +154,7 @@ install -p -m 755 -t %{buildroot}%{rpmvdir} find-requires*
install -p -m 755 -t %{buildroot}%{rpmvdir} find-provides*
mkdir -p %{buildroot}%{_rpmconfigdir}/macros.d
-install -p -m 644 -t %{buildroot}%{_rpmconfigdir}/macros.d/ macros.perl macros.python macros.go macros.forge macros.kmp
+install -p -m 644 -t %{buildroot}%{_rpmconfigdir}/macros.d/ macros.perl macros.python macros.go macros.forge macros.kmp macros.shell-completions
mkdir -p %{buildroot}%{_fileattrsdir}
install -p -m 644 -t %{buildroot}%{_fileattrsdir} *.attr
@@ -179,6 +186,22 @@ sed -i "s/@VENDOR@/%{vendor}/g" `grep "@VENDOR@" -rl %{buildroot}%{_rpmconfigdir
%{rpmvdir}/find-requires.ksyms
%changelog
+* Wed Jan 15 2025 luhuaxin <luhuaxin1@huawei.com> - 31-12
+- ima: keep the process of OBS signing same as previous version
+
+* Sun Jan 12 2025 Funda Wang <fundawang@yeah.net> - 31-11
+- support sw_64 arch
+
+* Mon Jan 06 2025 Funda Wang <fundawang@yeah.net> - 31-10
+- add shell completions dir declaration
+
+* Wed Dec 11 2024 Funda Wang <fundawang@yeah.net> - 31-9
+- update py_install_wheel declaration
+
+* Sat Nov 16 2024 Funda Wang <fundawang@yeah.net> - 31-8
+- compile LLVM IR bitcode in object files or static libraries
+ into ELF object code for clang < 18
+
* Sat Oct 26 2024 Funda Wang <fundawang@yeah.net> - 31-7
- remove useless perl .packlist, empty .bs files and
wrongly created perllocal.pod from buildroot
diff --git a/sources b/sources
index 7d6bc77..e69de29 100644
--- a/sources
+++ b/sources
@@ -1 +0,0 @@
-51eb1809aa9bc05c281ad801f61b7f42 30.tar.gz