opkg-utils: convert mtime to int before comparing it

Submitted by Enrico Scholz on Feb. 24, 2011, 12:12 a.m.

Details

Message ID 1298506369-3417-1-git-send-email-enrico.scholz@sigma-chemnitz.de
State Accepted
Headers show

Commit Message

Enrico Scholz Feb. 24, 2011, 12:12 a.m.
The st_mtime attribute (which is a float) is compared against a value
from the timestamp database, which was stored as an integer there.

When working on a filesystem with precise timestamps the comparision
will fail nearly everytime hence.

Although it might be possible to enhance the database to store the
fractional part too, this will complicate things more than we would
gain by this change.

This patch was applied as 49e11b32906fc1becd9218bb3125f6fc8fa03fa4 to
old ipkg-utils already.

Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
---
 recipes/opkg-utils/opkg-utils/mtime-int.patch |   27 +++++++++++++++++++++++++
 recipes/opkg-utils/opkg-utils_svn.bb          |    5 ++-
 2 files changed, 30 insertions(+), 2 deletions(-)
 create mode 100644 recipes/opkg-utils/opkg-utils/mtime-int.patch

Patch hide | download patch | download mbox

diff --git a/recipes/opkg-utils/opkg-utils/mtime-int.patch b/recipes/opkg-utils/opkg-utils/mtime-int.patch
new file mode 100644
index 0000000..efec3c0
--- /dev/null
+++ b/recipes/opkg-utils/opkg-utils/mtime-int.patch
@@ -0,0 +1,27 @@ 
+Convert mtime to int before comparing it
+
+The st_mtime attribute (which is a float) is compared against a value
+from the timestamp database, which was stored as an integer there.
+
+When working on a filesystem with precise timestamps the comparision
+will fail nearly everytime hence.
+
+Although it might be possible to enhance the database to store the
+fractional part too, this will complicate things more than we would
+gain by this change.
+
+Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
+
+Index: opkg-utils/opkg-make-index
+===================================================================
+--- opkg-utils.orig/opkg-make-index
++++ opkg-utils/opkg-make-index
+@@ -100,7 +100,7 @@ for filename in files:
+      pkg = None
+      fnameStat = os.stat(filename)
+      if old_pkg_hash.has_key(basename):
+-          if pkgsStamps.has_key(basename) and fnameStat.st_mtime == pkgsStamps[basename]:
++          if pkgsStamps.has_key(basename) and int(fnameStat.st_mtime) == pkgsStamps[basename]:
+             if (verbose):
+                sys.stderr.write("Found %s in Packages\n" % (filename,))
+             pkg = old_pkg_hash[basename]
diff --git a/recipes/opkg-utils/opkg-utils_svn.bb b/recipes/opkg-utils/opkg-utils_svn.bb
index 951580a..6b8d3ea 100644
--- a/recipes/opkg-utils/opkg-utils_svn.bb
+++ b/recipes/opkg-utils/opkg-utils_svn.bb
@@ -6,10 +6,11 @@  RDEPENDS_${PN} = "python"
 RDEPENDS_${PN}_virtclass-native = ""
 SRCREV = "4747"
 PV = "0.1.8+svnr${SRCPV}"
-PR = "r5"
+PR = "r6"
 
 SRC_URI = "svn://svn.openmoko.org/trunk/src/host/;module=opkg-utils;proto=http \
-           file://index-ignore-filenotfound.patch"
+           file://index-ignore-filenotfound.patch \
+           file://mtime-int.patch"
 
 S = "${WORKDIR}/opkg-utils"
 

Comments

Graham Gower Feb. 24, 2011, 1:38 a.m.
On 24 February 2011 10:42, Enrico Scholz
<enrico.scholz@sigma-chemnitz.de> wrote:
> The st_mtime attribute (which is a float) is compared against a value
> from the timestamp database, which was stored as an integer there.
>
> When working on a filesystem with precise timestamps the comparision
> will fail nearly everytime hence.
>
> Although it might be possible to enhance the database to store the
> fractional part too, this will complicate things more than we would
> gain by this change.
>
> This patch was applied as 49e11b32906fc1becd9218bb3125f6fc8fa03fa4 to
> old ipkg-utils already.

Have any of the other patches to ipkg-utils been missed?
http://cgit.openembedded.org/cgit.cgi/openembedded/tree/recipes/ipkg-utils/ipkg-utils?h=5bd4e2057db8d67139d49dcec1cb705329ac9041

>
> Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>

Acked-By: Graham Gower <graham.gower@gmail.com>