Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 161081 - Suggestions: User-extensible post-install / subclassing an ebuild
Summary: Suggestions: User-extensible post-install / subclassing an ebuild
Status: RESOLVED WORKSFORME
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core - Ebuild Support (show other bugs)
Hardware: All Linux
: High enhancement (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-01-09 07:36 UTC by Mike Slinn
Modified: 2007-01-09 08:21 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Slinn 2007-01-09 07:36:55 UTC
Some packages need further tweaking after emerging an update.  For example, every time I update WordPress I need to manually copy all the images I uploaded for various blog entries from the old WordPress tree to the new WordPress tree.  Other packages have other repetitive post-install steps.  I have suggested to the WordPress maintainers that other users may have the same need - and the suggestion was not adopted. The general problem is fairly easily solved in a simple and elegant manner (IMNSHO :) ) that would work with almost any Gentoo package.

Why not introduce support for a user-written ebuild extensions that would run after pkg_postinst?  The user would simply create a file called pkg_postinst.ebuild or ebuild.pkg_postinst (or whatever name might make better sense), and that file would be sourced into the ebuild script.  This would mean that all of the ebuild variables and functions would be available.  In this way a user could 'subclass' an existing ebuild step.

One could take this idea a bit further:
 - allow subclassing most/all of the ebuild steps (pkg_prerm, pkg_setup, src_test, pkg_postrm and pkg_config)
 - allow the user to place their ebuild extensions in overlays; they could even define an overlay that only contains their ebuild extensions

Reproducible: Always
Comment 1 Marius Mauch (RETIRED) gentoo-dev 2007-01-09 08:21:58 UTC
This already exists in /etc/portage/bashrc if you define a function post_pkg_postinst there for example. You can define pre-/posthooks for all phases, you just need to check for $PN yourself if it's supposed to be package-specific.