commit 01c2f80b9d62c530f0d7ded1b1c62f779362b633 Author: overweight <5324761+overweight@user.noreply.gitee.com> Date: Mon Sep 30 11:16:24 2019 -0400 Package init diff --git a/0001-Fix-ancient-python-GIL-locking-bug-on-callback-RhBug.patch b/0001-Fix-ancient-python-GIL-locking-bug-on-callback-RhBug.patch new file mode 100644 index 0000000..bd6ae5e --- /dev/null +++ b/0001-Fix-ancient-python-GIL-locking-bug-on-callback-RhBug.patch @@ -0,0 +1,39 @@ +From 3570c9beb5398541ea7423639891ef6a9de27087 Mon Sep 17 00:00:00 2001 +From: Panu Matilainen +Date: Wed, 3 Oct 2018 11:51:38 +0300 +Subject: [PATCH 1/4] Fix ancient python GIL locking bug on callback + (RhBug:1632488) + +Introduced in commit c7881d801745b4c156a8aa2afc17b95f97481e34 back in 2002, +synthesizing a python object for the callback occurs before retaking +the GIL lock, which is not allowed. Somehow this has managed to stay +latent all these years, and even now requires fairly specific conditions: +when the callback gets called without an associated key, such as erasures +or file trigger script start/stop events (in the case of RhBug:1632488), +when Python 3 is running in PYTHONMALLOC=debug mode, +it crashes with "Python memory allocator called without holding the GIL". + +Simply retake the lock before any Python operations take place to fix. + +(cherry picked from commit 531dc8495cd3aabd3f659ecab604106fdbacbe98) + +diff -urNp a/python/rpmts-py.c b/python/rpmts-py.c +--- a/python/rpmts-py.c 2019-04-22 21:07:26.880000000 +0800 ++++ b/python/rpmts-py.c 2019-04-22 21:18:05.020000000 +0800 +@@ -494,6 +494,8 @@ rpmtsCallback(const void * hd, const rpm + static FD_t fd; + + if (cbInfo->cb == Py_None) return NULL; ++ ++ PyEval_RestoreThread(cbInfo->_save); + + /* Synthesize a python object for callback (if necessary). */ + if (pkgObj == NULL) { +@@ -506,7 +508,6 @@ rpmtsCallback(const void * hd, const rpm + } else + Py_INCREF(pkgObj); + +- PyEval_RestoreThread(cbInfo->_save); + + args = Py_BuildValue("(iLLOO)", what, amount, total, pkgObj, cbInfo->data); + result = PyEval_CallObject(cbInfo->cb, args); diff --git a/0001-find-debuginfo.sh-decompress-DWARF-compressed-ELF-se.patch b/0001-find-debuginfo.sh-decompress-DWARF-compressed-ELF-se.patch new file mode 100644 index 0000000..ee4b7cf --- /dev/null +++ b/0001-find-debuginfo.sh-decompress-DWARF-compressed-ELF-se.patch @@ -0,0 +1,30 @@ +From f2bc669cd0a080792522dd1bb7f50ef7025f16f0 Mon Sep 17 00:00:00 2001 +From: Mark Wielaard +Date: Sat, 21 Jul 2018 10:13:04 +0200 +Subject: [PATCH] find-debuginfo.sh: decompress DWARF compressed ELF sections + +debugedit and dwz do not support DWARF compressed ELF sections, let's +just decompress those before extracting debuginfo. + +Tested-by: Igor Gnatenko +--- + scripts/find-debuginfo.sh | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/scripts/find-debuginfo.sh b/scripts/find-debuginfo.sh +index 90a44942d..7b01bc036 100755 +--- a/scripts/find-debuginfo.sh ++++ b/scripts/find-debuginfo.sh +@@ -357,6 +357,9 @@ do_file() + get_debugfn "$f" + [ -f "${debugfn}" ] && return + ++ echo "explicitly decompress any DWARF compressed ELF sections in $f" ++ eu-elfcompress -q -p -t none "$f" ++ + echo "extracting debug info from $f" + # See also cpio SOURCEFILE copy. Directories must match up. + debug_base_name="$RPM_BUILD_DIR" +-- +2.18.0 + diff --git a/0002-Resurrect-long-since-broken-Lua-library-path.patch b/0002-Resurrect-long-since-broken-Lua-library-path.patch new file mode 100644 index 0000000..e30d07a --- /dev/null +++ b/0002-Resurrect-long-since-broken-Lua-library-path.patch @@ -0,0 +1,114 @@ +From ddc1d06c45994b40aea3dfefc60436e409fce08c Mon Sep 17 00:00:00 2001 +From: Panu Matilainen +Date: Tue, 16 Oct 2018 11:26:46 +0300 +Subject: [PATCH 2/4] Resurrect long since broken Lua library path + +LUA_PATH global variable is not consulted when loading libraries in +Lua >= 5.1, package.path has replaced it. Rpm's Lua library path +was always supposed to be /usr/lib/rpm/lua/ but this has been broken +for the last ten years or so, oops. Make the directory a first-class +citizen: create it on install, add a macro for it, make it actually +work and ensure it stays that way by adding a test for it. + +(cherry picked from commit dd6c65044c41922193f520ace668e2c5e55f1004) +--- + Makefile.am | 2 ++ + macros.in | 2 ++ + rpmio/rpmlua.c | 13 ++++++------- + tests/rpmmacro.at | 17 ++++++++++++++++- + 4 files changed, 26 insertions(+), 8 deletions(-) + +diff -urNp a/macros.in b/macros.in +--- a/macros.in 2019-04-23 12:06:08.066000000 -0400 ++++ b/macros.in 2019-04-23 12:11:29.225000000 -0400 +@@ -149,6 +149,8 @@ + %_rpmconfigdir %{getconfdir} + # The directory where rpm's macro files live + %_rpmmacrodir %{_rpmconfigdir}/macros.d ++# The directory where rpm's addon lua libraries live ++%_rpmluadir %{_rpmconfigdir}/lua + + # The directory where sources/patches will be unpacked and built. + %_builddir %{_topdir}/BUILD +diff -urNp a/Makefile.am b/Makefile.am +--- a/Makefile.am 2019-04-23 12:05:54.541000000 -0400 ++++ b/Makefile.am 2019-04-23 12:10:32.959000000 -0400 +@@ -253,6 +253,7 @@ install-data-local: + $(RPMCANONVENDOR) $(RPMCANONOS) $(RPMCANONGNU) + @$(MKDIR_P) $(DESTDIR)$(localstatedir)/tmp + @$(MKDIR_P) $(DESTDIR)$(rpmconfigdir)/macros.d ++ @$(MKDIR_P) $(DESTDIR)$(rpmconfigdir)/lua + + # XXX to appease distcheck we need to remove "stuff" here... + uninstall-local: +@@ -261,6 +262,7 @@ uninstall-local: + @rm -rf $(DESTDIR)$(rpmconfigdir)/platform/ + @rm -f $(DESTDIR)$(rpmconfigdir)/macros + @rm -rf $(DESTDIR)$(rpmconfigdir)/macros.d ++ @rm -rf $(DESTDIR)$(rpmconfigdir)/lua + + MAINTAINERCLEANFILES = ChangeLog + +diff -urNp a/rpmio/rpmlua.c b/rpmio/rpmlua.c +--- a/rpmio/rpmlua.c 2019-04-23 12:06:27.928000000 -0400 ++++ b/rpmio/rpmlua.c 2019-04-23 12:18:35.940000000 -0400 +@@ -100,13 +100,6 @@ rpmlua rpmluaNew() + #ifndef LUA_GLOBALSINDEX + lua_pushglobaltable(L); + #endif +- lua_pushliteral(L, "LUA_PATH"); +- lua_pushfstring(L, "%s/%s", rpmConfigDir(), "/lua/?.lua"); +-#ifdef LUA_GLOBALSINDEX +- lua_rawset(L, LUA_GLOBALSINDEX); +-#else +- lua_settable(L, -3); +-#endif + lua_pushliteral(L, "print"); + lua_pushcfunction(L, rpm_print); + #ifdef LUA_GLOBALSINDEX +@@ -117,6 +110,12 @@ rpmlua rpmluaNew() + #ifndef LUA_GLOBALSINDEX + lua_pop(L, 1); + #endif ++ ++ lua_getglobal(L, "package"); ++ lua_pushfstring(L, "%s/%s", rpmConfigDir(), "/lua/?.lua"); ++ lua_setfield(L, -2, "path"); ++ lua_pop(L, 1); ++ + rpmluaSetData(lua, "lua", lua); + if (stat(initlua, &st) != -1) + (void)rpmluaRunScriptFile(lua, initlua); +diff -urNp a/tests/rpmmacro.at b/tests/rpmmacro.at +--- a/tests/rpmmacro.at 2019-04-23 12:06:50.426000000 -0400 ++++ b/tests/rpmmacro.at 2019-04-23 12:39:31.867000000 -0400 +@@ -297,6 +297,22 @@ runroot rpm \ + ) + AT_CLEANUP + ++AT_SETUP([lua library path]) ++AT_KEYWORDS([macros lua]) ++AT_CHECK([ ++AT_SKIP_IF([$LUA_DISABLED]) ++f=$(rpm --eval "%{_rpmconfigdir}/lua/foo.lua") ++echo "bar = 'graak'" > ${f} ++runroot rpm \ ++ --eval '%{lua:require "foo"; print(bar)}' ++rm -f ${f} ++], ++[0], ++[graak ++]) ++AT_CLEANUP ++ ++ + AT_SETUP([%define + %undefine in nested levels 1]) + AT_KEYWORDS([macros define undefine]) + AT_CHECK([ +@@ -432,4 +448,4 @@ runroot rpm --macros "/data/macros.testf + + macro_2 + ]) +-AT_CLEANUP +\ No newline at end of file ++AT_CLEANUP diff --git a/0003-Fix-nasty-setperms-setugids-regression-in-4.14.2-RhB.patch b/0003-Fix-nasty-setperms-setugids-regression-in-4.14.2-RhB.patch new file mode 100644 index 0000000..74e9d28 --- /dev/null +++ b/0003-Fix-nasty-setperms-setugids-regression-in-4.14.2-RhB.patch @@ -0,0 +1,49 @@ +From a7f3748d006d1b1057a791f2a7c790d3ec09cc09 Mon Sep 17 00:00:00 2001 +From: Panu Matilainen +Date: Mon, 22 Oct 2018 10:52:39 +0300 +Subject: [PATCH 3/4] Fix nasty --setperms/--setugids regression in 4.14.2 + (RhBug: 1640470) + +Commit 38c2f6e160d5ed3e9c3a266139c7eb2632724c15 causes --setperms and +--setugids follow symlinks instead of skipping them. + +In case of --setperms, all encountered symlinks will have their +target file/directory permissions set to the 0777 of the link itself +(so world writable etc but suid/sgid stripped), temporarily or permanently, +depending on whether the symlink occurs before or after it's target in the +package file list. When the link occurs before its target, there's a short +window where the target is world writable before having it's permissions +reset to original, making it particularly bad for suid/sgid binaries. + +--setugids is similarly affected with link targets owner/group changing +to that of the symlink. + +Add missing parentheses to the conditions introduced in commit +38c2f6e160d5ed3e9c3a266139c7eb2632724c15 to fix. +Reported by Karel Srot, patch by Pavlina Moravcova Varekova. + +(cherry picked from commit 0d83637769b8a122b1e80f2e960ea1bbae8b4f10) +--- + rpmpopt.in | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff -urNp a/rpmpopt.in b/rpmpopt.in +--- a/rpmpopt.in 2019-04-23 13:00:05.090000000 -0400 ++++ b/rpmpopt.in 2019-04-23 13:05:33.326000000 -0400 +@@ -44,14 +44,14 @@ rpm alias --scripts --qf '\ + --POPTdesc=$"list install/erase scriptlets from package(s)" + + rpm alias --setperms -q --qf '[\[ -L %{FILENAMES:shescape} \] || \ +- \[ $((%{FILEFLAGS} & 2#1001000)) != 0 \] && \[ ! -e %{FILENAMES:shescape} \] || \ ++ ( \[ $((%{FILEFLAGS} & 2#1001000)) != 0 \] && \[ ! -e %{FILENAMES:shescape} \] ) || \ + chmod %7{FILEMODES:octal} %{FILENAMES:shescape}\n]' \ + --pipe "grep -v \(none\) | grep '^. -L ' | sed 's/chmod .../chmod /' | sh" \ + --POPTdesc=$"set permissions of files in a package" + + rpm alias --setugids -q --qf \ + '[ch %{FILEUSERNAME:shescape} %{FILEGROUPNAME:shescape} %{FILENAMES:shescape} %{FILEFLAGS}\n]' \ +- --pipe "(echo 'ch() { \[ $(($4 & 2#1001000)) != 0 \] && \[ ! -e \"$3\" \] || \ ++ --pipe "(echo 'ch() { ( \[ $(($4 & 2#1001000)) != 0 \] && \[ ! -e \"$3\" \] ) || \ + (chown -h -- \"$1\" \"$3\";chgrp -h -- \"$2\" \"$3\";) }'; \ + grep '^ch '|grep -v \(none\))|sh" \ + --POPTdesc=$"set user/group ownership of files in a package" diff --git a/bugfix-rpm-4.11.3-add-aarch64_ilp32-arch.patch b/bugfix-rpm-4.11.3-add-aarch64_ilp32-arch.patch new file mode 100644 index 0000000..c598126 --- /dev/null +++ b/bugfix-rpm-4.11.3-add-aarch64_ilp32-arch.patch @@ -0,0 +1,80 @@ +diff -Nur rpm-4.14.2.old/installplatform rpm-4.14.2/installplatform +--- rpm-4.14.2.old/installplatform 2017-08-10 16:08:07.113108701 +0800 ++++ rpm-4.14.2/installplatform 2019-01-30 17:28:25.511000000 +0800 +@@ -180,6 +180,13 @@ + CANONARCH=riscv64 + CANONCOLOR=3 + ;; ++ aarch64_ilp32) ++ ISANAME=aarch ++ ISABITS=32 ++ CANONARCH=aarch64 ++ CANONCOLOR=0 ++ LIB=libilp32 ++ ;; + noarch) + CANONARCH=noarch + CANONCOLOR=0 +diff -Nur rpm-4.14.2.old/rpmrc.in rpm-4.14.2/rpmrc.in +--- rpm-4.14.2.old/rpmrc.in 2019-01-29 18:43:15.795000000 +0800 ++++ rpm-4.14.2/rpmrc.in 2019-01-30 20:30:17.916000000 +0800 +@@ -99,7 +99,7 @@ + optflags: sh4a -O2 -g -mieee + + optflags: aarch64 -O2 -g +- ++optflags: aarch64_ilp32 -O2 -g -mabi=ilp32 + optflags: riscv64 -O2 -g + + ############################################################# +@@ -149,7 +149,7 @@ + archcolor: sh4 1 + + archcolor: aarch64 2 +- ++archcolor: aarch64_ilp32 1 + archcolor: riscv64 2 + + ############################################################# +@@ -243,7 +243,7 @@ + arch_canon: sh4a: sh4a 17 + arch_canon: xtensa: xtensa 18 + arch_canon: aarch64: aarch64 19 +- ++arch_canon: aarch64_ilp32: aarch64 19 + arch_canon: mipsr6: mipsr6 20 + arch_canon: mipsr6el: mipsr6el 20 + arch_canon: mips64r6: mips64r6 21 +@@ -377,11 +377,11 @@ + buildarchtranslate: sh4a: sh4 + + buildarchtranslate: aarch64: aarch64 +- ++buildarchtranslate: aarch64_ilp32: aarch64_ilp32 + buildarchtranslate: riscv: riscv64 + buildarchtranslate: riscv64: riscv64 + +-############################################################# ++#########################################/#################### + # Architecture compatibility + + arch_compat: alphaev67: alphaev6 +@@ -485,7 +485,8 @@ + arch_compat: sh4: noarch + arch_compat: sh4a: sh4 + +-arch_compat: aarch64: noarch ++arch_compat: aarch64_ilp32: aarch64 noarch ++arch_compat: aarch64: aarch64_ilp32 noarch + + arch_compat: riscv: noarch + arch_compat: riscv64: noarch +@@ -522,7 +523,7 @@ + buildarch_compat: ia64: noarch + + buildarch_compat: aarch64: noarch +- ++buildarch_compat: aarch64_ilp32: noarch + buildarch_compat: riscv: noarch + buildarch_compat: riscv64: noarch + diff --git a/bugfix-rpm-4.14.2-fix-tty-failed.patch b/bugfix-rpm-4.14.2-fix-tty-failed.patch new file mode 100644 index 0000000..c2934be --- /dev/null +++ b/bugfix-rpm-4.14.2-fix-tty-failed.patch @@ -0,0 +1,26 @@ +From ee69dbae3660da4b1d0649eeeed1a8321d17a685 Mon Sep 17 00:00:00 2001 +From: wangqing +Date: Wed, 12 Dec 2018 19:00:41 +0800 +Subject: [PATCH 2/2] backport-bugfix-rpm-4.14.2-fix-tty-failed + +--- + rpmpopt.in | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/rpmpopt.in b/rpmpopt.in +index 3e44937..d9d7848 100644 +--- a/rpmpopt.in ++++ b/rpmpopt.in +@@ -216,7 +216,7 @@ rpmbuild alias --buildpolicy --define '__os_install_post %{_rpmconfigdir}/brp-!# + --POPTargs=$"" + # Minimally preserve rpmbuild's --sign functionality + rpmbuild alias --sign \ +- --pipe 'rpm --addsign `grep ".*: .*\.rpm$"|cut -d: -f2` < "/dev/"`ps -p $$ -o tty | tail -n 1`' \ ++ --pipe "grep '.*: .*\.rpm$'|cut -d: -f2|xargs -r rpm --addsign" \ + --POPTdesc=$"generate GPG signature (deprecated, use command rpmsign instead)" + # [--trace] "trace macro expansion" + rpmbuild alias --trace --eval '%trace' +-- +1.8.3.1 + + diff --git a/bugfix-rpm-4.14.2-wait-once-get-rpmlock-fail.patch b/bugfix-rpm-4.14.2-wait-once-get-rpmlock-fail.patch new file mode 100644 index 0000000..2379331 --- /dev/null +++ b/bugfix-rpm-4.14.2-wait-once-get-rpmlock-fail.patch @@ -0,0 +1,35 @@ +From c6699a7e90acfaa421830ce0fc12940335e40d7b Mon Sep 17 00:00:00 2001 +From: shanshishi +Date: Sun, 19 May 2019 16:49:45 +0800 +Subject: [PATCH] rpm: wait once get rpmlock fail + +reason: When executing the rpm command concurrently, it will block some +times, because of lock is applied before. + +Signed-off-by: shanshishi +--- + lib/rpmlock.c | 5 +---- + 1 file changed, 1 insertion(+), 4 deletions(-) + +diff --git a/lib/rpmlock.c b/lib/rpmlock.c +index d693c4b..86e07b3 100644 +--- a/lib/rpmlock.c ++++ b/lib/rpmlock.c +@@ -125,13 +125,10 @@ rpmlock rpmlockNew(const char *lock_path, const char *descr) + int rpmlockAcquire(rpmlock lock) + { + int locked = 0; /* assume failure */ +- int myerrno = errno; +- int maywait = isatty(STDIN_FILENO); /* dont wait within scriptlets */ +- errno = myerrno; + + if (lock) { + locked = rpmlock_acquire(lock, RPMLOCK_WRITE); +- if (!locked && (lock->openmode & RPMLOCK_WRITE) && maywait) { ++ if (!locked && (lock->openmode & RPMLOCK_WRITE)) { + rpmlog(RPMLOG_WARNING, _("waiting for %s lock on %s\n"), + lock->descr, lock->path); + locked = rpmlock_acquire(lock, (RPMLOCK_WRITE|RPMLOCK_WAIT)); +-- +1.7.12.4 + diff --git a/rpm-4.11.x-siteconfig.patch b/rpm-4.11.x-siteconfig.patch new file mode 100644 index 0000000..f32f859 --- /dev/null +++ b/rpm-4.11.x-siteconfig.patch @@ -0,0 +1,12 @@ +diff -up rpm-4.11.1-rc1/macros.in.siteconfig rpm-4.11.1-rc1/macros.in +--- rpm-4.11.1-rc1/macros.in.siteconfig 2013-06-07 13:19:21.000000000 +0300 ++++ rpm-4.11.1-rc1/macros.in 2013-06-11 15:06:59.525747503 +0300 +@@ -647,6 +647,8 @@ package or when debugging this package.\ + export CLASSPATH}\ + PKG_CONFIG_PATH=\"${PKG_CONFIG_PATH}:%{_libdir}/pkgconfig:%{_datadir}/pkgconfig\"\ + export PKG_CONFIG_PATH\ ++ CONFIG_SITE=${CONFIG_SITE:-NONE}\ ++ export CONFIG_SITE\ + \ + %{verbose:set -x}%{!verbose:exec > /dev/null}\ + umask 022\ diff --git a/rpm-4.12.0-rpm2cpio-hack.patch b/rpm-4.12.0-rpm2cpio-hack.patch new file mode 100644 index 0000000..38c7dbd --- /dev/null +++ b/rpm-4.12.0-rpm2cpio-hack.patch @@ -0,0 +1,18 @@ +diff --git a/rpm2cpio.c b/rpm2cpio.c +index 89ebdfa..ae999ff 100644 +--- a/rpm2cpio.c ++++ b/rpm2cpio.c +@@ -84,7 +84,12 @@ int main(int argc, char *argv[]) + exit(EXIT_FAILURE); + } + +- rc = (ufdCopy(gzdi, fdo) == payload_size) ? EXIT_SUCCESS : EXIT_FAILURE; ++ /* ++ * XXX HACK for #1142949: should be equality test, but archive size ++ * short by cpio trailer size in packages built with rpm 4.12.0 ++ * and its pre-releases. ++ */ ++ rc = (ufdCopy(gzdi, fdo) >= payload_size) ? EXIT_SUCCESS : EXIT_FAILURE; + + Fclose(fdo); + diff --git a/rpm-4.13.0-fedora-specspo.patch b/rpm-4.13.0-fedora-specspo.patch new file mode 100644 index 0000000..64416c7 --- /dev/null +++ b/rpm-4.13.0-fedora-specspo.patch @@ -0,0 +1,95 @@ +diff --git a/lib/tagexts.c b/lib/tagexts.c +index f72ff60..2c0b179 100644 +--- a/lib/tagexts.c ++++ b/lib/tagexts.c +@@ -535,15 +535,6 @@ static int filerequireTag(Header h, rpmtd td, headerGetFlags hgflags) + return filedepTag(h, RPMTAG_REQUIRENAME, td, hgflags); + } + +-/* I18N look aside diversions */ +- +-#if defined(ENABLE_NLS) +-extern int _nl_msg_cat_cntr; /* XXX GNU gettext voodoo */ +-#endif +-static const char * const language = "LANGUAGE"; +- +-static const char * const _macro_i18ndomains = "%{?_i18ndomains}"; +- + /** + * Retrieve i18n text. + * @param h header +@@ -554,59 +545,30 @@ static const char * const _macro_i18ndomains = "%{?_i18ndomains}"; + */ + static int i18nTag(Header h, rpmTag tag, rpmtd td, headerGetFlags hgflags) + { +- int rc; ++ int rc = headerGet(h, tag, td, HEADERGET_ALLOC); + #if defined(ENABLE_NLS) +- char * dstring = rpmExpand(_macro_i18ndomains, NULL); +- +- td->type = RPM_STRING_TYPE; +- td->data = NULL; +- td->count = 0; +- +- if (dstring && *dstring) { +- char *domain, *de; +- const char * langval; +- char * msgkey; +- const char * msgid; ++ if (rc) { ++ static const char * const _macro_i18ndomains = "%{?_i18ndomains}"; ++ char *de, *dstring = rpmExpand(_macro_i18ndomains, NULL); ++ const char *domain; + +- rasprintf(&msgkey, "%s(%s)", headerGetString(h, RPMTAG_NAME), +- rpmTagGetName(tag)); +- +- /* change to en_US for msgkey -> msgid resolution */ +- langval = getenv(language); +- (void) setenv(language, "en_US", 1); +- ++_nl_msg_cat_cntr; +- +- msgid = NULL; + for (domain = dstring; domain != NULL; domain = de) { ++ const char *msgid = td->data; ++ const char *msg = NULL; ++ + de = strchr(domain, ':'); + if (de) *de++ = '\0'; +- msgid = dgettext(domain, msgkey); +- if (msgid != msgkey) break; +- } +- +- /* restore previous environment for msgid -> msgstr resolution */ +- if (langval) +- (void) setenv(language, langval, 1); +- else +- unsetenv(language); +- ++_nl_msg_cat_cntr; +- +- if (domain && msgid) { +- td->data = dgettext(domain, msgid); +- td->data = xstrdup(td->data); /* XXX xstrdup has side effects. */ +- td->count = 1; +- td->flags = RPMTD_ALLOCED; ++ msg = dgettext(domain, td->data); ++ if (msg != msgid) { ++ free(td->data); ++ td->data = xstrdup(msg); ++ break; ++ } + } +- dstring = _free(dstring); +- free(msgkey); +- if (td->data) +- return 1; ++ free(dstring); + } +- +- free(dstring); + #endif + +- rc = headerGet(h, tag, td, HEADERGET_ALLOC); + return rc; + } + diff --git a/rpm-4.13.90-ldflags.patch b/rpm-4.13.90-ldflags.patch new file mode 100644 index 0000000..ad65430 --- /dev/null +++ b/rpm-4.13.90-ldflags.patch @@ -0,0 +1,15 @@ +diff -up rpm-4.9.1.1/macros.in.jx rpm-4.9.1.1/macros.in +--- rpm-4.9.1.1/macros.in.jx 2011-08-03 16:19:05.000000000 -0400 ++++ rpm-4.9.1.1/macros.in 2011-08-08 09:41:52.981064316 -0400 +@@ -674,9 +674,10 @@ print (t)\ + RPM_SOURCE_DIR=\"%{u2p:%{_sourcedir}}\"\ + RPM_BUILD_DIR=\"%{u2p:%{_builddir}}\"\ + RPM_OPT_FLAGS=\"%{optflags}\"\ ++ RPM_LD_FLAGS=\"%{?__global_ldflags}\"\ + RPM_ARCH=\"%{_arch}\"\ + RPM_OS=\"%{_os}\"\ +- export RPM_SOURCE_DIR RPM_BUILD_DIR RPM_OPT_FLAGS RPM_ARCH RPM_OS\ ++ export RPM_SOURCE_DIR RPM_BUILD_DIR RPM_OPT_FLAGS RPM_LD_FLAGS RPM_ARCH RPM_OS\ + RPM_DOC_DIR=\"%{_docdir}\"\ + export RPM_DOC_DIR\ + RPM_PACKAGE_NAME=\"%{NAME}\"\ diff --git a/rpm-4.14.2.tar.bz2 b/rpm-4.14.2.tar.bz2 new file mode 100644 index 0000000..b278dde Binary files /dev/null and b/rpm-4.14.2.tar.bz2 differ diff --git a/rpm-4.7.1-geode-i686.patch b/rpm-4.7.1-geode-i686.patch new file mode 100644 index 0000000..2e8692a --- /dev/null +++ b/rpm-4.7.1-geode-i686.patch @@ -0,0 +1,14 @@ +diff --git a/rpmrc.in b/rpmrc.in +index 4a6cca9..d62ddaf 100644 +--- a/rpmrc.in ++++ b/rpmrc.in +@@ -281,7 +281,7 @@ arch_compat: alphaev5: alpha + arch_compat: alpha: axp noarch + + arch_compat: athlon: i686 +-arch_compat: geode: i586 ++arch_compat: geode: i686 + arch_compat: pentium4: pentium3 + arch_compat: pentium3: i686 + arch_compat: i686: i586 + diff --git a/rpm-4.8.1-use-gpg2.patch b/rpm-4.8.1-use-gpg2.patch new file mode 100644 index 0000000..61ef55e --- /dev/null +++ b/rpm-4.8.1-use-gpg2.patch @@ -0,0 +1,12 @@ +diff -up rpm-4.8.1/macros.in.gpg2 rpm-4.8.1/macros.in +--- rpm-4.8.0/macros.in.gpg2 2011-01-17 12:17:38.000000000 +0200 ++++ rpm-4.8.0/macros.in 2011-01-17 12:17:59.000000000 +0200 +@@ -40,7 +40,7 @@ + %__cp @__CP@ + %__cpio @__CPIO@ + %__file @__FILE@ +-%__gpg @__GPG@ ++%__gpg /usr/bin/gpg2 + %__grep @__GREP@ + %__gzip @__GZIP@ + %__id @__ID@ diff --git a/rpm-4.9.90-no-man-dirs.patch b/rpm-4.9.90-no-man-dirs.patch new file mode 100644 index 0000000..04f276a --- /dev/null +++ b/rpm-4.9.90-no-man-dirs.patch @@ -0,0 +1,12 @@ +diff -up rpm-4.9.90.git11486/scripts/find-lang.sh.no-man-dirs rpm-4.9.90.git11486/scripts/find-lang.sh +--- rpm-4.9.90.git11486/scripts/find-lang.sh.no-man-dirs 2012-03-07 11:31:10.000000000 +0200 ++++ rpm-4.9.90.git11486/scripts/find-lang.sh 2012-03-07 15:11:57.465801075 +0200 +@@ -181,7 +181,7 @@ s:%lang(C) :: + find "$TOP_DIR" -type d|sed ' + s:'"$TOP_DIR"':: + '"$ALL_NAME$MAN"'s:\(.*/man/\([^/_]\+\).*/man[a-z0-9]\+/\):: +-'"$ALL_NAME$MAN"'s:\(.*/man/\([^/_]\+\).*/man[a-z0-9]\+$\):%lang(\2) \1*: ++'"$ALL_NAME$MAN"'s:\(.*/man/\([^/_]\+\).*/man[a-z0-9]\+$\):%lang(\2) \1/*: + s:^\([^%].*\):: + s:%lang(C) :: + /^$/d' >> $MO_NAME diff --git a/rpm.spec b/rpm.spec new file mode 100644 index 0000000..b77f1dd --- /dev/null +++ b/rpm.spec @@ -0,0 +1,279 @@ +Name: rpm +Version: 4.14.2 +Release: 3 +Summary: RPM Package Manager +License: GPLv2+ +URL: http://www.rpm.org/ +Source0: http://ftp.rpm.org/releases/rpm-4.14.x/%{name}-%{version}.tar.bz2 + +Patch1: rpm-4.11.x-siteconfig.patch +Patch2: rpm-4.13.0-fedora-specspo.patch +Patch3: rpm-4.9.90-no-man-dirs.patch +Patch4: rpm-4.8.1-use-gpg2.patch +Patch5: rpm-4.12.0-rpm2cpio-hack.patch +Patch6: 0001-find-debuginfo.sh-decompress-DWARF-compressed-ELF-se.patch +Patch906: rpm-4.7.1-geode-i686.patch +Patch907: rpm-4.13.90-ldflags.patch + +Patch6000: bugfix-rpm-4.11.3-add-aarch64_ilp32-arch.patch +Patch6001: bugfix-rpm-4.14.2-fix-tty-failed.patch +Patch6002: 0001-Fix-ancient-python-GIL-locking-bug-on-callback-RhBug.patch +Patch6003: 0002-Resurrect-long-since-broken-Lua-library-path.patch +Patch6004: 0003-Fix-nasty-setperms-setugids-regression-in-4.14.2-RhB.patch + +Patch9000: bugfix-rpm-4.14.2-wait-once-get-rpmlock-fail.patch + +BuildRequires: gcc autoconf automake libtool make gawk popt-devel openssl-devel readline-devel libdb-devel openEuler-rpm-config +BuildRequires: zlib-devel libzstd-devel xz-devel bzip2-devel libarchive-devel ima-evm-utils-devel +BuildRequires: dbus-devel fakechroot elfutils-devel elfutils-libelf-devel +BuildRequires: lua-devel libcap-devel libacl-devel libselinux-devel file-devel gettext-devel ncurses-devel +Requires: coreutils popt curl zstd libcap gnupg2 crontabs logrotate libdb-utils +Obsoletes: %{name}-libs %{name}-build-libs %{name}-sign-libs %{name}-sign %{name}-cron +Provides: %{name}-libs %{name}-build-libs %{name}-sign-libs %{name}-sign %{name}-cron +Obsoletes: %{name}-plugin-selinux %{name}-plugin-syslog %{name}-plugin-systemd-inhibit %{name}-plugin-ima %{name}-plugin-prioreset +Provides: %{name}-plugin-selinux %{name}-plugin-syslog %{name}-plugin-systemd-inhibit %{name}-plugin-ima %{name}-plugin-prioreset + +%description +The RPM Package Manager (RPM) is a powerful package management system capability as below + +-building computer software from source into easily distributable packages +-installing, updating and uninstalling packaged software +-querying detailed information about the packaged software, whether installed or not +-verifying integrity of packaged software and resulting software installation + +%package build +Summary: Scripts and executable programs used to build packages +Requires: %{name} = %{version}-%{release} +Requires: elfutils binutils findutils sed grep gawk diffutils file patch +Requires: tar unzip gzip bzip2 cpio xz zstd pkgconfig system-rpm-config + +%description build +This package provides scripts and executable programs that used to +build rpm packages. + +%package -n python2-%{name} +Summary: Python2 bindings for RPM user +BuildRequires: python2-devel +%{?python_provide:%python_provide python2-%{name}} +Requires: %{name} = %{version}-%{release} +Provides: %{name}-python = %{version}-%{release} +Obsoletes: %{name}-python < %{version}-%{release} + +%description -n python2-%{name} +This package contains a module that allow applications +written with Python2 to use the interface +supplied by RPM. + +%package -n python3-%{name} +Summary: Python3 bindings for RPM user +BuildRequires: python3-devel +%{?python_provide:%python_provide python3-%{name}} +Requires: %{name} = %{version}-%{release} +Provides: %{name}-python3 = %{version}-%{release} +Obsoletes: %{name}-python3 < %{version}-%{release} + +%description -n python3-%{name} +This package contains a module that allow applications +written with Python3 to use the interface +supplied by RPM. + +%package devel +Summary: Development files for RPM handling +Requires: %{name} = %{version}-%{release} +Requires: popt-devel + +%description devel +%{summary}. + +%package help +Summary: Man page for %{name} +BuildArch: noarch +Obsoletes: apidocs + +%description help +%{summary}. + +%prep +%autosetup -n %{name}-%{version} -p1 + +sed -ie 's:^python test:python2 test:g' tests/rpmtests tests/local.at + +%build +CPPFLAGS="$CPPFLAGS -DLUA_COMPAT_APIINTCASTS" +CFLAGS="$RPM_OPT_FLAGS -DLUA_COMPAT_APIINTCASTS" +LDFLAGS="$LDFLAGS %{?__global_ldflags}" +export CPPFLAGS CFLAGS LDFLAGS + +autoreconf -i -f + +for i in $(find . -name ltmain.sh) ; do + %{__sed} -i.backup -e 's~compiler_flags=$~compiler_flags="%{_hardened_ldflags}"~' $i +done; + +./configure \ + --prefix=%{_usr} \ + --sysconfdir=%{_sysconfdir} \ + --localstatedir=%{_var} \ + --sharedstatedir=%{_var}/lib \ + --libdir=%{_libdir} \ + --build=%{_target_platform} \ + --host=%{_target_platform} \ + --with-vendor=%{_vendor} \ + --with-external-db \ + --with-lua \ + --with-selinux \ + --with-cap \ + --with-acl \ + --with-imaevm \ + --enable-zstd \ + --enable-python \ + --with-crypto=openssl + +%make_build + +pushd python +%{__python2} setup.py build +%{__python3} setup.py build +popd + +%install +%make_install + +pushd python +%{__python2} setup.py install --skip-build --root $RPM_BUILD_ROOT +%{__python3} setup.py install --skip-build --root $RPM_BUILD_ROOT +popd + +mkdir -p ${RPM_BUILD_ROOT}%{_sysconfdir}/cron.daily +install -m 755 scripts/rpm.daily ${RPM_BUILD_ROOT}%{_sysconfdir}/cron.daily/rpm + +mkdir -p ${RPM_BUILD_ROOT}%{_sysconfdir}/logrotate.d +install -m 644 scripts/rpm.log ${RPM_BUILD_ROOT}%{_sysconfdir}/logrotate.d/rpm + +mkdir -p ${RPM_BUILD_ROOT}/usr/lib/tmpfiles.d +echo "r /var/lib/rpm/__db.*" > ${RPM_BUILD_ROOT}/usr/lib/tmpfiles.d/rpm.conf + +mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/rpm +mkdir -p $RPM_BUILD_ROOT%{_rpmconfigdir}/macros.d +mkdir -p $RPM_BUILD_ROOT/var/lib/rpm + +for dbi in \ + Basenames Conflictname Dirnames Group Installtid Name Obsoletename \ + Packages Providename Requirename Triggername Sha1header Sigmd5 \ + __db.001 __db.002 __db.003 __db.004 __db.005 __db.006 __db.007 \ + __db.008 __db.009 +do + touch $RPM_BUILD_ROOT/var/lib/rpm/$dbi +done + +%find_lang %{name} + +find $RPM_BUILD_ROOT -name "*.la"|xargs rm -f + +rm -f $RPM_BUILD_ROOT/%{_rpmconfigdir}/{perldeps.pl,perl.*,pythond*} +rm -f $RPM_BUILD_ROOT/%{_fileattrsdir}/{perl*,python*} +rm -f $RPM_BUILD_ROOT/%{_rpmconfigdir}/{tcl.req,osgideps.pl} + +chmod a-x $RPM_BUILD_ROOT/%{_rpmconfigdir}/python-macro-helper + +%check +make check || cat tests/rpmtests.log + +%post -p /sbin/ldconfig + +%postun -p /sbin/ldconfig + +%files -f %{name}.lang +%defattr(-,root,root) +%license COPYING +%doc CREDITS +/usr/lib/tmpfiles.d/rpm.conf +%{_sysconfdir}/cron.daily/rpm +%config(noreplace) %{_sysconfdir}/logrotate.d/rpm +%dir %{_sysconfdir}/rpm +%dir /var/lib/rpm +%attr(0644, root, root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/lib/rpm/* +%lang(fr) %{_mandir}/fr/man[18]/*.[18]* +%lang(ko) %{_mandir}/ko/man[18]/*.[18]* +%lang(ja) %{_mandir}/ja/man[18]/*.[18]* +%lang(pl) %{_mandir}/pl/man[18]/*.[18]* +%lang(ru) %{_mandir}/ru/man[18]/*.[18]* +%lang(sk) %{_mandir}/sk/man[18]/*.[18]* + +%attr(0755, root, root) %dir %{_rpmconfigdir} +%{_rpmconfigdir}/macros +%{_rpmconfigdir}/macros.d +%{_rpmconfigdir}/rpmpopt* +%{_rpmconfigdir}/rpmrc +%{_rpmconfigdir}/rpmdb_* +%{_rpmconfigdir}/rpm.daily +%{_rpmconfigdir}/rpm.log +%{_rpmconfigdir}/rpm.supp +%{_rpmconfigdir}/rpm2cpio.sh +%{_rpmconfigdir}/tgpg +%{_rpmconfigdir}/python-macro-helper +%{_rpmconfigdir}/platform +%{_libdir}/librpm*.so.* +%{_libdir}/rpm-plugins/ +%dir %{_rpmconfigdir}/fileattrs +%{_bindir}/rpm +%{_bindir}/rpm2archive +%{_bindir}/rpm2cpio +%{_bindir}/rpmdb +%{_bindir}/rpmkeys +%{_bindir}/rpmquery +%{_bindir}/rpmverify +%{_bindir}/rpmsign + +%files build +%defattr(-,root,root) +%{_bindir}/rpmbuild +%{_bindir}/gendiff +%{_bindir}/rpmspec + +%{_rpmconfigdir}/brp-* +%{_rpmconfigdir}/check-* +%{_rpmconfigdir}/debugedit +%{_rpmconfigdir}/sepdebugcrcfix +%{_rpmconfigdir}/find-debuginfo.sh +%{_rpmconfigdir}/find-lang.sh +%{_rpmconfigdir}/*provides* +%{_rpmconfigdir}/*requires* +%{_rpmconfigdir}/*deps* +%{_rpmconfigdir}/*.prov +%{_rpmconfigdir}/*.req +%{_rpmconfigdir}/config.* +%{_rpmconfigdir}/mkinstalldirs +%{_rpmconfigdir}/macros.p* +%{_rpmconfigdir}/fileattrs/* + +%files -n python2-%{name} +%defattr(-,root,root) +%{python2_sitearch}/%{name}/ +%{python2_sitearch}/%{name}-%{version}*.egg-info + +%files -n python3-%{name} +%defattr(-,root,root) +%{python3_sitearch}/%{name}/ +%{python3_sitearch}/%{name}-%{version}*.egg-info + +%files devel +%defattr(-,root,root) +%{_bindir}/rpmgraph +%{_libdir}/librp*[a-z].so +%{_libdir}/pkgconfig/%{name}.pc +%{_includedir}/%{name}/ + +%files help +%defattr(-,root,root) +%doc doc/manual/[a-z]* +%doc doc/librpm/html/* +%{_mandir}/man8/rpm*.8* +%{_mandir}/man1/gendiff.1* + +%changelog +* Fri Sep 20 2019 openEuler Buildteam - 4.14.2-3 +- Delete redundant information + +* Mon Sep 09 2019 openEuler Buildteam - 4.14.2-2 +- Package init