Gentoo Archives: gentoo-dev

From: "Rick \\\"Zero_Chaos\\\" Farina" <zerochaos@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] git-r3: initial draft for review
Date: Sat, 31 Aug 2013 05:45:40
Message-Id: 52218340.4020408@gentoo.org
In Reply to: [gentoo-dev] git-r3: initial draft for review by "Michał Górny"
1 -----BEGIN PGP SIGNED MESSAGE-----
2 Hash: SHA1
3
4 On 08/30/2013 07:37 PM, Michał Górny wrote:
5 > Hello, all.
6 >
7 > After a few days of thinking, discovering and working, here it is.
8 > The first working draft of new git eclass codenamed 'git-r3'.
9 >
10 > First of all, the name is not final. I'm open to ideas. I'm open to
11 > naming it 'git-r1' to put it in line with my other -r1 eclasses :).
12 > I'd definitely like to avoid 'git-3' though, since that version-like
13 > naming was a mistake as almost-'python-2' eclass shown.
14 >
15 Seems to be a lot of schizophrenia in versioning here. I can honestly
16 tell you that git-2 is greater than git-r3, so I really caution against
17 this.
18
19 > Secondly, it's not even final that there will be a new eclass. Most
20 > likely I will commit it as a new eclass since that way is easier for us
21 > but if you prefer I may try to get it and git-2 more API-friendly
22 > and work on making it a almost-drop-in replacement. Since, after all,
23 > internals have actually changed much more than the API.
24 >
25 >
26 > And now for the major changes:
27 >
28 > 1. The code has been split into clean 'fetch' and 'checkout' pieces.
29 >
30 > That is, it is suited for distinct src_fetch() and src_unpack() phases
31 > that we'll hopefully have in EAPI 6. What's important, the checkout
32 > code does not rely on passing *any* environment variables from fetching
33 > code. It is also made with concurrency in mind, so multiple ebuilds
34 > using the same repository at the same time shouldn't be a problem.
35 >
36 > 2. Public fetch/checkout API.
37 >
38 > git-2 has a lot of private functions and just src_unpack(). git-r3 has
39 > git-r3_fetch() and git-r3_checkout() which are public API intended to
40 > used in ebuilds that need more than plain fetch+unpack. While this
41 > isn't exactly what multi-repo support pursuers wanted, it should make
42 > supporting multiple repos in one ebuild much cleaner.
43 >
44 > 3. Clean submodule support with bare clones.
45 >
46 > Since the submodules are very straightforward in design, I have decided
47 > to move their support into the eclass directly. As a result, the new
48 > eclass cleanly supports submodules, treating them as additional
49 > repositories and doing submodule fetch/checkout recursively. There is
50 > no need for non-bare clones anymore (and therefore their support has
51 > been removed to make code simpler), and submodules work fine with
52 > EVCS_OFFLINE=1.
53 >
54 > 4. 'Best-effort' shallow clones support.
55 >
56 > I did my best to support shallow clones in the eclass. The code is
57 > specifically designed to handle them whenever possible. However, since
58 > shallow clones have a few limitations:
59 >
60 > a) only branch/tag-based fetches support shallow clones. Fetching by
61 > commit id forces complete clone (this is what submodules do BTW).
62 >
63 > b) there's EGIT_NONSHALLOW option for users who prefer to have full
64 > clones, and possibly for ebuilds that fail with shallow clones.
65 >
66 > c) if shallow clones cause even more trouble than that, I will simply
67 > remove their support from the eclass :).
68 >
69 > [see notes about testing at the end]
70 >
71 > 5. Safer default EGIT_DIR choice. EGIT_PROJECT removed.
72 >
73 > Since submodules are cloned as separate repositories as well, we can't
74 > afford having EGIT_PROJECT to change the clone dir. Instead, the eclass
75 > uses full path from first repo URI (with some preprocessing) to
76 > determine the clone location. This should ensure non-colliding clones
77 > with most likeliness that two ebuilds using the same repo will use
78 > the same clone without any special effort from the maintainer.
79 >
80 > 6. Safer default checkout dir. EGIT_SOURCEDIR removed.
81 >
82 > git-2 used to default EGIT_SOURCEDIR=${S}. This kinda sucked since if
83 > one wanted to use subdirectory of the git repo, he needed to both set
84 > EGIT_SOURCEDIR and S. Now, the checkout is done to ${WORKDIR}/${P}
85 > by default and ebuilds can safely do S=${WORKDIR}/${P}/foo. I may
86 > provide EGIT_SOURCEDIR if someone still finds it useful.
87
88 Thank you so much. I've wanted to do this forever.
89 >
90 >
91 > API/variables removed:
92 >
93 > 1. EGIT_SOURCEDIR:
94 >
95 > a) if you need it for multiple repos, use the fetch/checkout functions
96 > instead,
97 >
98 > b) otherwise, play with S instead,
99 >
100 > c) if you really need it, lemme know and I'll put it back.
101 >
102 > 2. EGIT_HAS_SUBMODULES -> no longer necessary, we autodetect them
103 > (and we don't need that much special magic like we used to).
104 >
105 > 3. EGIT_OPTIONS -> interfered too much with eclass internals.
106 >
107 > 4. EGIT_MASTER -> people misused it all the time, and it caused issues
108 > for projects that used different default branch. Now we just respect
109 > upstream's default branch.
110 >
111 > 5. EGIT_PROJECT -> should be no longer necessary.
112 >
113 How so?
114
115 Thanks,
116 Zero
117
118 > 6. EGIT_DIR -> still exported, but no longer respects user setting it.
119 >
120 > 7. EGIT_REPACK, EGIT_PRUNE -> I will probably reintroduce it, or just
121 > provide the ability to set git auto-cleanup options.
122 >
123 > 8. EGIT_NONBARE -> only bare clones are supported now.
124 >
125 > 9. EGIT_NOUNPACK -> git-2 is only eclass calling the default. Does
126 > anyone actually need this? Is adding custom src_unpack() that hard?
127 >
128 > 10. EGIT_BOOTSTRAP -> this really belongs in *your* src_prepare().
129 >
130 >
131 > I've tested the eclass on 113 live packages I'm using. Most of them
132 > work just fine (I've replaced git-2 with the new eclass). Some
133 > of them only require removing the old variables, some need having S
134 > changed. However, I noticed the following issues as well:
135 >
136 > 1. code.google fails with 500 when trying to do a shallow clone
137 > (probably they implemented their own dumb git server),
138 >
139 > 2. sys-apps/portage wants to play with 'git log' for ChangeLogs. That's
140 > something that definitely is not going to work with shallow clones ;).
141 > Not that I understand why someone would like a few megs of detailed git
142 > backlog.
143 >
144 > 3. sys-fs/bedup's btrfs-progs submodule says the given commit id is
145 > 'not a valid branch point'. Need to investigate what this means.
146 >
147 > 4. 'git fetch --depth 1' seems to be refetching stuff even when nothing
148 > changed. Need to investigate it. It may be enough to do an additional
149 > 'did anything change?' check.
150 >
151 >
152 > I will try to look into those issues tomorrow. In the meantime, please
153 > review this eclass and give me your thoughts. Especially if someone has
154 > some more insight on shallow clones. Thanks.
155 >
156 > And a fun fact: LLVM subversion checkout (in svn-src) has around ~2.4k
157 > files which consume around 220M on btrfs. LLVM git shallow clone takes
158 > 17M.
159 >
160
161 -----BEGIN PGP SIGNATURE-----
162 Version: GnuPG v2.0.20 (GNU/Linux)
163 Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
164
165 iQIcBAEBAgAGBQJSIYNAAAoJEKXdFCfdEflKBdoP/Ru+/12Ypn6lg0h55tI14uiX
166 xzoev+DN1KK19oMiYZxZL4zkiCp9/YSvTSKEcVpokzYIxQyWU+stJ6uLQYFsxovh
167 lSP+9pOlMikS0xdjDudFjRcS0GMhZjGytrk/4IYmALxRnuKtAVM7XzEZe6vba4Vm
168 EJ4CSOCRoA4X0Kh49lSn/LhONUfm9PBrTQVkmOYSNZzPOue9WUP5ppIc7212w0x2
169 +67lq5hxR3LJItpDgX++sOErlDCF9O+eZe+j2JHklsHMYsKJPdScY3Xad9QBRXGa
170 rpymloDg5MMe7c079H59nCIRC7O5StXRZmiR6skdZDz/gMHMEZ15saQDYM2i3x/A
171 obbbjINl7MuW576YeHhfGzQhzYf4+41PuGSIyJaHQ7fuvL3l4jWbhYngcVP2WYBi
172 xudVKQei0eW7W2m5dGAeLD6IDC35PnxUvoWc69iRgDpn6OADkZ/bx4XD3Dx2Rqb9
173 6tkU4g9zIrlOG+ywlGzlBpDjKctC9AhBqh5SUJuM3WMGUfPUcTYfx+ENblfvTRAT
174 iz0gJJu62CumioMAx9aQGe3Dnr0f8m5COsPs79WmP+3g8Pm0LwswMx3agQEM5QWV
175 QFBh0189DNfwHR6GVt03EfxYUZx8Mm7uz+QyNfMJY/2fFPmJnqN4VctegWUn/FYw
176 8h0JTHjBC2dIAZwoQCvN
177 =1ESQ
178 -----END PGP SIGNATURE-----

Replies

Subject Author
Re: [gentoo-dev] git-r3: initial draft for review "Michał Górny" <mgorny@g.o>