Gentoo Archives: gentoo-user

From: Alan McKinnon <alan.mckinnon@×××××.com>
To: gentoo-user@l.g.o
Cc: "Fatih Tümen" <fthtmn+gentoo@×××××.com>
Subject: Re: [gentoo-user] emerge --buildpkg --unmerge
Date: Fri, 29 Oct 2010 19:54:32
Message-Id: 201010292154.57429.alan.mckinnon@gmail.com
In Reply to: Re: [gentoo-user] emerge --buildpkg --unmerge by "Fatih Tümen"
1 Apparently, though unproven, at 21:26 on Friday 29 October 2010, Fatih Tümen
2 did opine thusly:
3
4 > On Fri, Oct 29, 2010 at 21:18, Alan McKinnon <alan.mckinnon@×××××.com>
5 wrote:
6 > > Apparently, though unproven, at 18:46 on Friday 29 October 2010, Fatih
7 > > Tümen
8 > >
9 > > did opine thusly:
10 > >> Hi,
11 > >>
12 > >> Is there a way tell portage to build binary package before removing it
13 > >> from the system?
14 > >>
15 > >> man emerge says:
16 > >> --buildpkg (-b)
17 > >> Tells emerge to build binary packages for all ebuilds
18 > >> processed in addition to actually **merging** the packages.
19 > >> [...]
20 > >> An alternative for already-merged packages is to use
21 > >> quickpkg(1) which creates a tbz2 from the live filesystem.
22 > >>
23 > >> I have about 20 packages to unmerge or remerge with new use flags. But
24 > >> I want to keep binary copies (with old use settings) before unmerging
25 > >> them. Unfortunately I did not have buildpkg in FEATURES at the time of
26 > >> emerging them. Doing this now by hand sounds kinda fatigue unless...
27 > >> the output of --pretend was parsable so I do what I want by..
28 > >>
29 > >> for pkg in ${PKGS}; do quickpkg --include-config\=y $pkg; done
30 > >>
31 > >> or by something better?
32 > >>
33 > >> Thanks for ideas in advance.
34 > >> --
35 > >> Fatih
36 > >
37 > > Write a wrapper script around quickpkg and emerge.
38 > >
39 > > And set buildpkg in FEATURES so this doesn't happen again :-)
40 >
41 > 'wrapper' rang the bell. Thanks.
42 >
43 > The only one I recalled was post_src_install from lafilefixer thing.
44 > So I grepped /usr/lib/portage/ for it and found the list of others at
45 > /usr/lib/portage/bin/isolated-functions.sh +521 and wrote this inside
46 > /etc/portage/bashrc
47 >
48 > pkg_prerm() {
49 > echo ">>> Building binary package before unmerging ;)"
50 > if [[ -f /var/db/.pkg.portage_lockfile ]]; then
51 > rm -f /var/db/.pkg.portage_lockfile #2>/dev/null
52 > fi
53 > quickpkg --include-config\=y "=$CATEGORY/$P"
54 > touch /var/db/.pkg.portage_lockfile
55 > }
56
57
58 It didn't occur to me to do it that way :-)
59
60 But it's actually a fine idea, and the way you are supposed to do it by
61 design. Maybe next time I'll remember what those hooks are for :-)
62
63
64
65
66 --
67 alan dot mckinnon at gmail dot com