What this script does and where it comes from
Gentoo-prefix has been quite practical for me: I migrated from a Gentoo Linux machine to an Apple Intel Laptop.
Since prefix is still very develop-mental and a large number of packages are missing. However I found for many the packages from the main-tree with the automated prefix modifications (eprefixify) applied do just fine. Also the Gentoo prefix developers will not accept any diffs of ebuilds that have not been eprefixified. It's handy to have a eprefixified main tree around!
The following article is about a script I'm using to deal with the main tree and some simple actions I perform on maintree ebuilds. It does these things:
- Using the portage main tree for some packages, synchronizing with it and automatically converting related packages
- Addind my platform keyword into ebuilds conveniently
Configuration of the script
- NONPREFIX_PORTDIR_ORIGINAL sets where the copy of the main tree will reside
- NONPREFIX_PORTDIR_CONVERTED sets where the converted ebuilds go
- PREFIX_PORTDIR sets where the prefix tree sits
- NONPREFIX_SYNC sets where we get the main tree from
- MY_KEYWORD sets the keyword this architecture runs on
Synchronizing with the main tree
Synchronizing with the main tree has the same syntax as its correspondent `emerge` command:
gentoo-alt-converter --syncAutomatically converting the ebuilds
For automatically converting the tree, there are two options:
- Converting the tree one ebuild one by one
- Converting the tree on machines with more than one CPU. This method is fast, but it has a bug I never managed to find
- Check whether the unconverted ebuild checksums are correct.
- All ebuilds are copied into the 'converted' directory.
- All of the ebuilds in the converted ebuild directory are eprefixified.
- Using `ebuild manifest` the checksum of the ebuilds are updated.
The command I'm typcially using to convert the ebuilds is:
FETCHCOMMAND= gentoo-alt-converter --convert
For parallel conversion, the command line is a little bit longer. The script has been split in a master part and a slave part for that purpose. The idea is to start one master part with:
gentoo-alt-converter -m --convert
The master part will output names of package directories that need conversion. The slave part takes these package directory as input and will conduct the conversion. Thus, the command for the normal one CPU conversion is thus:
gentoo-alt-converter -m --convert | bin/gentoo-alt-converter -s
To have use more CPU, you could simply add more slaves, as the following example for two CPU illustrates:
gentoo-alt-converter -m --convert | ( gentoo-alt-converter -s & gentoo-alt-converter -s )
However the above doesn't always work for me. So what I do instead is I give the pipe above a name and create a FIFO somewhere and then in the first terminal window I do:
mkfifo /tmp/pipe gentoo-alt-converter -m --convert > /tmp/pipe &
gentoo-alt-converter -s < /tmp/pipe
In the second Terminal I just repeat the last line. That also has the advantage that I can see the outputs of the two conversion processes without intermix.
For the more technical among here: the above assumes that no package name is longer than the operating system buffer, because reading one line from the pipe should be atomic. I have no clue whether this is the case or not. As mentioned earlier, the multiprocessor approach does not work as good as the single processor approach. It skips sometimes packages and the problem of atomicity might be the reason.
| < Prev | Weiter > |
|---|








