From ee778fc76a3b2c25c28d40ec3a6bfbd83dc96322 Mon Sep 17 00:00:00 2001 From: Zhao Hang Date: Wed, 15 Dec 2021 08:27:52 +0000 Subject: [PATCH 1/4] Rebrand for Anolis OS --- rpm.spec | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/rpm.spec b/rpm.spec index 7515542..52cd99e 100644 --- a/rpm.spec +++ b/rpm.spec @@ -1,3 +1,4 @@ +%define anolis_release .0.1 # build against xz? %bcond_without xz # just for giggles, option to build with internal Berkeley DB @@ -21,7 +22,7 @@ # build with readonly sqlite support? %bcond_without sqlite -%if 0%{?rhel} > 7 +%if 0%{?rhel} > 7 || 0%{?anolis} # Disable python2 build by default %bcond_with python2 %else @@ -44,7 +45,7 @@ Summary: The RPM package management system Name: rpm Version: %{rpmver} -Release: %{?snapver:0.%{snapver}.}%{rel}%{?dist} +Release: %{?snapver:0.%{snapver}.}%{rel}%{anolis_release}%{?dist} Group: System Environment/Base Url: http://www.rpm.org/ Source0: http://ftp.rpm.org/releases/%{srcdir}/%{name}-%{srcver}.tar.bz2 @@ -219,7 +220,7 @@ BuildRequires: libubsan %endif %if %{with libimaevm} -%if 0%{?fedora} >= 28 || 0%{?rhel} > 7 +%if 0%{?fedora} >= 28 || 0%{?rhel} > 7 || 0%{?anolis} %global imadevname ima-evm-utils-devel %else %global imadevname ima-evm-utils @@ -694,6 +695,9 @@ make check || cat tests/rpmtests.log %doc doc/librpm/html/* %changelog +* Wed Apr 13 2022 Liwei Ge - 4.14.3-22.0.1 +- Rebrand for Anolis OS + * Tue Feb 15 2022 Michal Domonkos - 4.14.3-22 - Fix spurious %transfiletriggerpostun execution (#2023693) - Skip recorded symlinks in --setperms (#1900662) -- Gitee From 5fefb6627e8f50c0983abe15e37692d234fe6b13 Mon Sep 17 00:00:00 2001 From: Liwei Ge Date: Wed, 28 Oct 2020 14:30:53 +0800 Subject: [PATCH 2/4] Fix gcc10 -fno-common compile issue until upstream fixes this change has given better compatible with gcc10 toolchain, should be maintained util upstream fixes 'multiple definition ...' warnings Default to -fno-common A common mistake in C is omitting extern when declaring a global variable in a header file. If the header is included by several files it results in multiple definitions of the same variable. In previous GCC versions this error is ignored. GCC 10 defaults to -fno-common, which means a linker error will now be reported. To fix this, use extern in header files when declaring global variables, and ensure each global is defined in exactly one C file. If tentative definitions of particular variables need to be placed in a common block, __attribute__((__common__)) can be used to force that behavior even in code compiled without -fcommon. As a workaround, legacy C code where all tentative definitions should be placed into a common block can be compiled with -fcommon. int x; // tentative definition - avoid in header files extern int y; // correct declaration in a header file refer url: https://gcc.gnu.org/gcc-10/porting_to.html Signed-off-by: Liwei Ge Signed-off-by: weitao zhou --- rpm.spec | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rpm.spec b/rpm.spec index 52cd99e..28924aa 100644 --- a/rpm.spec +++ b/rpm.spec @@ -1,4 +1,5 @@ %define anolis_release .0.1 +%define _legacy_common_support 1 # build against xz? %bcond_without xz # just for giggles, option to build with internal Berkeley DB @@ -697,6 +698,7 @@ make check || cat tests/rpmtests.log %changelog * Wed Apr 13 2022 Liwei Ge - 4.14.3-22.0.1 - Rebrand for Anolis OS +- Fix gcc10 -fno-common compile issue for compatible with gcc10 build * Tue Feb 15 2022 Michal Domonkos - 4.14.3-22 - Fix spurious %transfiletriggerpostun execution (#2023693) -- Gitee From 521142b6511f7c46fa3cab713a32a59a61e62d3e Mon Sep 17 00:00:00 2001 From: gongwen Date: Fri, 27 Aug 2021 18:02:13 +0800 Subject: [PATCH 3/4] support loongarch --- 1000-rpm-anolis-support-loongarch.patch | 117 ++++++++++++++++++++++++ rpm.spec | 3 + 2 files changed, 120 insertions(+) create mode 100644 1000-rpm-anolis-support-loongarch.patch diff --git a/1000-rpm-anolis-support-loongarch.patch b/1000-rpm-anolis-support-loongarch.patch new file mode 100644 index 0000000..ab2a3a9 --- /dev/null +++ b/1000-rpm-anolis-support-loongarch.patch @@ -0,0 +1,117 @@ +From 0ff0feb65aa56ae673e0ec0554996a7ce2ff6a38 Mon Sep 17 00:00:00 2001 +From: chenguoqi +Date: Tue, 3 Aug 2021 07:35:19 +0000 +Subject: [PATCH] support loongarch for rpm + +--- + installplatform | 12 ++++++++++++ + lib/rpmrc.c | 6 ++++++ + rpmrc.in | 17 +++++++++++++++++ + 3 files changed, 35 insertions(+) + +diff --git a/installplatform b/installplatform +index 12339fc..74c50a2 100755 +--- a/installplatform ++++ b/installplatform +@@ -168,6 +168,18 @@ for ARCH in noarch `grep ^arch_canon $RPMRC | cut -d: -f2`; do + CANONARCH=mips64r6el + CANONCOLOR=3 + ;; ++ loongarch32) ++ ISANAME=loongarch ++ ISABITS=32 ++ CANONARCH=loongarch32 ++ CANONCOLOR=0 ++ ;; ++ loongarch64) ++ ISANAME=loongarch ++ ISABITS=64 ++ CANONARCH=loongarch64 ++ CANONCOLOR=3 ++ ;; + m68k) + ISANAME=m68k + ISABITS=32 +diff --git a/lib/rpmrc.c b/lib/rpmrc.c +index cada3f7..c4b13cc 100644 +--- a/lib/rpmrc.c ++++ b/lib/rpmrc.c +@@ -1241,6 +1241,12 @@ static void defaultMachine(rpmrcCtx ctx, const char ** arch, const char ** os) + } + # endif /* riscv */ + ++# if defined(__linux__) && defined(__loongarch64) ++ strcpy(un.machine, "loongarch64"); ++# else ++ strcpy(un.machine, "loongarch32"); ++# endif /* __loongarch64 */ ++ + # if defined(__GNUC__) && defined(__alpha__) + { + unsigned long amask, implver; +diff --git a/rpmrc.in b/rpmrc.in +index 3a5b1e6..425bb97 100644 +--- a/rpmrc.in ++++ b/rpmrc.in +@@ -67,6 +67,8 @@ optflags: mipsr6el -O2 -g + optflags: mips64r6 -O2 -g + optflags: mips64r6el -O2 -g + ++optflags: loongarch64 -O2 -g ++ + optflags: armv3l -O2 -g -march=armv3 + optflags: armv4b -O2 -g -march=armv4 + optflags: armv4l -O2 -g -march=armv4 +@@ -134,6 +136,9 @@ archcolor: mipsr6el 1 + archcolor: mips64r6 2 + archcolor: mips64r6el 2 + ++archcolor: loongarch32 1 ++archcolor: loongarch64 2 ++ + archcolor: m68k 1 + + archcolor: m68kmint 1 +@@ -252,6 +257,9 @@ arch_canon: mips64r6el: mips64r6el 21 + arch_canon: riscv: riscv64 22 + arch_canon: riscv64: riscv64 22 + ++arch_canon: loongarch32: loongarch32 25 ++arch_canon: loongarch64: loongarch64 26 ++ + ############################################################# + # Canonical OS names and numbers + +@@ -353,6 +361,9 @@ buildarchtranslate: mipsr6el: mipsr6el + buildarchtranslate: mips64r6: mips64r6 + buildarchtranslate: mips64r6el: mips64r6el + ++buildarchtranslate: loongarch32: loongarch32 ++buildarchtranslate: loongarch64: loongarch64 ++ + buildarchtranslate: m68k: m68k + + buildarchtranslate: atarist: m68kmint +@@ -442,6 +453,9 @@ arch_compat: mipsr6el: noarch + arch_compat: mips64r6: mipsr6 + arch_compat: mips64r6el: mipsr6el + ++arch_compat: loongarch32: noarch ++arch_compat: loongarch64: loongarch32 ++ + arch_compat: hppa2.0: hppa1.2 + arch_compat: hppa1.2: hppa1.1 + arch_compat: hppa1.1: hppa1.0 +@@ -577,6 +591,9 @@ buildarch_compat: mipsr6el: noarch + buildarch_compat: mips64r6: noarch + buildarch_compat: mips64r6el: noarch + ++buildarch_compat: loongarch32: noarch ++buildarch_compat: loongarch64: noarch ++ + buildarch_compat: armv4b: noarch + buildarch_compat: armv7l: armv6l + buildarch_compat: armv6l: armv5tejl +-- +2.27.0 + diff --git a/rpm.spec b/rpm.spec index 28924aa..f2b29b8 100644 --- a/rpm.spec +++ b/rpm.spec @@ -148,6 +148,8 @@ Patch1001: compile-with-Platform-Python-binary-where-relevant.patch # make unversioned %%__python an error unless explicitly overridden Patch1002: rpm-4.14.2-unversioned-python.patch +Patch2000: 1000-rpm-anolis-support-loongarch.patch + # Partially GPL/LGPL dual-licensed and some bits with BSD # SourceLicense: (GPLv2+ and LGPLv2+ with exceptions) and BSD License: GPLv2+ @@ -699,6 +701,7 @@ make check || cat tests/rpmtests.log * Wed Apr 13 2022 Liwei Ge - 4.14.3-22.0.1 - Rebrand for Anolis OS - Fix gcc10 -fno-common compile issue for compatible with gcc10 build +- Support loongarch for rpm * Tue Feb 15 2022 Michal Domonkos - 4.14.3-22 - Fix spurious %transfiletriggerpostun execution (#2023693) -- Gitee From bf579e6dcc93e03d0eea681add57670fdad305db Mon Sep 17 00:00:00 2001 From: Liwei Ge Date: Wed, 9 Feb 2022 14:02:11 +0800 Subject: [PATCH 4/4] platform: fix loongarch support https://bugzilla.openanolis.cn/show_bug.cgi?id=441 loongarch support code will reset un.machine of any other platform to loongarch32, this will make rpm report wrong arch error Signed-off-by: Liwei Ge --- 1000-rpm-anolis-support-loongarch.patch | 2 +- rpm.spec | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/1000-rpm-anolis-support-loongarch.patch b/1000-rpm-anolis-support-loongarch.patch index ab2a3a9..350516e 100644 --- a/1000-rpm-anolis-support-loongarch.patch +++ b/1000-rpm-anolis-support-loongarch.patch @@ -42,7 +42,7 @@ index cada3f7..c4b13cc 100644 +# if defined(__linux__) && defined(__loongarch64) + strcpy(un.machine, "loongarch64"); -+# else ++# elif defined(__linux__) && defined(__loongarch32) + strcpy(un.machine, "loongarch32"); +# endif /* __loongarch64 */ + diff --git a/rpm.spec b/rpm.spec index f2b29b8..b420a5f 100644 --- a/rpm.spec +++ b/rpm.spec @@ -702,6 +702,7 @@ make check || cat tests/rpmtests.log - Rebrand for Anolis OS - Fix gcc10 -fno-common compile issue for compatible with gcc10 build - Support loongarch for rpm +- Fix loongarch support * Tue Feb 15 2022 Michal Domonkos - 4.14.3-22 - Fix spurious %transfiletriggerpostun execution (#2023693) -- Gitee