commit:     394c245a4ecbce18ab580228311f3f6023727727
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sun Jan  5 13:25:46 2020 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Sun Jan  5 13:27:50 2020 +0000
URL:        https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=394c245a

Revert "libq/tree: ignore Packages file when seemingly outdated"

A surprisingly bad idea.  Since Packages is a member of the dir we're
looking at to compare, it's never going to have newer or equal mtime.

This reverts commit 8b4086e7e32e3e548929fa532056a65188f8def8.

Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>

 TODO.md     |  1 +
 libq/tree.c | 18 ++----------------
 2 files changed, 3 insertions(+), 16 deletions(-)

diff --git a/TODO.md b/TODO.md
index f6326b8..fe74cab 100644
--- a/TODO.md
+++ b/TODO.md
@@ -15,6 +15,7 @@
 - parse package.accept\_keywords such that we can provide the latest
   "available" version like Portage
 - check timestamps in libq/tree for choosing which method to take:
+       - ignore Packages when it is older than the last directory change
        - ignore metadata when ebuild is modified
        - add some method to skip these checks and assume everything is right
 - add interface to retrieve a list/set of atoms from a tree

diff --git a/libq/tree.c b/libq/tree.c
index 976f166..49b2fa1 100644
--- a/libq/tree.c
+++ b/libq/tree.c
@@ -133,25 +133,11 @@ tree_open_binpkg(const char *sroot, const char *spkg)
        char buf[_Q_PATH_MAX];
 
        if (ret != NULL) {
-               struct stat st;
-               struct timespec pkgstim;
-
                ret->cachetype = CACHE_BINPKGS;
 
                snprintf(buf, sizeof(buf), "%s%s/%s", sroot, spkg, 
binpkg_packages);
-               if (eat_file(buf, &ret->pkgs, &ret->pkgslen)) {
-                       if (stat(buf, &st) == 0)
-                               memcpy(&pkgstim, &st.st_mtim, 
sizeof(st.st_mtim));
-                       else
-                               memset(&pkgstim, 0, sizeof(pkgstim));
-
-                       /* if the Packages file seems outdated, don't trust/use 
it */
-                       if (fstat(ret->tree_fd, &st) != 0 ||
-                                       st.st_mtim.tv_sec < pkgstim.tv_sec ||  
/* impossible? */
-                                       (st.st_mtim.tv_sec == pkgstim.tv_sec &&
-                                        st.st_mtim.tv_nsec <= pkgstim.tv_nsec))
-                               ret->cachetype = CACHE_PACKAGES;
-               }
+               if (eat_file(buf, &ret->pkgs, &ret->pkgslen))
+                       ret->cachetype = CACHE_PACKAGES;
        }
 
        return ret;

Reply via email to