07 November 2012

Upgrading to Newest Version of an App Which Still Is Not Available In the Gentoo Portage

Sometimes you need new version of an app, but it is not yet availlable via Gentoo's portage(or overlays). If you want to keep things organized, you have to make package yourself. In some distros it is done easily with `checkinstall` utility, which helps to produce Debian, RPM or Slackware packages. In Gentoo we have make a ebuild ourselves.

However, ebuild tool and existing ebuilds in PORTDIR(usually /usr/portage) make it pretty easy too. I'll show it with example.

Let's say, I have to upgrade app-misc/sphinx to version 2.0.6. But even after emerge --sync the latest ebuild available is /usr/portage/app-misc/sphinx/sphinx-2.0.5.ebuild. For this, we'll do the following: 1) Add our custom portage directory 2) Copy and modify sphinx-2.0.5.ebuild in our brand new portage dir 3) emerge the new version, pulling the code from the official application maintainer's site

Add new portage overlay dir:

# mkdir -p /var/lib/layman/my_ebuilds
# vim /etc/portage/make.conf
# ...
PORTDIR_OVERLAY="${PORTDIR_OVERLAY} /var/lib/layman/my_ebuilds"
# ...

Copy existing ebuild:

# cp /usr/portage/app-misc/sphinx/sphinx-2.0.5.ebuild /var/lib/layman/my_ebuilds/app-misc/sphinx/sphinx-2.0.6.ebuild
# vim /var/lib/layman/my_ebuilds/app-misc/sphinx/sphinx-2.0.6.ebuild
... change version, URIs etc. if needed (in my case it detects version automatically)

Build ebuild manifest(this will fetch file from the Web):

# cd /var/lib/layman/my_ebuilds/app-misc/sphinx
# ebuild sphinx-2.0.6.ebuild manifest

Finally upgrade to the new version:

# emerge -Duva app-misc/sphinx

That's it! Enjoy:)


1. Gentoo WIKI: Writing Ebuilds