Gentoo Archives: gentoo-commits

From: Fabian Groffen <grobian@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage-utils:master commit in: libq/, /
Date: Sun, 05 Jan 2020 13:28:10
Message-Id: 1578230870.394c245a4ecbce18ab580228311f3f6023727727.grobian@gentoo
1 commit: 394c245a4ecbce18ab580228311f3f6023727727
2 Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
3 AuthorDate: Sun Jan 5 13:25:46 2020 +0000
4 Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
5 CommitDate: Sun Jan 5 13:27:50 2020 +0000
6 URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=394c245a
7
8 Revert "libq/tree: ignore Packages file when seemingly outdated"
9
10 A surprisingly bad idea. Since Packages is a member of the dir we're
11 looking at to compare, it's never going to have newer or equal mtime.
12
13 This reverts commit 8b4086e7e32e3e548929fa532056a65188f8def8.
14
15 Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
16
17 TODO.md | 1 +
18 libq/tree.c | 18 ++----------------
19 2 files changed, 3 insertions(+), 16 deletions(-)
20
21 diff --git a/TODO.md b/TODO.md
22 index f6326b8..fe74cab 100644
23 --- a/TODO.md
24 +++ b/TODO.md
25 @@ -15,6 +15,7 @@
26 - parse package.accept\_keywords such that we can provide the latest
27 "available" version like Portage
28 - check timestamps in libq/tree for choosing which method to take:
29 + - ignore Packages when it is older than the last directory change
30 - ignore metadata when ebuild is modified
31 - add some method to skip these checks and assume everything is right
32 - add interface to retrieve a list/set of atoms from a tree
33
34 diff --git a/libq/tree.c b/libq/tree.c
35 index 976f166..49b2fa1 100644
36 --- a/libq/tree.c
37 +++ b/libq/tree.c
38 @@ -133,25 +133,11 @@ tree_open_binpkg(const char *sroot, const char *spkg)
39 char buf[_Q_PATH_MAX];
40
41 if (ret != NULL) {
42 - struct stat st;
43 - struct timespec pkgstim;
44 -
45 ret->cachetype = CACHE_BINPKGS;
46
47 snprintf(buf, sizeof(buf), "%s%s/%s", sroot, spkg, binpkg_packages);
48 - if (eat_file(buf, &ret->pkgs, &ret->pkgslen)) {
49 - if (stat(buf, &st) == 0)
50 - memcpy(&pkgstim, &st.st_mtim, sizeof(st.st_mtim));
51 - else
52 - memset(&pkgstim, 0, sizeof(pkgstim));
53 -
54 - /* if the Packages file seems outdated, don't trust/use it */
55 - if (fstat(ret->tree_fd, &st) != 0 ||
56 - st.st_mtim.tv_sec < pkgstim.tv_sec || /* impossible? */
57 - (st.st_mtim.tv_sec == pkgstim.tv_sec &&
58 - st.st_mtim.tv_nsec <= pkgstim.tv_nsec))
59 - ret->cachetype = CACHE_PACKAGES;
60 - }
61 + if (eat_file(buf, &ret->pkgs, &ret->pkgslen))
62 + ret->cachetype = CACHE_PACKAGES;
63 }
64
65 return ret;