aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>2016-09-14 11:46:06 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-09-14 22:20:05 +0100
commite7267b4e78461e71a1175f93e2eb5e90272c2b47 (patch)
treec48f1986b3cdaad3fcbbaa3f892fc16e1c322ba6
parent7c0788cd2390fd0e1ec84bc9dbebcb67daee429f (diff)
downloadopenembedded-core-contrib-e7267b4e78461e71a1175f93e2eb5e90272c2b47.tar.gz
python-smartpm: use md5 as the digest for rpm_sys channel
Use md5 sum instead of mtime as the "digest" method for rpm_sys channel. The digest is used to determine if the channel has been updated. It was found out that mtime was not a reliable digest. On some systems mtime of the rpm db does not get updated after every transaction if transactions (smart install / remove commands) are fired in quick succession. As a consequence smartpm cache and rpm db get out of sync. [YOCTO #10244] Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-devtools/python/python-smartpm/channels-rpm_sys-use-md5sum-instead-of-mtime-as-the-.patch38
-rw-r--r--meta/recipes-devtools/python/python-smartpm_git.bb1
2 files changed, 39 insertions, 0 deletions
diff --git a/meta/recipes-devtools/python/python-smartpm/channels-rpm_sys-use-md5sum-instead-of-mtime-as-the-.patch b/meta/recipes-devtools/python/python-smartpm/channels-rpm_sys-use-md5sum-instead-of-mtime-as-the-.patch
new file mode 100644
index 0000000000..2f14a124ef
--- /dev/null
+++ b/meta/recipes-devtools/python/python-smartpm/channels-rpm_sys-use-md5sum-instead-of-mtime-as-the-.patch
@@ -0,0 +1,38 @@
+channels/rpm_sys: use md5sum instead of mtime as the digest
+
+Use the internal getFileDigest() function (which defaults to md5) instead of
+mtime for getting the file digest. On some systems mtime proved to be
+unreliable because of delayed update. This caused smart to miss rpm db updates
+and thus get its understanding of installed packages out of sync.
+
+Upstream-Status: Pending
+
+Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
+---
+ smart/channels/rpm_sys.py | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/smart/channels/rpm_sys.py b/smart/channels/rpm_sys.py
+index b9fda27..6f1fe94 100644
+--- a/smart/channels/rpm_sys.py
++++ b/smart/channels/rpm_sys.py
+@@ -22,6 +22,7 @@
+ from smart.backends.rpm.header import RPMDBLoader
+ from smart.backends.rpm.base import getTS, rpm_join_dbpath
+ from smart.channel import PackageChannel
++from smart.util.filetools import getFileDigest
+ from smart import *
+ import os
+
+@@ -35,7 +36,7 @@ class RPMSysChannel(PackageChannel):
+ dbdir = rpm_join_dbpath(sysconf.get("rpm-root", "/"),
+ sysconf.get("rpm-dbpath", "var/lib/rpm"))
+ path = os.path.join(dbdir, "Packages")
+- digest = os.path.getmtime(path)
++ digest = getFileDigest(path)
+ if digest == self._digest:
+ return True
+ self.removeLoaders()
+--
+2.6.6
+
diff --git a/meta/recipes-devtools/python/python-smartpm_git.bb b/meta/recipes-devtools/python/python-smartpm_git.bb
index 0c260482df..861910cc29 100644
--- a/meta/recipes-devtools/python/python-smartpm_git.bb
+++ b/meta/recipes-devtools/python/python-smartpm_git.bb
@@ -26,6 +26,7 @@ SRC_URI = "\
file://smart-locale.patch \
file://smartpm-rpm5-support-check-signatures.patch \
file://smart-add-deugging-when-targetpath-is-empty.patch \
+ file://channels-rpm_sys-use-md5sum-instead-of-mtime-as-the-.patch \
"
SRCREV = "407a7eca766431257dcd1da15175cc36a1bb22d0"