Gentoo Archives: gentoo-portage-dev

From: Roman Gaufman <hackeron@×××××××××.com>
To: gentoo-portage-dev@l.g.o
Subject: [gentoo-portage-dev] Downloading while compiling - FETCHCOMMAND inside.
Date: Mon, 29 Mar 2004 14:38:47
Message-Id: 200403291439.05887.hackeron@dsl.pipex.com
In Reply to: Re: [gentoo-portage-dev] emerge feature request: Downloads managed by lock file system by Roman Gaufman
1 This fetchcommand will make sure portage doesn't download file simulatneously
2 if you emerge -f package and emerge package in another terminal, it will make
3 it wait for package to finish download.
4
5 I improved it a little. Now if download fails (e.g. file not found), it wont
6 freeze portage and will carry on, enjoy:
7
8 FETCHCOMMAND="(
9 while [ -e \${DISTDIR}/`basename \${URI}`.lock ]; do
10 sleep 5; done &&
11 if [ ! -e \${DISTDIR}/`basename \${URI}` ]; then
12 /usr/bin/wget -t 5 --passive-ftp \${URI} -O \${DISTDIR}/`basename
13 \${URI}`.lock &&
14 mv \${DISTDIR}/`basename \${URI}`.lock \${DISTDIR}/`basename \${URI}` ||
15 rm \${DISTDIR}/`basename \${URI}`.lock; fi
16 )"
17
18 Please help test. And suggest a solution to remove lock file if user ctrl+c
19 out of the wget.
20
21 On Sunday 28 March 2004 00:21, Roman Gaufman wrote:
22 > I'm no coder, but I wrote a little fetchcommand for this based on
23 > suggestions by Sven:
24 >
25 > FETCHCOMMAND="(
26 > while [ -e \${DISTDIR}/`basename \${URI}`.lock ]; do
27 > sleep 5; done &&
28 > if [ ! -e \${DISTDIR}/`basename \${URI}` ]; then
29 > wget -t 5 --passive-ftp \${URI} -O \${DISTDIR}/`basename \${URI}`.lock &&
30 > mv \${DISTDIR}/`basename \${URI}`.lock \${DISTDIR}/`basename \${URI}`; fi
31 > )"
32 >
33 > suggestions, modifications are welcome.
34 >
35 > On Sunday 08 February 2004 00:59, Thomas Horsten wrote:
36 > > On Saturday 07 February 2004 22:07, Jeff Smelser wrote:
37 > > > On Saturday 07 February 2004 11:17 am, Sven Vermeulen wrote:
38 > > > > A quick 'n dirty hack in the FETCHCOMMAND should suffice. Something
39 > > > > along the lines of (pseudocode):
40 > > > >
41 > > > > FETCHCOMMAND="if exists \${DISTDIR}/`basename \${URL}.lck`; then
42 > > > > skip; else \ touch \${DISTDIR}/`basename \${URL}.lck`; \
43 > > > > /usr/bin/wget ...; \
44 > > > > rm \${DISTDIR}/`basename \${URL}.lck`; fi"
45 > > >
46 > > > I tried this, and got:
47 > > >[..] Errors
48 > >
49 > > Notice that Sven said it's pseudocode, just to describe the concept. It's
50 > > incomplete, and has an invalid syntax. For example, "if exists ..."
51 > > should be "if [ -e ...]" to be proper sh code.
52 > >
53 > > The real thing would be a bit more complex.
54 > >
55 > > // Thomas
56 > >
57 > >
58 > > --
59 > > gentoo-portage-dev@g.o mailing list
60 >
61 > --
62 > gentoo-portage-dev@g.o mailing list
63
64 --
65 gentoo-portage-dev@g.o mailing list

Replies