1 |
Donnie Berkholz wrote: |
2 |
> I don't remember this going by gentoo-dev. Always send eclasses to |
3 |
> gentoo-dev before committing them. |
4 |
|
5 |
My apologies, I was just so excited that I'd finally finished it! |
6 |
|
7 |
Apparently I missed a few things, thanks very much for catching |
8 |
it. |
9 |
|
10 |
> > 0install_native_feed() { |
11 |
> > local src="${1}"; shift |
12 |
> > local path="${1}"; shift |
13 |
> |
14 |
> This is a rather strange paradigm to me, instead of: |
15 |
> |
16 |
> local src=$1 path=$2 |
17 |
> shift 2 |
18 |
|
19 |
This is cleaner, thanks. In fact, I don't even really need the |
20 |
shift at all. |
21 |
|
22 |
> > local feedfile=$(basename "${src}") |
23 |
> |
24 |
> You could do this in pure bash, although it doesn't really matter: |
25 |
> |
26 |
> local feedfile=${src##*/} |
27 |
|
28 |
Sure, may as well, save a subshell. |
29 |
|
30 |
> > local dest="${path}/$feedfile" |
31 |
> |
32 |
> How do you decide when not to use braces { } around variables? |
33 |
|
34 |
In general I've used them everywhere... except there :) Fixed. |
35 |
|
36 |
> > 0distutils "${src}" > tmp.native_feed || die "0distutils feed edit failed" |
37 |
> > |
38 |
> > if [[ ${ZEROINSTALL_STRIP_REQUIRES} ]]; then |
39 |
> > # Strip out all 'requires' sections |
40 |
> > sed -i -e '/<requires.*\/>/d' \ |
41 |
> > -e '/<requires.*\>/,/<\/requires>/d' tmp.native_feed |
42 |
> |
43 |
> What happens if the contents of a <requires> section are on a separate |
44 |
> line? Is this a concern? |
45 |
|
46 |
It hasn't been so far - The convention in all known cases is |
47 |
either it's all on one line, or a multi-line as is caught by the |
48 |
second sed expression. This is just a stopgap measure until I |
49 |
rework 0distutils to do this optional stripping on its own. |
50 |
|
51 |
> > local feedname |
52 |
> |
53 |
> You could just declare feedname local and set it in the same line. |
54 |
|
55 |
Not if I want to potentially die on the assignment. As I found |
56 |
out in #gentoo-dev-help today, try this: |
57 |
|
58 |
$ t() { local a=$(false) || echo "Die"; }; t |
59 |
|
60 |
Versus this: |
61 |
|
62 |
$ t() { local a; a=$(false) || echo "Die"; }; t |
63 |
Die |
64 |
|
65 |
> > feedname=$(0distutils -e "${src}") || "0distutils URI escape failed" |
66 |
> |
67 |
> What's the || doing? You've got a string sitting there. Is 'die' |
68 |
> missing? |
69 |
|
70 |
Verily - nice catch! |
71 |
|
72 |
> > if ! $installed; then |
73 |
> |
74 |
> This is kind of a weird way to do it. I'd check instead for |
75 |
> [[ -n ${installed} ]] and initialize it to empty. |
76 |
|
77 |
Sure, that looks nicer. |
78 |
|
79 |
I'll be committing these changes right away, since the "die" ones |
80 |
at least are very important. But I'll be submitting further |
81 |
changes to the list first. Sorry about that :) |
82 |
|
83 |
Luckily only 1 ebuild so far which uses this eclass has actually |
84 |
hit the tree! |
85 |
|
86 |
-- |
87 |
Jim Ramsay |
88 |
Gentoo/Linux Developer (rox/fluxbox/gkrellm) |