Skip to contentSkip to conversation

package_manager.py: delete RPM db locks after calling rpmresolve

PATCH In review Laurentiu Palcu 2 participants 4 messages Mar 27, 2014 – Mar 28, 2014

lore
Share & tools
lore
#0 lore raw

cover package_manager.py: delete RPM db locks after calling rpmresolve

The following changes since commit c4eeaa8e35e926b6d1f633549f76d1ba9ed9278b:

bitbake: knotty: Show a link to the logfile for failed setscene tasks (2014-03-27 10:42:08 +0000)

are available in the git repository at:

git://git.yoctoproject.org/poky-contrib lpalcu/b6049_do_rootfs_crash
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=lpalcu/b6049_do_rootfs_crash

Laurentiu Palcu (1):
package_manager.py: delete RPM db locks after calling rpmresolve

 meta/lib/oe/package_manager.py |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/1 package_manager.py: delete RPM db locks after calling rpmresolve

If the locks are not removed, the output of the next rpm command executed will contain the following string:

rpmdb: BDB1540 configured environment flags incompatible with existing environment

And this will create various parsing issues.

[YOCTO #6049]

---
 meta/lib/oe/package_manager.py |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
meta/lib/oe/package_manager.py +9 -3
index 764ab72..0f22e46 100644
@@ -242,6 +242,12 @@ class RpmPkgsList(PkgsList):
         self.ml_prefix_list, self.ml_os_list = \
             RpmIndexer(d, rootfs_dir).get_ml_prefix_and_os_list(arch_var, os_var)
 
+    def _unlock_rpm_db(self):
+        # Remove rpm db lock files
+        rpm_db_locks = glob.glob('%s/var/lib/rpm/__db.*' % self.rootfs_dir)
+        for f in rpm_db_locks:
+            bb.utils.remove(f, True)
+
     '''
     Translate the RPM/Smart format names to the OE multilib format names
     '''
@@ -281,6 +287,8 @@ class RpmPkgsList(PkgsList):
 
         try:
             output = subprocess.check_output(cmd, stderr=subprocess.STDOUT).strip()
+
+            self._unlock_rpm_db()
         except subprocess.CalledProcessError as e:
             bb.fatal("Cannot get the package dependencies. Command '%s' "
                      "returned %d:\n%s" % (' '.join(cmd), e.returncode, e.output))
@@ -299,9 +307,7 @@ class RpmPkgsList(PkgsList):
             # bb.note(cmd)
             tmp_output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True).strip()
 
-            rpm_db_locks = glob.glob('%s/var/lib/rpm/__db.*' % self.rootfs_dir)
-            for f in rpm_db_locks:
-                bb.utils.remove(f, True)
+            self._unlock_rpm_db()
         except subprocess.CalledProcessError as e:
             bb.fatal("Cannot get the installed packages list. Command '%s' "
                      "returned %d:\n%s" % (cmd, e.returncode, e.output))
Signature · 1 line
1.7.9.5
#2 lore raw
Quoted 5 lines · Laurentiu Palcu

If the locks are not removed, the output of the next rpm command executed will contain the following string:

rpmdb: BDB1540 configured environment flags incompatible with existing environment

This usually means that RPM was not called with the same environment, or different version of RPM (or BerkleyDB) were used in the call.

We need to verify that the rpmresolve was using the proper (oe-built) version of RPM, librpm, python-rpm and not the host's version.

Assuming this is true, then I believe the change is safe. Otherwise, we need to fix rpmresolve to use the correct set of libraries.

--Mark

Quoted 47 lines

And this will create various parsing issues.

[YOCTO #6049]

---
  meta/lib/oe/package_manager.py |   12 +++++++++---
  1 file changed, 9 insertions(+), 3 deletions(-)
meta/lib/oe/package_manager.py +9 -3
index 764ab72..0f22e46 100644
@@ -242,6 +242,12 @@ class RpmPkgsList(PkgsList):
          self.ml_prefix_list, self.ml_os_list = \
              RpmIndexer(d, rootfs_dir).get_ml_prefix_and_os_list(arch_var, os_var)
 
+    def _unlock_rpm_db(self):
+        # Remove rpm db lock files
+        rpm_db_locks = glob.glob('%s/var/lib/rpm/__db.*' % self.rootfs_dir)
+        for f in rpm_db_locks:
+            bb.utils.remove(f, True)
+
      '''
      Translate the RPM/Smart format names to the OE multilib format names
      '''
@@ -281,6 +287,8 @@ class RpmPkgsList(PkgsList):
 
          try:
              output = subprocess.check_output(cmd, stderr=subprocess.STDOUT).strip()
+
+            self._unlock_rpm_db()
          except subprocess.CalledProcessError as e:
              bb.fatal("Cannot get the package dependencies. Command '%s' "
                       "returned %d:\n%s" % (' '.join(cmd), e.returncode, e.output))
@@ -299,9 +307,7 @@ class RpmPkgsList(PkgsList):
              # bb.note(cmd)
              tmp_output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True).strip()
 
-            rpm_db_locks = glob.glob('%s/var/lib/rpm/__db.*' % self.rootfs_dir)
-            for f in rpm_db_locks:
-                bb.utils.remove(f, True)
+            self._unlock_rpm_db()
          except subprocess.CalledProcessError as e:
              bb.fatal("Cannot get the installed packages list. Command '%s' "
                       "returned %d:\n%s" % (cmd, e.returncode, e.output))
#3 lore raw
In reply to Laurentiu Palcu

Put this on hold. I'll do some more investigations. I want to see what's the deal with those rpm lock DBs and why we don't delete them only once, after the rootfs generation has completely finished (after postprocess commands are called, etc).

laurentiu

Quoted 23 lines · Laurentiu Palcu

The following changes since commit c4eeaa8e35e926b6d1f633549f76d1ba9ed9278b:

bitbake: knotty: Show a link to the logfile for failed setscene tasks (2014-03-27 10:42:08 +0000)

are available in the git repository at:

git://git.yoctoproject.org/poky-contrib lpalcu/b6049_do_rootfs_crash
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=lpalcu/b6049_do_rootfs_crash

Laurentiu Palcu (1):
package_manager.py: delete RPM db locks after calling rpmresolve

 meta/lib/oe/package_manager.py |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
Signature · 7 lines
1.7.9.5

-- 
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core