Tuesday, 4 August 2009

Using layman to track the hardened overlay

Ok, so manually updating an overlay is boring and cumbersome ;) Well, I mean, instead of doing:

cd /usr/local/toolchain-overlay && git update

You could simply run:

layman -S

Efficiency!

So if you haven't used layman before here's quick step-by-step. First - quite obviously - we need to emerge layman itself:

# emerge -av layman

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild N ] dev-python/pyxml-0.8.4-r2 USE="-doc -examples" 718 kB
[ebuild N ] app-portage/layman-1.2.3 USE="-git -subversion -test" 46 kB

Total: 2 packages (2 new), Size of downloads: 764 kB

Would you like to merge these packages? [Yes/No]

...after few minutes portage kindly informs us what to do next:

* Select an overlay and add it using
* layman -a overlay-name
* If this is the very first overlay you add with layman,
* you need to append the following statement to your
* /etc/make.conf file:
*
* source /usr/local/portage/layman/make.conf
*
* If you modify the 'storage' parameter in the layman
* configuration file (/etc/layman/layman.cfg) you will
* need to adapt the path given above to the new storage
* directory.
* Please add the 'source' statement to make.conf only AFTER
* you added your first overlay. Otherwise portage will fail.

Nice and easy. Here we go:

# layman -o http://github.com/Xake/toolchain-overlay.git/xake-toolchain.xml -fa xake-toolchain
* Running command "/usr/bin/git clone "git://github.com/Xake/toolchain-overlay.git" "/usr/local/portage/layman/xake-toolchain""...
Initialized empty Git repository in /usr/local/portage/layman/xake-toolchain/.git/
remote: Counting objects: 2083, done.
remote: Compressing objects: 100% (1306/1306), done.
remote: Total 2083 (delta 953), reused 1492 (delta 633)
Receiving objects: 100% (2083/2083), 2.08 MiB | 284 KiB/s, done.
Resolving deltas: 100% (953/953), done.
* Successfully added overlay "xake-toolchain".

Confirm that it is there and that it's up to date:

# layman -l
* xake-toolchain [Git ] (git://github.com/Xake/toolchain-overlay.git
# layman -S
* Running command "cd "/usr/local/portage/layman/xake-toolchain" && /usr/bin/git pull"...
Already up-to-date.
*
* Success:
* ------
*
* Successfully synchronized overlay "xake-toolchain".

Time to change the repository to use testing branch which is required for gcc-4.4. If you want to stay with gcc-4.3 skip this step and proceed to editing /etc/make.conf. For gcc-4.4 run this:

# cd /usr/local/portage/layman/xake-toolchain
# git branch testing origin/testing
Branch testing set up to track remote branch testing from origin.
# git checkout testing && git pull && cd $OLDPWD
Switched to branch 'testing'
Already up-to-date.

Now portage has to know that it needs to look somewhere else for ebuilds. This requires change in /etc/make.conf. We need to comment out previous location (/usr/local/toolchain-overlay) and add the new one. Open /etc/make.conf in your favourite editor:

#PORTDIR_OVERLAY="/usr/local/toolchain-overlay"
source /usr/local/portage/layman/make.conf

That should be it. To confirm that portage works as it should try emerging gcc and glibc. For gcc-4.4 you should see:

# emerge -av glibc gcc

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild R ] sys-devel/gcc-4.4.1-r1 USE="graphite gtk hardened mudflap nls nptl (-altivec) -bootstrap -build -doc (-fixed-point) -fortran -gcj -ip28 -ip32r10k -libffi (-multilib) -multislot (-n32) (-n64) -nocxx -objc -objc++ -objc-gc -openmp -test -vanilla" 0 kB [1]
[ebuild R ] sys-libs/glibc-2.10.1 USE="gd hardened nls profile -debug -glibc-omitfp (-multilib) (-selinux) -vanilla" 0 kB [1]

Total: 2 packages (2 reinstalls), Size of downloads: 0 kB
Portage tree and overlays:
[0] /usr/portage
[1] /usr/local/portage/layman/xake-toolchain

Would you like to merge these packages? [Yes/No] n

Quitting.

All set! You can safely delete the /usr/local/toolchain-overlay folder. Now whenever you want to update the overlay, simply run:

# layman -S

2 comments:

  1. 404 not fould http://github.com/Xake/toolchain-overlay.git/xake-toolchain.xml . another links ?

    ReplyDelete
  2. There's no need to use the overlay anymore. It's all in the main portage tree, although few things might require keywording...

    ReplyDelete

Have your say: