Gentoo Archives: gentoo-dev

From: Kent Fredric <kentnl@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] Revision bumps vs git commits atomicity
Date: Sat, 03 Dec 2016 16:20:35
Message-Id: 20161204052001.742ac24b@katipo2.lan
In Reply to: Re: [gentoo-dev] Revision bumps vs git commits atomicity by Markos Chandras
1 On Sat, 3 Dec 2016 15:06:36 +0000
2 Markos Chandras <hwoarang@g.o> wrote:
3
4 > That's reasonable but I also think that bumping and fixing an ebuild at
5 > the same time can be considered an atomic change since it's effectively
6 > a _new_ ebuild
7
8 One problem is that can seriously confuse git about what's happening,
9 given how similar our ebuilds are, and given gits only mechanism
10 for determining "rename" is
11
12 + filename/a 0xSHA1
13 - filename/b 0xSHA1
14
15 If "filename/a" is sufficiently different from "filename/b" and close enough
16 to some other non-target "filename/c", it could retroactively be confused into
17 thinking this happened.
18
19 copy filename/c -> filename/a (98%)
20 remove filename/b
21
22 And then you go and rebase that somewhere were filename/c was actually modified,
23 and filename/b was modified, and you end up with merge conflicts
24 where git propagates changes from filename/c to filename/a
25 and then makes you battle with "modified filename/b vs removed filename/b"
26
27 This is why I prefer to take the approach of:
28
29 1. Fix everything first.
30 2. -r1 bump in a dedicated (or commits) at the end.
31
32 Then git tends to be smarter about things, and realises the change in the ebuild
33 was applied to a moved file, and attempts to modify the moved file instead,
34 and the only headaches are the -r bumps themselves, and git itself is *usually*
35 more disposed to getting these right.
36
37 But uh.
38
39 Don't look at what github likes to do:
40
41 https://github.com/gentoo/gentoo/pull/2956/commits/52da7b3a525ff1c4f4e1ad73fe9e0ab91cf6e799
42
43 ..rl-JSON-PP/perl-JSON-PP-2.273.0-r3.ebuild → ...ive-Tar/perl-Archive-Tar-2.40.0-r4.ebuild
44 ..ocale-Maketext-Simple-0.210.100_rc.ebuild → ...ar/perl-Archive-Tar-2.40.100_rc-r1.ebuild
45 ..ive-Tar/perl-Archive-Tar-2.40.0-r3.ebuild → ...rl-JSON-PP/perl-JSON-PP-2.273.0-r4.ebuild
46 ..e-Tar/perl-Archive-Tar-2.40.100_rc.ebuild → ...le-Maketext-Simple-0.210.100_rc-r1.ebuild
47
48 Its totally understandable why it gets confused:
49
50 md5sum perl-Archive-Tar/perl-Archive-Tar-2.40.0-r4.ebuild \
51 perl-Archive-Tar/perl-Archive-Tar-2.40.100_rc-r1.ebuild \
52 perl-JSON-PP/perl-JSON-PP-2.273.0-r4.ebuild \
53 perl-Locale-Maketext-Simple/perl-Locale-Maketext-Simple-0.210.100_rc-r1.ebuild
54
55 1fe782df38a2c2cc01615012b9915da9 perl-Archive-Tar/perl-Archive-Tar-2.40.0-r4.ebuild
56 5102f6ac13ac331465c64258d8f413c5 perl-Archive-Tar/perl-Archive-Tar-2.40.100_rc-r1.ebuild
57 1fe782df38a2c2cc01615012b9915da9 perl-JSON-PP/perl-JSON-PP-2.273.0-r4.ebuild
58 5102f6ac13ac331465c64258d8f413c5 perl-Locale-Maketext-Simple/perl-Locale-Maketext-Simple-0.210.100_rc-r1.ebuild
59
60
61 Rationale: most users are working from rsync. So for them, the -r step is mostly a "propagate this change" mechansim.
62 These users are unlikely to see the intermediate stage where you modified the file before the -r bump, because the -r bump
63 was pushed atomically with the rest.
64
65 People who clone from git are also not typically "winding back" the head, and so they'll get their -r bumps atomically
66 with the changes when they pull.
67
68 People who *are* winding back the head are likely winding back to a specific moment in the history:
69
70 1. If they're winding back to before your commit series, then it doesn't matter
71 2. If they're winding back to after your commit series, then they have the needed -r bump
72 3. If they're winding back to some point within the commit series, things may be a little hairy. ( and maybe this is where
73 the "-r bump first" strategy is more useful? )
74
75 But then it depends what they're rewinding *For*
76
77 (prebumping) If they were trying to avoid the change you made after you -r bumped, rewinding to before the change won't trip portage updates.
78 (postbumping) If they were meaning to include the change you made before you -r bumped, rewinding to after the change won't trip portage updates.
79
80 It seems in either case, post/pre bumping to within the change set will have an edge case somewhere
81 where a user has to be assumed to explicitly tell portage to reinstall the target package instead of relying
82 on -r bumps to propagate it.