Gentoo Archives: gentoo-dev

From: Kent Fredric <kentnl@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] Re: Can pkg_nofetch determine if a file is already downloaded?
Date: Thu, 18 Oct 2018 13:35:27
Message-Id: 20181019023422.2bad55a2@katipo2.lan
In Reply to: Re: [gentoo-dev] Re: Can pkg_nofetch determine if a file is already downloaded? by "Michał Górny"
1 On Wed, 17 Oct 2018 16:14:37 +0000
2 Michał Górny <mgorny@g.o> wrote:
3
4 > Dnia October 17, 2018 4:03:17 PM UTC, Michael Haubenwallner <haubi@g.o> napisał(a):
5 > >On 10/15/2018 08:05 PM, Michał Górny wrote:
6 > >> On Mon, 2018-10-15 at 13:34 +0200, Michael Haubenwallner wrote:
7 > >>> Hi,
8 > >>>
9 > >>> in pkg_nofetch, beyond to "direct the user to download relevant
10 > >source files",
11 > >>> I've found it useful to tell the user which filesystem directory to
12 > >put the
13 > >>> files into once downloaded.
14 > >>>
15 > >>> Beyond that, I've also found it useful to tell the user whether a
16 > >relevant
17 > >>> source file is 'already there' or 'still missing'.
18 > >>>
19 > >>> Since the EAPI 6 related update to pkg_* phases to not have access
20 > >to DISTDIR
21 > >>> (even in earlier EAPI) any more, I'm wondering if both informations
22 > >are still
23 > >>> available to pkg_nofetch in one or another way.
24 > >>>
25 > >>> Any idea?
26 > >>>
27 > >>> Or is my only option to reduce the information to "all these files
28 > >need to be
29 > >>> put in your DISTDIR", requiring the user to find out both the right
30 > >DISTDIR
31 > >>> and which of the listed files are still missing herself?
32 > >>>
33 > >>
34 > >> How would you know whether the file in DISTDIR is correct and
35 > >complete?
36 > >>
37 > >Well, pkg_nofetch is called only if some files are still missing,
38 > >so portage really should have checked them before, and eventually
39 > >renamed invalid files to "checksum_failure", no?
40 >
41 > Maybe. That's entirely undefined behavior.
42 >
43
44
45 Does the construction of the shadow dir happen before checksum etc
46 validation? Or does it happen afterwards?
47
48 One option would potentially be to only create entries in the shadow
49 dir if they're verified to be complete as per Manifest.
50
51 Then a simple -e test is all that's needed to know if its downloaded
52 yet. ( But PMS will need to stipulate which phases -e tests should be
53 able to check this )
54
55 Outside that, perhaps a future EAPI could have a function for this
56 purpose, where the function is defined to only return a true value if
57 the distfile exists *and* is Manifestly correct ( doing on-demand
58 verification and possibly caching it )