Gentoo Archives: gentoo-dev

From: "Tomáš Chvátal" <scarabeus@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] git-2.eclass final review
Date: Wed, 23 Mar 2011 00:46:13
Message-Id: 4D89420B.8010406@gentoo.org
In Reply to: Re: [gentoo-dev] git-2.eclass final review by Mike Frysinger
1 -----BEGIN PGP SIGNED MESSAGE-----
2 Hash: SHA1
3
4 Dne 23.3.2011 00:08, Mike Frysinger napsal(a):
5 > 2011/3/22 Tomáš Chvátal:
6 >> Dne 22.3.2011 22:26, Mike Frysinger napsal(a):
7 >>>> # @BLURB: This eclass provides functions for fetch and unpack git repositories
8 >>>
9 >>> fetching/unpacking
10 >>
11 >> Yarp fixed.
12 >
13 > well, the fix broke the blurb. it has to be on one line.
14 > # @BLURB: foo
15 Oh damn :P
16 >
17 >> EGIT_BRANCH=${x:-${EGIT_BRANCH:=${EGIT_MASTER}}}
18 >> EGIT_COMMIT=${x:-${EGIT_COMMIT:=${EGIT_BRANCH}}}
19 >
20 > doesnt make much sense to use := ... it should be :-
21 Yeah it should be but still it was just copy/paste and did no harm :)
22 Altered :)
23 >
24 >> [[ "$#" -ne 1 ]] && die "${FUNCNAME}: requires 1 argument (path)"
25 >
26 > quoting doesnt make much sense ... -ne compares an int, not a string
27 >
28 > also, the error msg is a bit vague. it should say "... requires exactly 1 ..."
29 Altered
30 >
31 >> pushd "${1}" &> /dev/null
32 >> popd &> /dev/null
33 >
34 > do you really want to silence errors ? normally people only send
35 > stdout to /dev/null because of the echoed dirlist.
36 >
37 > seems to come up in every func
38 Yeah that does not matter that much, altered to make stderr visible again.
39 >
40 >> git submodule init || die "${FUNCNAME}: git submodule initialisation failed"
41 >> git submodule sync "" die "${FUNCNAME}: git submodule sync failed"
42 >> git submodule update || die "${FUNCNAME}: git submodule update failed"
43 >
44 > the die strings are abit redundant ... when it fails, the output will
45 > show "git submodule init || die", so people can easily figure out "the
46 > git submodule init cmd failed"
47 Well mostly nobody reads die messages but right here it is pointless.
48 >
49 >> die "\"${EGIT_BOOTSTRAP}\" is not executable."
50 >
51 > i find periods in die messages which are a single sentence to be
52 > noise. but maybe that's just me.
53 Does not matter for me either. Since using both i will just stick
54 withoutdot for dies everywhere :)
55 >
56 >> if [[ "${EGIT_COMMIT}" != "${EGIT_BRANCH}" ]]; then
57 >
58 > quoting doesnt matter here since you're using [[...]]
59 >
60 > seems to come up in a bunch of places
61 Yeah overquoting is my favorite thing to do during the long and boring
62 evenings :) removed
63 >
64 >> local save_sandbox_write=${SANDBOX_WRITE}
65 >> if [[ ! -d "${EGIT_STORE_DIR}" ]] ; then
66 >> ...
67 >> SANDBOX_WRITE=${save_sandbox_write}
68 >> fi
69 >
70 > might as well have the save done inside the if statement since that's
71 > the only place it's used
72 >
73 I actualy can't find any good reason why that var is defined at all.
74 Removed the code.
75
76 >> rsync -rlpgo . "${EGIT_SOURCEDIR}" \
77 >
78 > this means you need to have DEPEND="net-misc/rsync". why not just use
79 > `cp -pPR` instead ? i vaguely recall rsync being slower than a
80 > straight cp too ... not much point of doing a rsync when the vast
81 > majority of the time (all the time?) the destination is empty.
82
83 Good question, i actualy dunno why i picked rsync back then instead of cp.
84 I would love to use git bare clones (damn submodules) and just use git
85 to move this crap around. cp -pPR should be equal so lets try with that
86 and see how much people whine around :)
87 >
88 >> git-2_initial_clone()
89 >> git-2_update_repo()
90 >
91 > shouldnt EGIT_REPO_URI_SELECTED be set to "" at the start ?
92 Why not :)
93 And found issue in die string because it said wrong variable there :)
94 >
95 >> for x in $(git branch |grep -v "* ${EGIT_MASTER}" |tr '\n' ' '); do
96 >
97 > missing space after each pipe
98 Added
99 >
100 >> if [[ -n ${EGIT_BOOTSTRAP} ]] ; then
101 >> if [[ -f ${EGIT_BOOTSTRAP} ]]; then
102 >
103 > seems inconsistent in the whole file ... personally, i prefer the
104 > space before the semicolon in if statements
105 Yerp i go with the later mostly but sometimes when i copy part statement
106 i get space into it. Unified.
107
108 Thanks for all the points :)
109
110 Again the diff is: http://tinyurl.com/62eb88b
111
112 Tom
113 -----BEGIN PGP SIGNATURE-----
114 Version: GnuPG v2.0.17 (GNU/Linux)
115 Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
116
117 iEYEARECAAYFAk2JQgsACgkQHB6c3gNBRYf79QCfV454YtzZD+2m7fOvFHvriDnf
118 0+4AnjnCA9oCwxPyzWsl8YzAI8ihXdm1
119 =qdu+
120 -----END PGP SIGNATURE-----

Replies

Subject Author
Re: [gentoo-dev] git-2.eclass final review Jeroen Roovers <jer@g.o>