From 4dde00a32aa19edd888beb9dd74c5c11b4ec27f1 Mon Sep 17 00:00:00 2001 From: anolis-bot Date: Tue, 16 May 2023 18:25:35 +0800 Subject: [PATCH 1/4] update to rpm-4.14.3-26.el8 Signed-off-by: anolis-bot --- 1000-rpm-anolis-support-loongarch.patch | 117 --------------- dist | 2 +- ...4.14.3-rpm2archive-Don-t-print-usage.patch | 29 ++++ rpm-4.14.3-rpm2archive-nocompression.patch | 138 ++++++++++++++++++ ....14.3-rpm2archive-parse-popt-options.patch | 36 +++++ rpm-4.16.1.3-rpm2archive-error-handling.patch | 51 +++++++ rpm.spec | 22 ++- 7 files changed, 265 insertions(+), 130 deletions(-) delete mode 100644 1000-rpm-anolis-support-loongarch.patch create mode 100644 rpm-4.14.3-rpm2archive-Don-t-print-usage.patch create mode 100644 rpm-4.14.3-rpm2archive-nocompression.patch create mode 100644 rpm-4.14.3-rpm2archive-parse-popt-options.patch create mode 100644 rpm-4.16.1.3-rpm2archive-error-handling.patch diff --git a/1000-rpm-anolis-support-loongarch.patch b/1000-rpm-anolis-support-loongarch.patch deleted file mode 100644 index 350516e..0000000 --- a/1000-rpm-anolis-support-loongarch.patch +++ /dev/null @@ -1,117 +0,0 @@ -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"); -+# elif defined(__linux__) && defined(__loongarch32) -+ 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/dist b/dist index 0ee7539..9c0e36e 100644 --- a/dist +++ b/dist @@ -1 +1 @@ -an8_6 +an8 diff --git a/rpm-4.14.3-rpm2archive-Don-t-print-usage.patch b/rpm-4.14.3-rpm2archive-Don-t-print-usage.patch new file mode 100644 index 0000000..ff9d1a3 --- /dev/null +++ b/rpm-4.14.3-rpm2archive-Don-t-print-usage.patch @@ -0,0 +1,29 @@ +From fe274b8f965582fdf97e6c46f90b9e7c124b0b8b Mon Sep 17 00:00:00 2001 +From: Florian Festi +Date: Fri, 16 Dec 2022 15:50:12 +0100 +Subject: [PATCH] rpm2archive: Don't print usage on no arguments + +given as we want to default to reading from stdin and writing to stdout in +that case. +--- + rpm2archive.c | 4 ---- + 1 file changed, 4 deletions(-) + +diff --git a/rpm2archive.c b/rpm2archive.c +index 09da8d16b..53f047f58 100644 +--- a/rpm2archive.c ++++ b/rpm2archive.c +@@ -241,10 +241,6 @@ int main(int argc, const char *argv[]) + exit(EXIT_FAILURE); + } + } +- if (argc < 2 || poptGetNextOpt(optCon) == 0) { +- poptPrintUsage(optCon, stderr, 0); +- exit(EXIT_FAILURE); +- } + + rpmts ts = rpmtsCreate(); + rpmVSFlags vsflags = 0; +-- +2.38.1 + diff --git a/rpm-4.14.3-rpm2archive-nocompression.patch b/rpm-4.14.3-rpm2archive-nocompression.patch new file mode 100644 index 0000000..92c84ae --- /dev/null +++ b/rpm-4.14.3-rpm2archive-nocompression.patch @@ -0,0 +1,138 @@ +From d8a169164cf40fc1cf6448792c1fa991f19bb375 Mon Sep 17 00:00:00 2001 +From: Florian Festi +Date: Thu, 22 Apr 2021 14:50:34 +0200 +Subject: [PATCH] Add --nocompression option to rpm2archive + +Also use popt for the command line handling. As we are using librpm +anyway there is no reason to keep the dependencies low (as with +rpm2cpio). + +Resolves: #1530 +--- + doc/rpm2archive.8 | 16 ++++++++++--- + rpm2archive.c | 60 ++++++++++++++++++++++++++++++++++------------- + 2 files changed, 57 insertions(+), 19 deletions(-) + +diff --git a/rpm2archive.c b/rpm2archive.c +index d96db006ea..cb39c7a712 100644 +--- a/rpm2archive.c ++++ b/rpm2archive.c +@@ -10,6 +10,8 @@ + + #include + ++#include ++ + #include + #include + #include +@@ -18,6 +20,16 @@ + + #define BUFSIZE (128*1024) + ++int compress = 1; ++ ++static struct poptOption optionsTable[] = { ++ { "nocompression", 'n', POPT_ARG_VAL, &compress, 0, ++ N_("create uncompressed tar file"), ++ NULL }, ++ POPT_AUTOHELP ++ POPT_TABLEEND ++}; ++ + static void fill_archive_entry(struct archive * a, struct archive_entry * entry, rpmfi fi) + { + archive_entry_clear(entry); +@@ -60,7 +72,7 @@ static void write_file_content(struct archive * a, char * buf, rpmfi fi) + } + } + +-static int process_package(rpmts ts, char * filename) ++static int process_package(rpmts ts, const char * filename) + { + FD_t fdi; + FD_t gzdi; +@@ -119,9 +131,11 @@ static int process_package(rpmts ts, char * filename) + + /* create archive */ + a = archive_write_new(); +- if (archive_write_add_filter_gzip(a) != ARCHIVE_OK) { +- fprintf(stderr, "Error: Could not create gzip output filter\n"); +- exit(EXIT_FAILURE); ++ if (compress) { ++ if (archive_write_add_filter_gzip(a) != ARCHIVE_OK) { ++ fprintf(stderr, "%s\n", archive_error_string(a)); ++ exit(EXIT_FAILURE); ++ } + } + if (archive_write_set_format_pax_restricted(a) != ARCHIVE_OK) { + fprintf(stderr, "Error: Format pax restricted is not supported\n"); +@@ -142,7 +156,12 @@ static int process_package(rpmts ts, char * filename) + } + archive_write_open_fd(a, STDOUT_FILENO); + } else { +- char * outname = rstrscat(NULL, filename, ".tgz", NULL); ++ char * outname = rstrscat(NULL, filename, NULL); ++ if (compress) { ++ outname = rstrscat(&outname, ".tgz", NULL); ++ } else { ++ outname = rstrscat(&outname, ".tar", NULL); ++ } + if (archive_write_open_filename(a, outname) != ARCHIVE_OK) { + fprintf(stderr, "Error: Can't open output file: %s\n", outname); + exit(EXIT_FAILURE); +@@ -203,21 +222,22 @@ static int process_package(rpmts ts, char * filename) + return rc; + } + +-int main(int argc, char *argv[]) ++int main(int argc, const char *argv[]) + { +- int rc = 0, i; ++ int rc = 0; ++ poptContext optCon; ++ const char *fn; + + xsetprogname(argv[0]); /* Portability call -- see system.h */ + rpmReadConfigFiles(NULL, NULL); + +- if (argc > 1 && (rstreq(argv[1], "-h") || rstreq(argv[1], "--help"))) { +- fprintf(stderr, "Usage: %s [file.rpm ...]\n", argv[0]); ++ optCon = poptGetContext(NULL, argc, argv, optionsTable, 0); ++ poptSetOtherOptionHelp(optCon, "[OPTIONS]* "); ++ if (argc < 2 || poptGetNextOpt(optCon) == 0) { ++ poptPrintUsage(optCon, stderr, 0); + exit(EXIT_FAILURE); + } + +- if (argc == 1) +- argv[argc++] = "-"; /* abuse NULL pointer at the end of argv */ +- + rpmts ts = rpmtsCreate(); + rpmVSFlags vsflags = 0; + +@@ -227,13 +247,21 @@ int main(int argc, char *argv[]) + vsflags |= RPMVSF_NOHDRCHK; + (void) rpmtsSetVSFlags(ts, vsflags); + +- for (i = 1; i < argc; i++) { ++ /* if no file name is given use stdin/stdout */ ++ if (!poptPeekArg(optCon)) { ++ rc = process_package(ts, "-"); ++ if (rc != 0) ++ goto exit; ++ } + +- rc = process_package(ts, argv[i]); ++ while ((fn = poptGetArg(optCon)) != NULL) { ++ rc = process_package(ts, fn); + if (rc != 0) +- return rc; ++ goto exit; + } + ++ exit: ++ poptFreeContext(optCon); + (void) rpmtsFree(ts); + return rc; + } diff --git a/rpm-4.14.3-rpm2archive-parse-popt-options.patch b/rpm-4.14.3-rpm2archive-parse-popt-options.patch new file mode 100644 index 0000000..0170c35 --- /dev/null +++ b/rpm-4.14.3-rpm2archive-parse-popt-options.patch @@ -0,0 +1,36 @@ +From 8f416b275a365426b07c75adfc017e0b18a85450 Mon Sep 17 00:00:00 2001 +From: Florian Festi +Date: Fri, 16 Dec 2022 15:45:20 +0100 +Subject: [PATCH] rpm2archive: Properly parse popt options + +and issue an error message for unknown options. Before unknown options +could mess up the argument parsing leading to reading and writing from +stdin/stdout. + +Thanks to Eva Mrakova and the Red Hat QE team for spotting this! +--- + rpm2archive.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/rpm2archive.c b/rpm2archive.c +index de1a17d2b..09da8d16b 100644 +--- a/rpm2archive.c ++++ b/rpm2archive.c +@@ -233,6 +233,14 @@ int main(int argc, const char *argv[]) + + optCon = poptGetContext(NULL, argc, argv, optionsTable, 0); + poptSetOtherOptionHelp(optCon, "[OPTIONS]* "); ++ while ((rc = poptGetNextOpt(optCon)) != -1) { ++ if (rc < 0) { ++ fprintf(stderr, "%s: %s\n", ++ poptBadOption(optCon, POPT_BADOPTION_NOALIAS), ++ poptStrerror(rc)); ++ exit(EXIT_FAILURE); ++ } ++ } + if (argc < 2 || poptGetNextOpt(optCon) == 0) { + poptPrintUsage(optCon, stderr, 0); + exit(EXIT_FAILURE); +-- +2.38.1 + diff --git a/rpm-4.16.1.3-rpm2archive-error-handling.patch b/rpm-4.16.1.3-rpm2archive-error-handling.patch new file mode 100644 index 0000000..4a8a6f5 --- /dev/null +++ b/rpm-4.16.1.3-rpm2archive-error-handling.patch @@ -0,0 +1,51 @@ +From f1634250587479d664b34b6de1a6546b2c2b9de5 Mon Sep 17 00:00:00 2001 +From: Florian Festi +Date: Mon, 18 Jan 2021 15:02:34 +0100 +Subject: [PATCH] rpm2archive: Add more error handling + +Cleanly error out if file can't be written instead of segfaulting + +Resolves: #1091 +--- + rpm2archive.c | 17 ++++++++++++----- + 1 file changed, 12 insertions(+), 5 deletions(-) + +diff --git a/rpm2archive.c b/rpm2archive.c +index 646f1663d..15c5da016 100644 +--- a/rpm2archive.c ++++ b/rpm2archive.c +@@ -119,9 +119,14 @@ static int process_package(rpmts ts, char * filename) + + /* create archive */ + a = archive_write_new(); +- archive_write_add_filter_gzip(a); +- archive_write_set_format_pax_restricted(a); +- ++ if (archive_write_add_filter_gzip(a) != ARCHIVE_OK) { ++ fprintf(stderr, "Error: Could not create gzip output filter\n"); ++ exit(EXIT_FAILURE); ++ } ++ if (archive_write_set_format_pax_restricted(a) != ARCHIVE_OK) { ++ fprintf(stderr, "Error: Format pax restricted is not supported\n"); ++ exit(EXIT_FAILURE); ++ } + if (!strcmp(filename, "-")) { + if (isatty(STDOUT_FILENO)) { + fprintf(stderr, "Error: refusing to output archive data to a terminal.\n"); +@@ -130,9 +135,11 @@ static int process_package(rpmts ts, char * filename) + archive_write_open_fd(a, STDOUT_FILENO); + } else { + char * outname = rstrscat(NULL, filename, ".tgz", NULL); +- archive_write_open_filename(a, outname); ++ if (archive_write_open_filename(a, outname) != ARCHIVE_OK) { ++ fprintf(stderr, "Error: Can't open output file: %s\n", outname); ++ exit(EXIT_FAILURE); ++ } + _free(outname); +- // XXX error handling + } + + entry = archive_entry_new(); +-- +2.38.1 + diff --git a/rpm.spec b/rpm.spec index 34fcaea..f235765 100644 --- a/rpm.spec +++ b/rpm.spec @@ -1,5 +1,3 @@ -%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 @@ -23,7 +21,7 @@ # build with readonly sqlite support? %bcond_without sqlite -%if 0%{?rhel} > 7 || 0%{?anolis} +%if 0%{?rhel} > 7 # Disable python2 build by default %bcond_with python2 %else @@ -34,7 +32,7 @@ %global rpmver 4.14.3 #global snapver rc2 -%global rel 24 +%global rel 26 %global srcver %{version}%{?snapver:-%{snapver}} %global srcdir %{?snapver:testing}%{!?snapver:%{name}-%(echo %{version} | cut -d'.' -f1-2).x} @@ -46,7 +44,7 @@ Summary: The RPM package management system Name: rpm Version: %{rpmver} -Release: %{?snapver:0.%{snapver}.}%{rel}%{anolis_release}%{?dist} +Release: %{?snapver:0.%{snapver}.}%{rel}%{?dist} Group: System Environment/Base Url: http://www.rpm.org/ Source0: http://ftp.rpm.org/releases/%{srcdir}/%{name}-%{srcver}.tar.bz2 @@ -117,6 +115,10 @@ Patch161: rpm-4.14.3-validate-and-require-subkey-binding-sigs.patch Patch162: rpm-4.14.3-fix-spurious-transfiletriggerpostun-execution.patch Patch163: rpm-4.14.3-skip-recorded-symlinks-in-setperms.patch Patch164: rpm-4.14.3-fapolicyd-make-write-nonblocking.patch +Patch165: rpm-4.16.1.3-rpm2archive-error-handling.patch +Patch166: rpm-4.14.3-rpm2archive-nocompression.patch +Patch167: rpm-4.14.3-rpm2archive-parse-popt-options.patch +Patch168: rpm-4.14.3-rpm2archive-Don-t-print-usage.patch # Python 3 string API sanity Patch500: 0001-In-Python-3-return-all-our-string-data-as-surrogate-.patch @@ -149,8 +151,6 @@ 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+ @@ -224,7 +224,7 @@ BuildRequires: libubsan %endif %if %{with libimaevm} -%if 0%{?fedora} >= 28 || 0%{?rhel} > 7 || 0%{?anolis} +%if 0%{?fedora} >= 28 || 0%{?rhel} > 7 %global imadevname ima-evm-utils-devel %else %global imadevname ima-evm-utils @@ -699,10 +699,8 @@ make check || cat tests/rpmtests.log %doc doc/librpm/html/* %changelog -* Fri Oct 28 2022 Liwei Ge - 4.14.3-24.0.1 -- Rebrand for Anolis OS -- Fix gcc10 -fno-common compile issue for compatible with gcc10 build -- Support loongarch for rpm +* Mon Dec 19 2022 Florian Festi - 4.14.4-26 +- Add --nocompression to rpm2archive (#2129345) * Tue Sep 13 2022 Michal Domonkos - 4.14.3-24 - Make write() nonblocking in fapolicyd plugin (#2110787) -- Gitee From f2a1bd28ab0d73d091cda612bd74cc7c39a0dc34 Mon Sep 17 00:00:00 2001 From: songmingliang Date: Wed, 18 May 2022 14:31:33 +0800 Subject: [PATCH 2/4] Rebrand for Anolis OS --- rpm.spec | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/rpm.spec b/rpm.spec index f235765..77ee5c8 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 @@ -224,7 +225,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 @@ -699,6 +700,9 @@ make check || cat tests/rpmtests.log %doc doc/librpm/html/* %changelog +* Wed Jun 14 2023 Liwei Ge - 4.14.4-26.0.1 +- Rebrand for Anolis OS + * Mon Dec 19 2022 Florian Festi - 4.14.4-26 - Add --nocompression to rpm2archive (#2129345) -- Gitee From 79879b7c9b041ac455ae40de28e2fea03039f498 Mon Sep 17 00:00:00 2001 From: songmingliang Date: Wed, 18 May 2022 14:39:39 +0800 Subject: [PATCH 3/4] Fix gcc10 -fno-common compile issue until upstream fixes --- rpm.spec | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rpm.spec b/rpm.spec index 77ee5c8..326c1eb 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 @@ -702,6 +703,7 @@ make check || cat tests/rpmtests.log %changelog * Wed Jun 14 2023 Liwei Ge - 4.14.4-26.0.1 - Rebrand for Anolis OS +- Fix gcc10 -fno-common compile issue for compatible with gcc10 build * Mon Dec 19 2022 Florian Festi - 4.14.4-26 - Add --nocompression to rpm2archive (#2129345) -- Gitee From 28bab1c1fa4254fc79e0696868fdbde6f1c5b1c4 Mon Sep 17 00:00:00 2001 From: songmingliang Date: Wed, 18 May 2022 14:44:37 +0800 Subject: [PATCH 4/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..350516e --- /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"); ++# elif defined(__linux__) && defined(__loongarch32) ++ 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 326c1eb..92f7a1a 100644 --- a/rpm.spec +++ b/rpm.spec @@ -153,6 +153,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+ @@ -704,6 +706,7 @@ make check || cat tests/rpmtests.log * Wed Jun 14 2023 Liwei Ge - 4.14.4-26.0.1 - Rebrand for Anolis OS - Fix gcc10 -fno-common compile issue for compatible with gcc10 build +- Support loongarch for rpm * Mon Dec 19 2022 Florian Festi - 4.14.4-26 - Add --nocompression to rpm2archive (#2129345) -- Gitee