Skip to contentSkip to conversation

update default rpm prefer_color

PATCH Superseded Changqing Li 2 participants 4 messages May 8, 2020

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover update default rpm prefer_color

From: Changqing Li <[email protected]>

* 0001-lib-oe-package_manager-update-default-rpm-config-_pr.patch update prefer_color to rpm default value 2

* 0002-rpm-fix-file-conflicts-for-MIPS64-N32.patch handle 3 ways conflicts when prefer_color is updated to 2

Changqing Li (2):
lib/oe/package_manager: update default rpm config %_prefer_color
rpm: fix file conflicts for MIPS64 N32

 meta/lib/oe/package_manager.py                     |  2 -
 ...ction.c-fix-file-conflicts-for-MIPS64-N32.patch | 58 ++++++++++++++++++++++
 meta/recipes-devtools/rpm/rpm_4.14.2.1.bb          |  1 +
 3 files changed, 59 insertions(+), 2 deletions(-)
 create mode 100644 meta/recipes-devtools/rpm/files/0001-lib-transaction.c-fix-file-conflicts-for-MIPS64-N32.patch
Signature · 1 line
2.7.4
#1 lore raw

PATCH v2 1/2 lib/oe/package_manager: update default rpm config %_prefer_color

From: Changqing Li <[email protected]>

* %_prefer_color is used by rpm to determine which color's ELF file is preferred to be installed.

Here are file colors:
0 is unknown or other
1 is Elf32
2 is Elf64
4 is MIPS64 n32 (this color is added by oe-core's patch)

if default value set to 7, all colors are preferred color, always be last-in-wins.

For this scenario, when we have 64bits python3 installed first, then install 32bits python3 later, 64bits python3 will be overwrited, and sys.path will point to /usr/lib, not /usr/lib64, this may cause some python3 modules not work. so fixed by remove setting of default value 7, and use default value 2 of rpm

* other distro like fedora also use the default %_prefer_color 2

---
 meta/lib/oe/package_manager.py | 2 --
 1 file changed, 2 deletions(-)
meta/lib/oe/package_manager.py +0 -2
index b066041..c055d2b 100644
@@ -805,8 +805,6 @@ class RpmPM(PackageManager):
         open(platformconfdir + "macros", 'w').write("%_transaction_color 7\n")
         if self.d.getVar('RPM_PREFER_ELF_ARCH'):
             open(platformconfdir + "macros", 'a').write("%%_prefer_color %s" % (self.d.getVar('RPM_PREFER_ELF_ARCH')))
-        else:
-            open(platformconfdir + "macros", 'a').write("%_prefer_color 7")
 
         if self.d.getVar('RPM_SIGN_PACKAGES') == '1':
             signer = get_signer(self.d, self.d.getVar('RPM_GPG_BACKEND'))
Signature · 1 line
2.7.4
#2 lore raw

PATCH v2 2/2 rpm: fix file conflicts for MIPS64 N32

In reply to Changqing Li

From: Changqing Li <[email protected]>

The following error occurred when prefer_color set to 2:
Error: Transaction check error:
file /sbin/ldconfig conflicts between attempted installs of
ldconfig-2.31+git0+71f2b249a2-r0.mips64_n32 and lib32-ldconfig-2.31+git0+71f2b249a2-r0.mips32r2
file /usr/bin/gencat conflicts between attempted installs of
lib32-libc6-utils-2.31+git0+71f2b249a2-r0.mips32r2
...

This was because:
transactions_color = 001 (ELF32) & 010 (ELF64) & 100 (ELF32 N32 MIPS64) FColor = Current file color (001) & transaction_color (111) oFcolor = Previous file color (100) & transaction_color (111)

when "neither preferred" happened, handled as conflicts. this is too restrictive for three way conflicts(mips64/mips64 n32/mips(32)). Fixed by perform a 'last-in-wins' resolution when "neither is preferred".

refer:
https://github.com/rpm-software-management/rpm/issues/193
https://git.openembedded.org/openembedded-core/commit/meta/recipes-devtools/rpm?id=36c225704daa58b98a4b7f2ef315eb944d8628b5

---
 ...ction.c-fix-file-conflicts-for-MIPS64-N32.patch | 58 ++++++++++++++++++++++
 meta/recipes-devtools/rpm/rpm_4.14.2.1.bb          |  1 +
 2 files changed, 59 insertions(+)
 create mode 100644 meta/recipes-devtools/rpm/files/0001-lib-transaction.c-fix-file-conflicts-for-MIPS64-N32.patch
meta/recipes-devtools/rpm/files/0001-lib-transaction.c-fix-file-conflicts-for-MIPS64-N32.patch new file +58 -0
new file mode 100644
index 0000000..b515075
@@ -0,0 +1,58 @@
+From 1ed066fc6fa7d7afffe3545c4e3ea937529e6c49 Mon Sep 17 00:00:00 2001
+From: Changqing Li <[email protected]>
+Date: Thu, 7 May 2020 17:40:58 +0800
+Subject: [PATCH] lib/transaction.c: fix file conflicts for MIPS64 N32
+
+This patch is from:
+https://github.com/rpm-software-management/rpm/issues/193
+
+Error: Transaction check error:
+  file /sbin/ldconfig conflicts between attempted installs of
+ldconfig-2.31+git0+71f2b249a2-r0.mips64_n32 and
+lib32-ldconfig-2.31+git0+71f2b249a2-r0.mips32r2
+...
+
+This was because:
+transactions_color = 001 (ELF32) & 010 (ELF64) & 100 (ELF32 N32 MIPS64)
+FColor = Current file color (001) & transaction_color (111)
+oFcolor = Previous file color (100) & transaction_color (111)
+
+In handleColorConflict, it only deal with conditons "new preferred" or
+"old preferred". But not deal with the situation where neither is the
+preferred type. so for tri-lib system, like mips64/mips64 n32/mips(32),
+"Transaction check error" occurred.
+
+Fixed by performing a 'last-in-wins' resolution when "neither is preferred".
+
+Signed-off-by: Changqing Li <[email protected]>
+---
+ lib/transaction.c | 13 ++++++++++++-
+ 1 file changed, 12 insertions(+), 1 deletion(-)
+
+diff --git a/lib/transaction.c b/lib/transaction.c
+index 67b9db5..82386b8 100644
+--- a/lib/transaction.c
++++ b/lib/transaction.c
+@@ -391,7 +391,18 @@ static int handleColorConflict(rpmts ts,
+ 		    rpmfsSetAction(ofs, ofx, FA_CREATE);
+ 		rpmfsSetAction(fs, fx, FA_SKIPCOLOR);
+ 		rConflicts = 0;
+-	    }
++	    }else {
++                /*
++                 * If neither is already skipped, we skip the old one, and
++                 * install the new one (last in wins).
++                 */
++                if (ofs && !XFA_SKIPPING(rpmfsGetAction(ofs, ofx)) &&
++                    fs && !XFA_SKIPPING(rpmfsGetAction(fs, fx))) {
++                    rpmfsSetAction(ofs, ofx, FA_SKIPCOLOR);
++                    rpmfsSetAction(fs, fx, FA_CREATE);
++                }
++                rConflicts = 0;
++            }
+ 	}
+     }
+ 
+-- 
+2.7.4
+
meta/recipes-devtools/rpm/rpm_4.14.2.1.bb +1 -0
index 17255dc..3e2c6d1 100644
@@ -44,6 +44,7 @@ SRC_URI = "git://github.com/rpm-software-management/rpm;branch=rpm-4.14.x \
            file://0001-mono-find-provides-requires-do-not-use-monodis-from-.patch \
            file://0001-Rip-out-partial-support-for-unused-MD2-and-RIPEMD160.patch \
            file://0001-rpmplugins.c-call-dlerror-prior-to-dlsym.patch \
+           file://0001-lib-transaction.c-fix-file-conflicts-for-MIPS64-N32.patch \
            "
 
 PE = "1"
