Gentoo Archives: gentoo-dev

From: Mike Frysinger <vapier@g.o>
To: gentoo-dev@l.g.o
Cc: "Tomáš Chvátal" <scarabeus@g.o>
Subject: Re: [gentoo-dev] git-2.eclass final review
Date: Tue, 22 Mar 2011 23:09:53
Message-Id: AANLkTingeQcC+ZLw9G4W37-9pQ7rdAkmFsaRHDUcRvsj@mail.gmail.com
In Reply to: Re: [gentoo-dev] git-2.eclass final review by "Tomáš Chvátal"
1 2011/3/22 Tomáš Chvátal:
2 > Dne 22.3.2011 22:26, Mike Frysinger napsal(a):
3 >>> # @BLURB: This eclass provides functions for fetch and unpack git repositories
4 >>
5 >> fetching/unpacking
6 >
7 > Yarp fixed.
8
9 well, the fix broke the blurb. it has to be on one line.
10 # @BLURB: foo
11
12 > EGIT_BRANCH=${x:-${EGIT_BRANCH:=${EGIT_MASTER}}}
13 > EGIT_COMMIT=${x:-${EGIT_COMMIT:=${EGIT_BRANCH}}}
14
15 doesnt make much sense to use := ... it should be :-
16
17 > [[ "$#" -ne 1 ]] && die "${FUNCNAME}: requires 1 argument (path)"
18
19 quoting doesnt make much sense ... -ne compares an int, not a string
20
21 also, the error msg is a bit vague. it should say "... requires exactly 1 ..."
22
23 > pushd "${1}" &> /dev/null
24 > popd &> /dev/null
25
26 do you really want to silence errors ? normally people only send
27 stdout to /dev/null because of the echoed dirlist.
28
29 seems to come up in every func
30
31 > git submodule init || die "${FUNCNAME}: git submodule initialisation failed"
32 > git submodule sync "" die "${FUNCNAME}: git submodule sync failed"
33 > git submodule update || die "${FUNCNAME}: git submodule update failed"
34
35 the die strings are abit redundant ... when it fails, the output will
36 show "git submodule init || die", so people can easily figure out "the
37 git submodule init cmd failed"
38
39 > die "\"${EGIT_BOOTSTRAP}\" is not executable."
40
41 i find periods in die messages which are a single sentence to be
42 noise. but maybe that's just me.
43
44 > if [[ "${EGIT_COMMIT}" != "${EGIT_BRANCH}" ]]; then
45
46 quoting doesnt matter here since you're using [[...]]
47
48 seems to come up in a bunch of places
49
50 > local save_sandbox_write=${SANDBOX_WRITE}
51 > if [[ ! -d "${EGIT_STORE_DIR}" ]] ; then
52 > ...
53 > SANDBOX_WRITE=${save_sandbox_write}
54 > fi
55
56 might as well have the save done inside the if statement since that's
57 the only place it's used
58
59 > rsync -rlpgo . "${EGIT_SOURCEDIR}" \
60
61 this means you need to have DEPEND="net-misc/rsync". why not just use
62 `cp -pPR` instead ? i vaguely recall rsync being slower than a
63 straight cp too ... not much point of doing a rsync when the vast
64 majority of the time (all the time?) the destination is empty.
65
66 > git-2_initial_clone()
67 > git-2_update_repo()
68
69 shouldnt EGIT_REPO_URI_SELECTED be set to "" at the start ?
70
71 > for x in $(git branch |grep -v "* ${EGIT_MASTER}" |tr '\n' ' '); do
72
73 missing space after each pipe
74
75 > if [[ -n ${EGIT_BOOTSTRAP} ]] ; then
76 > if [[ -f ${EGIT_BOOTSTRAP} ]]; then
77
78 seems inconsistent in the whole file ... personally, i prefer the
79 space before the semicolon in if statements
80 -mike

Replies

Subject Author
[gentoo-dev] Re: git-2.eclass final review Ryan Hill <dirtyepic@g.o>
Re: [gentoo-dev] git-2.eclass final review "Tomáš Chvátal" <scarabeus@g.o>
Re: [gentoo-dev] git-2.eclass final review Marc Schiffbauer <marc@×××××××××××.net>