View previous topic :: View next topic |
Author |
Message |
Kream n00b
Joined: 19 Apr 2002 Posts: 30 Location: New Delhi, India
|
Posted: Thu Mar 31, 2005 8:11 am Post subject: HOWTO Build binary packages for every package on your system |
|
|
HOWTO Build binary packages for every package on your system
Thanks to ferringb on #gentoo-portage and assorted folks on #linuxhelp and #perl for this.
If you have systems which use compatible CHOST and march/mcpu settings, then you can easily build binary packages on one system and share them on the others. I do this a lot, so i needed to easily make binaries for all the packages on my system after a little ill advised meddling with distcleaner cleaned out my /usr/portage/packages/All/ directory, containing 1.2GB of precious binary files.
Before starting, I recommend that your system be in as consistent a state as possible. Run cleanup/update scripts like
Code: | /usr/portage/dev-lang/perl/files/perl-cleaner |
and
and if you like, prune all unneeded packages by doing READ THE WARNING BEFORE YOU DO THIS!
What we're going to do is create a list of all packages installed in your system and pass that to quickpkg.
Go to /var/db/pkg (which contains the ebuilds and ebuild metadata for the _installed_ packages on your system.)
Generate a listing of all packages in your system and output it to the file /root/installed.
Code: | find . -type d -mindepth 2 -maxdepth 3| sed -e 's:^\./::' > ~/installed
cd /root |
For neatness' sake, sort the output
Code: |
sort installed > sortedinstalled |
Since quickpkg will accept requests for packages with versions only when it's an atom, i.e, when it is preceded with a =, we need to prefix each line with a = so that each line reads =xfce-base/xffm-4.2.0 rather than xfce-base/xffm-4.2.0.
Code: | sed -i -e 's:^:=:' sortedinstalled |
Now instead of having each package atom on a separate line, we we need them all in a single line, separated by a space:
Code: | cat sortedinstalled | perl -pe 'local $/;($_=<>) =~ s/\n/ /g; ' > needed_packages |
now edit this file and right at the beginning, put quickpkg, so that it looks like this:
Code: |
vim needed_packages |
Code: | quickpkg =app-admin/gentoo-rsync-mirror-1.0-r4 =app-admin/gkrellm-2.2.5 (truncated)
|
now run the file and you'll get the packages in /usr/portage/packages/All
Code: |
bhim root # sh ./needed_packages |
* Building package for gentoo-rsync-mirror-1.0-r4... [ ok ]
* Building package for gkrellm-2.2.5... [ ok ]
* Building package for gnome-system-tools-1.0.2-r1...
Don't celebrate yet!
Before continuing, we need to understand a few things. The Gentoo .tbz2 format contains package metadata which tells portage many things about the package, such as which part of the tree the package belongs to. As a certified portage oldtimer, I've seen the tree grow from 12000 packages to 120,000 and have seen many packages move in the portage tree. An example is fftw, the fast Fourier transform library. This moved from dev-libs/fftw to sci-libs/fftw. Because portage stores tree metadata like this in the package, while portage might require fftw-3.0.1 to be installed, it won't accept the binary package you're offering it for the simple reason that the metadata says that it's actually dev-libs/fftw which you have rather than sci-libs/fftw.
This situation will cause you to go insane - while portage on the system you're trying to build binaries for will happily accept the vast majority of packages, it will cryptically refuse to accept binaires for some package. As the maintainer of a series of media labs in settlement colonies in New Delhi, this caused me no end of problems.
The purported solution to your woes is fixpackages. This reads the binary files that you have and updates the metadata that's present to match the information stored in
/usr/portage/profiles/updates/[1-4]Q-200*, quarterly update information for all binary packages.
Fixpackages has no documentation. Fixpackages does not tell the user clearly what it does [1]. Fixpackages is written in python, so it's opaque to losers like me who don't know python (or any other programming language for that matter). Fixpackages take a long time to run. Fixpackages is absolutely ESSENTIAL if you want to build binary packages for other machines and retain your sanity at the same time.
So run fixpackages.
Performing Global Updates: /usr/portage/profiles/updates/2Q-2002
(Could take a couple of minutes if you have a lot of binary packages.)
.='update pass' *='binary update' @='/var/db move'
s='/var/db SLOT move' S='binary SLOT move' p='update /etc/portage/package.*'
................ (truncated)
Once it's done, you'll have a set of packages in /usr/portage/packages/All that are CONSISTENT with the current portage tree.
Here's a consolidated listing of the code for your convenience:
Code: |
cd /var/db/pkg
find . -type d -mindepth 2 -maxdepth 3| sed -e 's:^\./::' > ~/installed
cd /root
sort installed > sortedinstalled
sed -i -e 's:^:=:' sortedinstalled
cat sortedinstalled | perl -pe 'local $/;($_=<>) =~ s/\n/ /g; ' > needed_packages
|
edit: Code: |
vim needed_packages |
Code: |
quickpkg =app-admin/gentoo-rsync-mirror-1.0-r4 =app-admin/gkrellm-2.2.5 (truncated) |
Code: |
bhim root # sh ./needed_packages
|
cheers,
Aniruddha "Karim" Shankar
[1] https://forums.gentoo.org/viewtopic.php?t=55863 _________________ https://forums.gentoo.org/search.php?search_id=unanswered |
|
Back to top |
|
|
Voltago Advocate
Joined: 02 Sep 2003 Posts: 2593 Location: userland
|
Posted: Thu Mar 31, 2005 11:01 am Post subject: |
|
|
I don't want to curb your enthusiasm, but for building binaries of all installed packages I do
Code: | qpkg -I -nc | grep -v dev-java | xargs quickpkg |
(java binaries are not worth building, since compilation is quick).
The tips for ensuring consistency first are surely helpful, though. |
|
Back to top |
|
|
Kream n00b
Joined: 19 Apr 2002 Posts: 30 Location: New Delhi, India
|
|
Back to top |
|
|
jamesm n00b
Joined: 13 Jun 2003 Posts: 22
|
Posted: Mon Aug 07, 2006 6:54 am Post subject: |
|
|
Voltago wrote: | I don't want to curb your enthusiasm, but for building binaries of all installed packages I do
Code: | qpkg -I -nc | grep -v dev-java | xargs quickpkg |
(java binaries are not worth building, since compilation is quick).
The tips for ensuring consistency first are surely helpful, though. |
I've been trying to build binary packages for everything installed on a system, but your code example no longer works since qpkg is deprecated.
Instead I used,
Code: | /home/jamesm $ cd /var/db/pkg
/var/db/pkg $ find -mindepth 2 -type d -exec quickpkg '{}' \;
|
YMMV |
|
Back to top |
|
|
yoshi314 l33t
Joined: 30 Dec 2004 Posts: 850 Location: PL
|
Posted: Mon Aug 07, 2006 6:39 pm Post subject: |
|
|
qpkg -I -nc does not work for me,
you can use eix -cI to list all installed packages in short format. all it takes is to do some cut magic to remove irrelevant data from the output and you're set.
(i believe it's also faster using eix, but i couldn't check, since qpkg refuses to work ) _________________ ~amd64
shrink your /usr/portage with squashfs+aufs |
|
Back to top |
|
|
avx Advocate
Joined: 21 Jun 2004 Posts: 2152
|
Posted: Thu Aug 10, 2006 7:04 pm Post subject: |
|
|
I'm doing it like this:
Code: | eix -I --format-compact '<category>/<name>' | grep -v Found | xargs quickpkg |
Works like a charm for me |
|
Back to top |
|
|
deluge Apprentice
Joined: 28 Jan 2004 Posts: 157
|
Posted: Wed Aug 16, 2006 12:52 pm Post subject: |
|
|
and how about:
Code: | quickpkg `qlist -IC | tr '\n' ' '` |
works great for me |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|