Signature · 1 line
2.7.4
#3 lore raw

✗ patchtest: failure for update default rpm prefer_color

In reply to Changqing Li

== Series Details ==

Series: update default rpm prefer_color
Revision: 1
URL : https://patchwork.openembedded.org/series/24018/
State : failure

== Summary ==

Thank you for submitting this patch series to OpenEmbedded Core. This is an automated response. Several tests have been executed on the proposed series by patchtest resulting in the following failures:

* Issue Series does not apply on top of target branch [test_series_merge_on_head]
Suggested fix Rebase your series on top of targeted branch
Targeted branch master (currently at e604e9d234)

* Issue Added patch file is missing Upstream-Status in the header [test_upstream_status_presence_format]

  Suggested fix    Add Upstream-Status: <Valid status> to the header of meta/recipes-devtools/rpm/files/0001-lib-transaction.c-fix-file-conflicts-for-MIPS64-N32.patch
  Standard format  Upstream-Status: <Valid status>
  Valid status     Pending, Accepted, Backport, Denied, Inappropriate [reason], Submitted [where]

If you believe any of these test results are incorrect, please reply to the mailing list ([email protected]) raising your concerns. Otherwise we would appreciate you correcting the issues and submitting a new version of the patchset if applicable. Please ensure you add/increment the version number when sending the new version (i.e. [PATCH] -> [PATCH v2] -> [PATCH v3] -> ...).

---

Guidelines:     https://www.openembedded.org/wiki/Commit_Patch_Message_Guidelines
Test framework: http://git.yoctoproject.org/cgit/cgit.cgi/patchtest
Test suite:     http://git.yoctoproject.org/cgit/cgit.cgi/patchtest-oe