Portage Hooks

Now that school is done for the 2009-2010 year, I’m back at it in Neuvoo again. I’m finishing off a long-planned and fairly major addition to portage I call “portage hooks.” The fun thing is I’ve submitted some patches to zmedico and the response has actually been more positive than previous experiences. solar seemed to be (tentatively?) liking the idea as well.

So, here’s what portage hooks are all about. If you have portage-utils installed, you will have an /etc/portage/postsync.d/ directory. Scripts in this directory are executed after portage syncs the tree. I thought this was a great idea, and I thought it should be expanded so there are other opportunities for unofficial extensions.

So, hopefully soon, there will be /etc/portage/hooks/{pre,post}-{run,sync,ebuild}.d directories, and inside hook scripts can be installed by ebuilds or users. The run and sync hooks are self-explanatory. The ebuild hooks will be executed within the ebuild environment before or after each phase, and can modify an ebuild’s environment, similar to /etc/portage/bashrc.

I’ve written documentation for the portage DocBook (enable the doc USE flag on portage) when the patches get accepted.

Neuvoo has already utilized these hooks to add transparent and stable support for squashfs portage trees. The “emerge –sync” command is hijacked by a pre-sync hook to download the latest squashfs tree, and every time “emerge” is run, there is a hook that checks to be sure the squashfs tree is mounted.

I hope to use hooks for the following additional unofficial features:

  • When a package fails to merge, a hook would inform the user of known open bugs for that package, and possibly even suggest a fix. Still thinking over this one.
  • Since we’re working in embedded environments, we’re going to be primarily using binary packages on production systems. This means we’ll need a pretty solid binary repository format to keep everything stable. I’m hoping to use our beagleboards to keep these binaries up-to-date. A post-run hook would detect that a new binary package was built and port the binary into our new binary repository format (which will consist of ebuilds, since ebuilds have much better flexibility than the “Packages” file will ever have). In addition, Neuvoo users, and anyone else with our binary system, can submit new binaries to our server for automated review, which will probably be some kind of fancy voting system.

An unofficial version of portage, and the squashfs hooks, are all available right now if you want to try it out in the neuvoo overlay. Run “layman -a neuvoo && emerge -av squashfs-portage” to get it. Be warned: the squashfs-portage package requires the latest neuvoo portage git. I don’t know if you can revert back to an old version of portage once you have the new one.

Advertisements
Post a comment or leave a trackback: Trackback URL.

Comments

  • bearsh  On June 8, 2010 at 3:24 am

    Hi javaJake
    congrats! I hope the final patches will get accepted… keep on! 😉
    I’m still in Asia and this for the next two month, after I hope I find some time again to work on neuvoo as well…
    greetz from Bali

  • MidnighToker  On November 5, 2011 at 3:24 am

    Hi there. Don’t suppose there’s been any update on portageHooks? its a much missing feature 🙂

  • Jacob Godserv  On November 6, 2011 at 8:17 am

    It’s been on my mind ever since this post. Due to school, I haven’t worked on it as much as I’d like, but it is otherwise top priority in my personal projects.

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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: