On Fri, Oct 29, 2010 at 21:18, Alan McKinnon <[email protected]> wrote:
> Apparently, though unproven, at 18:46 on Friday 29 October 2010, Fatih Tümen
> did opine thusly:
>
>> Hi,
>>
>> Is there a way tell portage to build binary package before removing it
>> from the system?
>>
>> man emerge says:
>> --buildpkg (-b)
>> Tells emerge to build binary packages for all ebuilds
>> processed in addition to actually **merging** the packages.
>> [...]
>> An alternative for already-merged packages is to use
>> quickpkg(1) which creates a tbz2 from the live filesystem.
>>
>> I have about 20 packages to unmerge or remerge with new use flags. But
>> I want to keep binary copies (with old use settings) before unmerging
>> them. Unfortunately I did not have buildpkg in FEATURES at the time of
>> emerging them. Doing this now by hand sounds kinda fatigue unless...
>> the output of --pretend was parsable so I do what I want by..
>>
>> for pkg in ${PKGS}; do quickpkg --include-config\=y $pkg; done
>>
>> or by something better?
>>
>> Thanks for ideas in advance.
>> --
>> Fatih
>
>
> Write a wrapper script around quickpkg and emerge.
>
> And set buildpkg in FEATURES so this doesn't happen again :-)
'wrapper' rang the bell. Thanks.
The only one I recalled was post_src_install from lafilefixer thing.
So I grepped /usr/lib/portage/ for it and found the list of others at
/usr/lib/portage/bin/isolated-functions.sh +521 and wrote this inside
/etc/portage/bashrc
pkg_prerm() {
echo ">>> Building binary package before unmerging ;)"
if [[ -f /var/db/.pkg.portage_lockfile ]]; then
rm -f /var/db/.pkg.portage_lockfile #2>/dev/null
fi
quickpkg --include-config\=y "=$CATEGORY/$P"
touch /var/db/.pkg.portage_lockfile
}
Voila! :)
--
Fatih