* [PATCH] python-smartpm: use md5 as the digest for rpm_sys channel
@ 2016-09-13 20:26 Markus Lehtonen
0 siblings, 0 replies; only message in thread
From: Markus Lehtonen @ 2016-09-13 20:26 UTC (permalink / raw)
To: openembedded-core
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>
---
...m_sys-use-md5sum-instead-of-mtime-as-the-.patch | 33 ++++++++++++++++++++++
meta/recipes-devtools/python/python-smartpm_git.bb | 1 +
2 files changed, 34 insertions(+)
create mode 100644 meta/recipes-devtools/python/python-smartpm/channels-rpm_sys-use-md5sum-instead-of-mtime-as-the-.patch
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 0000000..00b1d2a
--- /dev/null
+++ b/meta/recipes-devtools/python/python-smartpm/channels-rpm_sys-use-md5sum-instead-of-mtime-as-the-.patch
@@ -0,0 +1,33 @@
+channels/rpm_sys: use md5sum instead of mtime as the digest
+
+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..ea7c8a7 100644
+--- a/smart/channels/rpm_sys.py
++++ b/smart/channels/rpm_sys.py
+@@ -24,6 +24,7 @@ from smart.backends.rpm.base import getTS, rpm_join_dbpath
+ from smart.channel import PackageChannel
+ from smart import *
+ import os
++import hashlib
+
+ class RPMSysChannel(PackageChannel):
+
+@@ -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 = hashlib.md5(open(path, 'rb').read()).hexdigest()
+ 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 0c26048..861910c 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"
--
2.6.6
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2016-09-13 20:26 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-13 20:26 [PATCH] python-smartpm: use md5 as the digest for rpm_sys channel Markus Lehtonen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox