Ebuild 2 Overlay


Ebuild2overlay is available. This script comes in nice after grabbing an ebuild (e.g. from bugzilla) and not wanted to go thorough all the commands of putting it in the overlay. Adjust the keyword, and overlay variable to make itwork for you.

ebuild2overlay <category> <package.ebuild>

v.2 – I’ve added keyword support and fixed a few bugs. Thanks to the guys at comp.unix.shell for helping out.

v.3. – Cleaned up the code. Added checks for required tools. Wasn’t able to fix the remotedirectory bug. From what Ican tell you should be able to, “ebuild2overlay <category> </path/to/ebuild>” but currently you have to be in the current directory to use it.

# ebuild2overlay
#   grabs an ebuild and adds it the local overlay
#   adds architecture if needed
#   ebuild-overlay does not add patchs, add these to the "files" directory
#    in the package’s overlay directory.

# Todo/Bugs:
#   Allow script to run if ebuild is in separate directory.
#   Directory check for category can fail for incomplete categories –
#   (i.e "app-edi")
#   PKGDIR filter fails for revisioned ebuilds.
#   "ebuild2overlay category/package" argument possible?


# Usage – displays if full argument isn’t given.
if [[ -z "$EBUILD" ]]; then
    echo "ebuild2overlay <category> <package.ebuild>"
    echo " (must be in currect directory of ebuild)"

sleep 1

# Is Gentoolkit Installed?
if [[ -f "/usr/bin/ekeyword" ]]; then
    echo " * Gentoolkit-dev installed."; else
    echo " * Ekeyword program not found."
    echo " * ‘gentoolkit-dev’ needed to use this script."
    echo " * Exiting."

sleep 1

# Category matches Portage’s?
if [[ -d $PORTDIR/$CATEGORY ]]; then
    echo " * Valid Portage directory, continuing."; else
    echo " * Not a valid category directory!  Category must match an existing Portage directory."
    echo " * Exiting."

sleep 1

# Category directory in overlay exists?  If not create directory.
if [[ -d $PORTDIR_OVERLAY/$CATEGORY ]]; then
    echo " * Category directory already exists."; else
    echo " * Category directory created."

sleep 1

# Package directory exists?  If not create directory.
    echo " * Package directory already created."; else
    echo " * Package directory created."

sleep 1

# Move ebuild to overlay, keyword ebuild, digest
if [[ -f "$EBUILD" ]]; then
  echo " * Ebuild found, moving to appropriate directory."
  sleep 1
  echo " * Keywording Ebuild."
  sleep 1
  echo " * Building digest for ebuild"
  sleep 1
  echo " * Ebuild not found in specified directory."
  echo " * Exiting"

# Notes

# Filters (looks like it’s best to bash filters)

# Bash Filter – Remove the shortest matching pattern from right in variable
# EBUILD starting with ‘-‘ followed by any character "*".
# "${EBUILD%-*}"

# Awk
#PKGDIR=$(echo $EBUILD | awk -F- ‘{print $1 "-" $2}’)

About Gen2ly

<3's linux

Posted on 2008-03-13, in Gentoo, Linux. Bookmark the permalink. 1 Comment.

  1. I got a couple of small updates you could add to this script if you’d like. E-mail me and I’ll send you a diff

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


Get every new post delivered to your Inbox.

Join 58 other followers

%d bloggers like this: