Gentoo Archives: gentoo-portage-dev

From: Joakim Tjernlund <joakim.tjernlund@×××××××××.se>
To: "gentoo-portage-dev@l.g.o" <gentoo-portage-dev@l.g.o>
Subject: Re: [gentoo-portage-dev] Re: How to have several gentoo repos on one machine?
Date: Thu, 22 Oct 2015 11:59:13
Message-Id: 1445515146.31293.88.camel@transmode.se
In Reply to: [gentoo-portage-dev] Re: How to have several gentoo repos on one machine? by Duncan <1i5t5.duncan@cox.net>
1 On Thu, 2015-10-22 at 11:26 +0000, Duncan wrote:
2 > Joakim Tjernlund posted on Thu, 22 Oct 2015 06:48:06 +0000 as excerpted:
3 >
4 > > On Thu, 2015-10-22 at 02:29 +0000, Duncan wrote:
5 > > > Joakim Tjernlund posted on Wed, 21 Oct 2015 11:08:02 +0000 as
6 > > > excerpted:
7 > > >
8 > > > > I need to more than one gentoo repo in my computer.
9 >
10 >
11 > > > > this did not work as "portageq repositories_configuration /"
12 > > > > complains:
13 > > > > !!! Section 'tm-cusfpv3' in repos.conf has name different from
14 > > > > repository name 'gentoo' set inside repository
15 > > > >
16 > > > > I figured the name in repos.conf would just override
17 > > > > /usr/local/portage/tm-cusfpv3/profiles/repo_name ?
18 > > >
19 > > > While it's not quite clear to me either why you'd need two identical
20 > > > gentoo repos[...]
21 > >
22 > > I use one for my host and the other for cross building our products root
23 > > FS and they are not in sync. That rules out the aliases I guess?
24 >
25 > I think so, yes. However, as a user I'd really like to understand
26 > aliases, their purpose, and at high level how they work, and the current
27 > manpage doesn't help so much there. Without that I really don't know
28 > enough about aliases to say anything further.
29 >
30 > But meanwhile, I was sort of in your situation for awhile as I was
31 > building for my main amd64 system and in a 32-bit chroot for a 32-bit-
32 > only netbook, with a separate portage config for each, and while in my
33 > case they both pointed at the same gentoo repo and overlays using bind-
34 > mounts into the 32-bit chroot, without those bind-mounts it would have
35 > been two parallel and separate portage installations, one configured for
36 > 32-bit x86 in the chroot, one configured for amd64 outside the chroot.
37 >
38 > And that's what I'd use in your case, two separate portage installations,
39 > which could then of course have separate configs.
40
41 I don't need separate portage installations but I do need separate configs and
42 separate gentoo ebuild repos as the embedded target has a less frequent update
43 cycle and I want to be able to rebuild the exact same pkg at any time.
44
45 >
46 > That said, while I understand the principle of stability, and if it's
47 > private there shouldn't be legal issues, I still wonder at the idea. One
48 > of the reasons I could and did use bind-mounts and thus literally the
49 > same repos in my case, was that the gentoo repo is the gentoo repo, and
50 > other than the possibility of snapshotting it for archiving purposes (and
51 > of using one of those snapshots should it be needed, say because I left
52 > the netbook unupgraded for too long and it could no longer jump from the
53 > version on it to current), I considered the gentoo repo the gentoo repo,
54 > and a local copy that wasn't synced would no longer represent the present
55 > state of the gentoo repo.
56 >
57 > If I were to un-sync for other than very temporary recovery purposes, I'd
58 > thus want to call the repo something other than gentoo, since it would no
59 > longer represent the current state of the true gentoo repo.
60 >
61 > And if I made changes to that unsynced repo, say to stabilize it further
62 > (and if I wasn't doing so, what would be the purpose of keeping it
63 > unsynced for so long), that'd be even /more/ reason to call it something
64 > other than gentoo, because then it would no longer properly represent
65 > that state of the true gentoo repo at /any/ time.
66 >
67 > But having the git repo available changes the way that works
68 > dramatically, see below...
69 >
70 > > I don't plan on renaming anything in the repo_name file, it should just
71 > > be ignored and the name I have select in repos.conf should used.
72 > >
73 > > I don't see any value in repo_name file now that we have the new
74 > > repos.conf, possibly it could be a fallback only for PORTDIR users.
75 >
76 > The portage devs are welcome to contradict me if they like, but AFAIK, it
77 > still serves the useful purpose of double-checking that you don't for
78 > instance have two repos accidently syncing to the same place, and that
79 > the names used to refer to the repo stay consistent. (Again, part of the
80 > need for consistency would be due to the metadata and thus metadata cache
81 > being repo-specific, automatically invalidating the cache if the remote
82 > name and local name don't agree. Locally regenerating the metadata cache
83 > will go a long way to avoiding that problem, but it's an expensive
84 > operation that most users won't want to do, and keeping the names in sync
85 > helps avoid inadvertent cache invalidation.)
86
87 In any case, the use of repo_name must be the same for all tools, now emerge
88 and portageq are different.
89
90 >
91 > > > I actually use gentoo's git-based usersync
92 > > > repo on github, now, and thus don't rsync any repos all any more, here,
93 > > > and git of course has its git-ignore feature/files, which I use now.
94 > > > But I used rsync's exclude as suggested above, for years. Worked fine.
95 > > > =:^)
96 > >
97 > > Nice, I am heading the same was, using git all the way but I not there
98 > > yet.
99 > > One problem is that using git is disk space I think. Files are just
100 > > ignored but still present in the repo so syncing to our embedded target
101 > > will take a lot more space.
102 > > Any thoughts on that?
103 >
104 > Well, at least once your trailing target (presumably the embedded repo)
105 > is safely past the git repo's epoc (the date imported from cvs, for our
106 > purposes), git flexibility will let you checkout older versions on-
107 > demand, then checkout HEAD once again.
108 >
109 > In a scenario where both copies aren't likely to be used at once, you can
110 > use a single local git repo and just checkout the version of it you want
111 > dynamically.
112
113 Hmm, that is an good ide but for now I do want to keep them separate as
114 the host repo is managed by IT and the other is R&D and having to coordinate
115 this common repo with IT is not something I want ATM.
116
117 My space concerns are a bit different, currently I exclude lots of
118 categories from the embedded target, (No X11, games etc.) and I do
119 this using rsync exclude on the server side.
120
121 >
122 > In a concurrent-use scenario, there's a few ways you could go. What I'd
123 > probably do would be two git repos, one synced to gentoo-remote,
124 > presumably with full git history (or at least git history back to the
125 > other checkout), the other locally checked out from the "current" repo,
126 > at the checkout of interest.
127 >
128 > If you're doing this sort of thing then the sort of space the git repo
129 > takes up shouldn't be a big concern, but in case it is, it's worth noting
130 > that given the right filesystem and dedup tools, there will only actually
131 > be the one copy of "common" data on-storage, with each of those two git
132 > repos reflinking (think a lower-level hard-link) data that's common
133 > between them, which will be pretty much everything in the earlier one
134 > since the current one will have the earlier one as history.
135 >
136 > I'm a regular on the btrfs list, for instance, and on btrfs, a very space
137 > efficient solution would be to originally do an initial git checkout of
138 > the older, presumably embedded target repo, create a btrfs snapshot out
139 > of it, and then (in the working copy, not the snapshot) git-pull from the
140 > remote to update to current. The btrfs snapshot will have locked in
141 > place the older version in the snapshot, while the git pull in the
142 > working copy will create any new files, delete any remote-deleted ones
143 > (but they'll still be in the btrfs snapshot), reflink any old files, and
144 > reflink but then cow (copy-on-write) any updated files. For this
145 > scenario you wouldn't even need any additional dedup tools, tho if you
146 > had them, they'd probably save even more space (multiple versions of the
147 > same package often have very nearly the same ebuilds, for instance,
148 > differing in little more than name, and dedup would catch and dedup these
149 > as well, while the pure native btrfs snapshot method probably wouldn't).
150
151 We use BTRFS too :) this is the perfect FS for safe upgrades and rollback.
152 However, we create a btrfs snapshot and do the upgrades into the snapshot.
153 Once we a happy we set default subvolume to the snapshot and reboot.
154
155 We feel this is much safer than upgrading into the running system, much can go
156 wrong halfway through an upgrade and our systems sits in the bush somewhere.
157 Even if the upgrade goes well, you may end up with a system you cannot login to
158 if pam was upgraded until you reboot.
159
160 Jocke