Gentoo Archives: gentoo-dev

From: Mike Frysinger <vapier@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] [PATCH eutils] Move remove_libtool_files() from autotools-utils for wider use.
Date: Thu, 31 May 2012 06:09:58
Message-Id: 201205310209.12438.vapier@gentoo.org
In Reply to: Re: [gentoo-dev] [PATCH eutils] Move remove_libtool_files() from autotools-utils for wider use. by "Michał Górny"
1 On Thursday 31 May 2012 01:46:41 Michał Górny wrote:
2 > On Wed, 30 May 2012 17:19:49 -0400 Mike Frysinger wrote:
3 > > On Monday 28 May 2012 03:58:56 Michał Górny wrote:
4 > > > +# @USAGE: [all]
5 > >
6 > > this is incorrect. the usage is:
7 > > <all | files to remove>
8 >
9 > No, it's perfectly valid. Moreover, it even explains what the function
10 > actually does rather than your imagination.
11
12 why are you so angry all the time ? try being less confrontational for once.
13
14 going from the usage:
15 remove_libtool_files [all]
16
17 that means this may be called in only two ways:
18 1) remove_libtool_files
19 2) remove_libtool_files all
20
21 yet, if you read the actual code, you'll see:
22 + [[ ${#} -le 1 ]] || die "Invalid number of args to ${FUNCNAME}()"
23 + if [[ ${#} -eq 1 ]]; then
24 + ...
25 + fi
26
27 that means if more than 1 argument is passed, no error is thrown. i thought
28 you were intending to parse $@ further on because of it (hence the suggestion
29 of updating the @USAGE), but it looks merely like your arg parsing is
30 incorrect and needs fixing. probably easiest by doing:
31 case $#:$1 in
32 0:'') ;;
33 1:all) removing_all=1 ;;
34 *) die "invalid usage" ;;
35 esac
36
37 > > although, since we don't call die or anything, we can pipeline it to
38 > > speed things up a bit:
39 > > pc_libs=( $(
40 > > tpc="${T}/.pc"
41 > > find "${D}" -name '*.pc' -type f | \
42 > > while read pc ; do
43 > > sed -e '/^Requires:/d' "${pc}" > "${tpc}"
44 > > $(tc-getPKG_CONFIG) --libs "${tpc}"
45 > > done | tr ' ' '\n' | sort -u | \
46 > > sed -n '/^-l/{s:^-l:lib:;s:$:.la:;p}'
47 > > rm -f "${tpc}"
48 > > ) )
49 >
50 > Could you remind me, please, what performance-critical use of this
51 > function does justify making it so harsh?
52
53 looks perfectly fine to me, and it has the bonus of working
54
55 > > > + rm -f "${archivefile}" || die
56 > >
57 > > `rm -f` almost never fails. in the edge cases where it does, you've
58 > > got bigger problems.
59 >
60 > And that problem is good enough to die here.
61
62 more like the system at large is going to be falling over independently
63 -mike

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies