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.
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?
CATEGORY=$1
EBUILD=$2
PORTDIR=/usr/portage
PORTDIR_OVERLAY=~/.portage-local
PKGDIR="${EBUILD%-[0-9]*}"
ACCEPT_KEYWORDS=~x86
# 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)"
exit;
fi
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."
exit;
fi
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."
exit
fi
sleep 1
# Category directory in overlay exists? If not create directory.
if [[ -d $PORTDIR_OVERLAY/$CATEGORY ]]; then
echo " * Category directory already exists."; else
mkdir "$PORTDIR_OVERLAY/$CATEGORY"
echo " * Category directory created."
fi
sleep 1
# Package directory exists? If not create directory.
if [[ -d $PORTDIR_OVERLAY/$CATEGORY/$PKGDIR ]]; then
echo " * Package directory already created."; else
mkdir "$PORTDIR_OVERLAY/$CATEGORY/$PKGDIR"
echo " * Package directory created."
fi
sleep 1
# Move ebuild to overlay, keyword ebuild, digest
#cd $PORTDIR_OVERLAY/$CATEGORY/$PKGDIR
if [[ -f "$EBUILD" ]]; then
echo " * Ebuild found, moving to appropriate directory."
sleep 1
mv "$EBUILD" "$PORTDIR_OVERLAY/$CATEGORY/$PKGDIR"
echo " * Keywording Ebuild."
sleep 1
ekeyword "$ACCEPT_KEYWORDS" "$PORTDIR_OVERLAY/$CATEGORY/$PKGDIR/$EBUILD"
echo " * Building digest for ebuild"
sleep 1
ebuild "$PORTDIR_OVERLAY/$CATEGORY/$PKGDIR/$EBUILD" digest; else
echo " * Ebuild not found in specified directory."
echo " * Exiting"
exit;
fi
# 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}’)
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