Gentoo: Quick How To Clone Your First Ebuild

This is an old post, you might want to read how I make my first Ebuild From Scratch !!

I had a problem installing gnome, see

It’s temporary solved by a local ebuild atm, building the ebuild by the documentation was rather hard, some stuff is not mentioned.

So here’s my:

Quick How To Clone Your First Ebuild

Package “app-admin/system-config-printer-common” is my example!

Create Local Portage Overlay

Make a folder: mkdir -p /usr/local/portage
and set the folder in /etc/make.conf: PORTDIR_OVERLAY=/usr/local/portage

Copy the original package

mkdir -p /usr/local/portage/app-admin/system-config-printer-common
cd /usr/local/portage/app-admin/system-config-printer-common

# you need the files folder
cp -r /usr/portage/app-admin/system-config-printer-common/files .
Update: This needed the folder because it contained a patch. the ebuild should contain correct urls to download the sources. I still have to figure this out better.

# clone the ebuild, I gave it a new name
cp /usr/portage/app-admin/system-config-printer-common/system-config-printer-common-1.3.9-r1.ebuild .
mv system-config-printer-common-1.3.9-r1.ebuild system-config-printer-common-1.3.9-r2.ebuild

Edit your new ebuild file

Do what has to be done ;-)

Create the .manifest file

ebuild system-config-printer-common-1.3.9-r2.ebuild manifest


If your installation fails, be shure to run
ebuild system-config-printer-common-1.3.9-r2.ebuild clean
Also run this before emerging anything, it seems to clean up stuffI also recall running “setup”

ebuild system-config-printer-common-1.3.9-r2.ebuild setup
to test the ebuild. Run “clean” afterwards!

Mask your ebuild to verify the problem was in the original ebuild

You can mask your ebuild in /etc/portage/package.mask, for example:
will mask my local ebuild, the original package will be installed.Note the “=” operator!

Operators are required when noting the version/release number, then wildcards can be used (not after a period).
Play around until it works ;-)

Different output for local ebuilds:

visible with “emerge -a”:
# emerge -av system-config-printer-commonThese are the packages that would be merged, in order:Calculating dependencies… done!
[ebuild R ] app-admin/system-config-printer-common-1.3.9-r2::x-portage USE=”-doc -policykit” 0 kB

and after the confirmation:
>>> Emerging (1 of 1) app-admin/system-config-printer-common-1.3.9-r2 from x-portage


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: