poldek: poldek/pkgdir/pkgdir_dirindex.c - bugfix: mtime of dirinde...

mis mis at pld-linux.org
Wed Aug 23 20:45:02 CEST 2006


Author: mis                          Date: Wed Aug 23 18:45:02 2006 GMT
Module: poldek                        Tag: HEAD
---- Log message:
- bugfix: mtime of dirindex should be the same as pkgdir one

---- Files affected:
poldek/poldek/pkgdir:
   pkgdir_dirindex.c (1.5 -> 1.6) 

---- Diffs:

================================================================
Index: poldek/poldek/pkgdir/pkgdir_dirindex.c
diff -u poldek/poldek/pkgdir/pkgdir_dirindex.c:1.5 poldek/poldek/pkgdir/pkgdir_dirindex.c:1.6
--- poldek/poldek/pkgdir/pkgdir_dirindex.c:1.5	Tue Aug 22 17:12:46 2006
+++ poldek/poldek/pkgdir/pkgdir_dirindex.c	Wed Aug 23 20:44:57 2006
@@ -27,6 +27,8 @@
 #include <fnmatch.h>
 #include <unistd.h>
 #include <sys/stat.h>
+#include <sys/types.h>
+#include <utime.h>
 
 #include <tndb/tndb.h>
 #include <trurl/nassert.h>
@@ -221,7 +223,7 @@
     
     MEMINF("START");
 
-    msgn(2, "Creating directory index of %s", pkgdir_idstr(pkgdir));
+    msgn(2, "Creating directory index of %s...", pkgdir_idstr(pkgdir));
 
     n_strdupap(path, &tmp);
     dir = n_dirname(tmp);
@@ -326,8 +328,13 @@
     mtime = poldek_util_mtime(path);
     n_assert(pkgdir->ts);
     
-    if (mtime == 0 || mtime < pkgdir->ts)
-        return do_pkgdir_dirindex_create(pkgdir, path);
+    if (mtime == 0 || mtime < pkgdir->ts) {
+        if (do_pkgdir_dirindex_create(pkgdir, path)) {
+            struct utimbuf ut;
+            ut.actime = ut.modtime = pkgdir->ts;
+            utime(path, &ut);
+        }
+    }
     
     return 1;
 }
@@ -416,7 +423,7 @@
         return NULL;
     
     dirindex_path(path, sizeof(path), pkgdir);
-    msgn(2, "Opening directory index of %s", pkgdir_idstr(pkgdir));
+    msgn(2, "Opening directory index of %s...", pkgdir_idstr(pkgdir));
     MEMINF("start");
     
     if ((db = tndb_open(path)) == NULL) {
@@ -560,9 +567,10 @@
     if (!tndb_get_str(dirindex->db, path, val, sizeof(val))) {
         return 0;
     }
-    DBGF("%s: FOUND\n", path);
     
     tl = tl_save = n_str_tokl_n(val, ":", &n);
+
+    DBGF("%s: FOUND %d %p\n", path, n, pkgs_ptr ? *pkgs_ptr : NULL);
     
     if (n) {
         if (pkgs_ptr)
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/poldek/poldek/pkgdir/pkgdir_dirindex.c?r1=1.5&r2=1.6&f=u



More information about the pld-cvs-commit mailing list