diff options
author | bicatali <bicatali@32389bae-6d03-0410-99cf-db05cde120eb> | 2008-03-17 16:21:32 +0000 |
---|---|---|
committer | bicatali <bicatali@32389bae-6d03-0410-99cf-db05cde120eb> | 2008-03-17 16:21:32 +0000 |
commit | 76ffb781ed7a917f23b67454e9f950e5e3b83527 (patch) | |
tree | 94fa8e1ddc7cb9ef80b78ea7896a5845f074f95b /sys-cluster/empi | |
parent | move stuff to root (diff) | |
download | sci-76ffb781ed7a917f23b67454e9f950e5e3b83527.tar.gz sci-76ffb781ed7a917f23b67454e9f950e5e3b83527.tar.bz2 sci-76ffb781ed7a917f23b67454e9f950e5e3b83527.zip |
moved overlay to new directory
git-svn-id: http://overlays.gentoo.org/svn/proj/science/overlay@979 32389bae-6d03-0410-99cf-db05cde120eb
Diffstat (limited to 'sys-cluster/empi')
-rw-r--r-- | sys-cluster/empi/ChangeLog | 7 | ||||
-rw-r--r-- | sys-cluster/empi/Manifest | 6 | ||||
-rw-r--r-- | sys-cluster/empi/empi-0.1.ebuild | 19 | ||||
-rw-r--r-- | sys-cluster/empi/empi-0.2.ebuild | 27 | ||||
-rw-r--r-- | sys-cluster/empi/files/README.txt | 75 | ||||
-rwxr-xr-x | sys-cluster/empi/files/empi | 326 | ||||
-rw-r--r-- | sys-cluster/empi/files/empi-0.2.patch | 110 |
7 files changed, 570 insertions, 0 deletions
diff --git a/sys-cluster/empi/ChangeLog b/sys-cluster/empi/ChangeLog new file mode 100644 index 000000000..21c63131e --- /dev/null +++ b/sys-cluster/empi/ChangeLog @@ -0,0 +1,7 @@ +# ChangeLog for sys-cluster/empi +# Copyright 1999-2008 Gentoo Foundation; Distributed under the GPL v2 +# $Header: $ + + 29 Feb 2008; Justin Bronder <jsbronder@gentoo.org> ChangeLog: + Initial import + diff --git a/sys-cluster/empi/Manifest b/sys-cluster/empi/Manifest new file mode 100644 index 000000000..2fe171df5 --- /dev/null +++ b/sys-cluster/empi/Manifest @@ -0,0 +1,6 @@ +AUX README.txt 2780 RMD160 18c9057b4a536716ae19d41f153df17021e2c4bf SHA1 29814c97d88d695b1aa3027790a3763806821443 SHA256 693a10fa9eb7ab0ec74f83fdbf326a320e69be979b13ca00b5416a539145073a +AUX empi 10260 RMD160 696101bbbcf318d152fe10e690af86fd49bbe139 SHA1 d21d0ab2338c3adfbfdd6f4ad059b81018d15051 SHA256 3c344cde5daa717e3cd779cb2792a58e99d098b9da81b6e00604e70528672569 +AUX empi-0.2.patch 4089 RMD160 265c6a4c887c3006294b430bc7c3aa2891e612a4 SHA1 42d90cc6a6aa4b5cfc544a7a98cf55c5f48dffc8 SHA256 4bd20fb11e0fdc4661836b5cf346224875ce7803b43b32fde2e425b3679c27b8 +EBUILD empi-0.1.ebuild 356 RMD160 da691cd5e6d0efa60610e924afdf9f575d0c0af7 SHA1 82158037d357ab1995115606fc6e65ab644846ce SHA256 2e2f296e101e79207e02c55834ee38eb2eb8d375306bce5dc5bef0b8044a9242 +EBUILD empi-0.2.ebuild 467 RMD160 c67402c1eeba84f93319648605a0720184c19cb5 SHA1 1565fa234b6d7beb193df96400264586a792eaa1 SHA256 48c53593c8859beefc475c9f4c6ebe113972a54efe33f6983351c8cd8d8f3f93 +MISC ChangeLog 199 RMD160 d19235676502c09e9970dcade1e6953561bb0de0 SHA1 3a3b206b2e37e8299fca13c4e1b4d7029df9654e SHA256 3e5879a45cb8cf45883aae0fa0a39eae2a3d7b4a82f77ec03bcc264a75d23d27 diff --git a/sys-cluster/empi/empi-0.1.ebuild b/sys-cluster/empi/empi-0.1.ebuild new file mode 100644 index 000000000..1a8508f8d --- /dev/null +++ b/sys-cluster/empi/empi-0.1.ebuild @@ -0,0 +1,19 @@ +# Copyright 1999-2008 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: $ + +DESCRIPTION="empi" +HOMEPAGE="http://dev.gentoo.org/~jsbronder" +SRC_URI="" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="amd64" +IUSE="" +RDEPEND="app-admin/eselect-mpi" + +src_install() { + dobin "${FILESDIR}"/empi + dodoc "${FILESDIR}"/README.txt +} + diff --git a/sys-cluster/empi/empi-0.2.ebuild b/sys-cluster/empi/empi-0.2.ebuild new file mode 100644 index 000000000..a17388a0a --- /dev/null +++ b/sys-cluster/empi/empi-0.2.ebuild @@ -0,0 +1,27 @@ +# Copyright 1999-2008 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: $ + +inherit eutils + +DESCRIPTION="empi" +HOMEPAGE="http://dev.gentoo.org/~jsbronder" +SRC_URI="" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="amd64" +IUSE="" +RDEPEND="app-admin/eselect-mpi" + +src_unpack() { + mkdir -p "${S}" + cp "${FILESDIR}"/empi "${S}" + cd "${S}" + epatch "${FILESDIR}"/${P}.patch +} + +src_install() { + dobin empi + dodoc "${FILESDIR}"/README.txt +} diff --git a/sys-cluster/empi/files/README.txt b/sys-cluster/empi/files/README.txt new file mode 100644 index 000000000..47d93a071 --- /dev/null +++ b/sys-cluster/empi/files/README.txt @@ -0,0 +1,75 @@ += Introduction = +Empi is basically a reworking of vapier's crossdev script to +handle installing multiple mpi implementations and applications +that depend on them. This is done through trickery involving +adding categories that portage will recognize, moving mpi-enabled +packages (defined as those using mpi.eclass) to a local overlay +directory and then emerging these packages using the new +category. + +Empi handles getting mpi application ebuilds into the overlay, +copying anything in package.{use,keywords}, and wrapping the +emerge process. The eclass handles putting the package files +into separate "root" directories based on the category name as +well as making sure the applications build against the +appropriate environment. + +I also provide eselect-mpi, which unlike every other eselect +module I've ever used, is designed to manage a users personal +environment by writing to ${HOME}/.env.d/mpi. This provides a +quick and easy way for users to experiment with various +implementations while imposing on any other user's ability to +use their preferred implementation. + +The newly written mpi.eclass should handle empi-based and standard +emerging of packages in a manner that enables package maintainers +to quickly port their applications without much knowledge of the +underlying mechanics. At least, that was my intent, maybe I +succeeded. + + += Definitions = +Implementation: Fake category name used by empi. Must be + prefixed with mpi- +Base Implementation: Actual mpi-implementation package that will + provide all mpi functionality to the above. + + += Instructions = + +The following creates an implementation called "mpi-openmpi" +using sys-cluster/openmpi as the base implementation. We also +set some USE flags and make sure to unmask the appropriate +version of sys-cluster/openmpi. Long options and full package +atoms are used, but not required. + +1.) Sync the overlay located at rsync://cold-front.ath.cx/mpi + +2.) Emerge empi + +3.) Setup /etc/portage/package stuff. + # echo ">=sys-cluster/openmpi-1.2.5-r1 pbs fortran romio smp" >> /etc/portage/package.use + # echo ">=sys-cluster/openmpi-1.2.5-r1" >> /etc/portage/package.keywords + +4.) Create the implementation. + # empi --create --implementation mpi-openmpi =sys-cluster/openmpi-1.2.5-r1 + +5.) Add packages. + # empi --add --implementation mpi-openmpi hpl mpi-examples + +6.) Setup your user. + $ eselect mpi set mpi-openmpi + $ echo <<-EOF >> .bash_profile +for i in $(ls ${HOME}/.env.d/*); do + source ${HOME}/.env.d/${i} +done +EOF + $ source .bash_profile + +7.) Do stuff, or decide this is all worthless and cleanup the mess. + # empi --delete mpi-openmpi + + += Links = +http://dev.gentoo.org/~vapier/CROSS-COMPILE-HOWTO +http://archives.gentoo.org/gentoo-cluster/msg_f29032b0d85f7f47d9e52940e9322d91.xml diff --git a/sys-cluster/empi/files/empi b/sys-cluster/empi/files/empi new file mode 100755 index 000000000..839e41c34 --- /dev/null +++ b/sys-cluster/empi/files/empi @@ -0,0 +1,326 @@ +#!/bin/bash + +source /etc/init.d/functions.sh +#[ -f /etc/empi.conf ] && source /etc/empi.conf +MPI_IMPS="openmpi lam-mpi" +MPI_ALL_IMPS="mpich mpich2 openmpi lam-mpi" +VERBOSE=0 + +[[ -z ${MPI_PORTDIR} ]] \ + && MPI_PORTDIR="$(portageq portdir_overlay)" \ + && MPI_PORTDIR="${MPI_PORTDIR%% *}" \ + +[[ -z ${COMPILER} ]] && COMPILER=gcc +# imp (category) Implementation we're installing for. mpi-* +# targets Packages to run action on. When creating, the implementation to use. +# action create, add, update, remove. + +die(){ + if [ -n "${1}" ]; then + echo; eerror $1; echo + fi + exit 1 +} + +usage(){ + local rc=${1:-0} + shift +cat <<-EOF +Usage: ${HILITE}empi${NORMAL} ${GOOD}[options]${NORMAL} ${BRACKET}--implementation IMPLEMENTATION pkgspec${NORMAL} + +Options: + ${GOOD}-c, --create${NORMAL} (Re)Initialize setup for implementation. + ${GOOD}-a, --add${NORMAL} pkgspec(s) Add packages using specified implementation. + ${GOOD}-i, --implementation${NORMAL} imp Implementation to use. + ${GOOD}-l, --list${NORMAL} List installed implementations. + ${GOOD}-t, --tree${NORMAL} path Path to portage tree to use ebuilds from. + ${GOOD}-d, --delete${NORMAL} imp Remove everything related to specified implementation. + +pkgspec is specified by a package string. Without a version, the best_visible is used. + openmpi, sys-cluster/openmpi, =sys-cluster/openmpi-1.2.5 +implementation (-i) is user defined but must be prefixed with "mpi-" + +EOF + [[ -n $* ]] && echo && eerror "Error: $*" + exit ${rc} +} + +imp_is_valid() { + [[ -z ${imp} ]] && usage 1 "No implementation defined." + [[ ${imp} != mpi-* ]] && usage 1 "Implementations must be prefixed with mpi-" + [[ ${imp//./} != ${imp} ]] && usage 1 "Implementations cannot contain . (period)" +} + +is_imp_category() { + local i + for i in $(eselect mpi list -p); do + [[ ${1} == ${i} ]] && return 0 + done + return 1 +} + +split_atom() { + local cpv c pf pn pv + cpv=$(portageq best_visible / ${1}) + if [[ -z ${cpv} || ${rc} -ne 0 ]]; then + cpv=$(portageq best_visible / =${1}) + [[ -z ${cpv} || ${rc} -ne 0 ]] && return 1 + fi + c=${cpv%/*}; pf=${cpv#${c}/}; pn=${pf%%-[0-9]*}; pv=${pf#${pn}-} + echo "${c} ${pn} ${pv}" +} + +parse_pkgspecs() { + local atom i + for ((i=0; i<${#targets[@]}; i++)); do + atom=($(split_atom ${targets[i]})) + if [[ $? -ne 0 ]]; then + eerror "Unable to find a unique package or valid version for ${targets[i]}" + eerror "Is the package unmasked and unblocked normally?" + die "" + fi + targets[i]=${atom[0]}/${atom[1]}-${atom[2]} + done +} + +# handle_etc_portage package_spec +# parses /etc/portage/package.{keywords,use}. If ${imp}/${pn} is seen, we don't +# do a thing. Otherwise copy any lines that have ${cat}/${pn} inserting them again +# with the new category. +handle_etc_portage() { + local atom=( $(split_atom ${1}) ) + local ext line gfiles f + + for ext in "keywords" "use"; do + if [ -d /etc/portage/package.${ext} ]; then + gfiles="/etc/portage/package.${ext}/*" + f=/etc/portage/package.${ext}/${imp} + else + gfiles="/etc/portage/package.${ext}" + f=/etc/portage/package.${ext} + fi + + if ! grep "[>=<]*${imp}/${atom[1]}" ${gfiles} &>/dev/null; then + grep "[>=<]*${atom[0]}/${atom[1]}" ${gfiles} \ + | sed "s,${atom[0]},${imp}," \ + | while read line; do + echo "${line}" >> ${f} + [[ ${VERBOSE} -ne 0 ]] \ + && einfo "Addition to ${f}: ${line}" + done + elif [[ ${VERBOSE} -ne 0 ]]; then + ewarn "Keys for ${imp}/${atom[1]} already exist in ${f}. Will not replicate them." + fi + done +} + + + +get_ebuild_dir() { + local d a + local want_uses_mpi=${2:-0} + local found=0 + + a=($(split_atom ${1})) + [[ $? -ne 0 ]] && die "Unable to find a unique package or valid version for ${1}." + is_imp_category ${a[0]} && die "It makes no sense to build a new mpi-implementation from a current one." + + if [[ -z ${portage_tree} ]]; then + for d in $(portageq portdir_overlay) $(portageq portdir); do + if [[ ${want_uses_mpi} -ne 0 ]]; then + [[ -f "${d}/${a[0]}/${a[1]}/${a[1]}-${a[2]}.ebuild" ]] \ + && ebuild_uses_mpi ${d}/${a[0]}/${a[1]} ${a[1]}-${a[2]} \ + && found=1 + else + [[ -f "${d}/${a[0]}/${a[1]}/${a[1]}-${a[2]}.ebuild" ]] && found=1 + fi + [[ ${found} -ne 0 ]] && break + done + if [[ ${found} -ne 0 ]]; then + portage_tree=${d} + else + die "Could not find an ebuild for ${a[0]}/${a[1]}-${a[2]}." + fi + fi + + ebuild_dir="${portage_tree}/${a[0]}/${a[1]}" +} + +ebuild_uses_mpi() { + grep 'inherit .*mpi' "${1}/${2##*/}.ebuild" &>/dev/null +} + +setup_portage_vars() { + export PORTDIR_OVERLAY="${MPI_PORTDIR} $(portageq portdir_overlay)" + export PKGDIR="$(portageq envvar PKGDIR)/mpi/${imp}" +} + +link_ebuild_dir() { + ln -snf "${ebuild_dir}" "${MPI_PORTDIR}"/${imp}/${ebuild_dir##*/} \ + || die "Failed to link ${ebuild_dir} to ${MPI_PORTDIR}/${imp}/${ebuild_dir##*/}" +} + +do_emerge() { + ebegin "Emerging $*" + setup_portage_vars + emerge ${emerge_opts} $* || die "emerge failed!" + eend +} + +# We should have only one target here. +create_implementation() { + local mpi_imp_pkg d mpi_imp_pn + + [[ ${#targets[@]} -ne 1 ]] && die "Can only create one implementation at a time." + + # Prevent laziness + [[ ${targets[0]} == ${targets[0]##*/} ]] \ + && targets[0]="sys-cluster/${targets[0]}" + + parse_pkgspecs + get_ebuild_dir ${targets[0]} 1 + mpi_imp_pn=${ebuild_dir##*/} + mpi_imp_pkg=${targets[0]} + handle_etc_portage ${targets[0]} + targets[0]="=${imp}/${targets[0]##*/}" + + # Refuse to break systems. If there is already an implementation + # installed in that directory, we're not going to add another one as + # the eclass doesn't fix one problem just to introduce a bigger one. + for d in $(find ${MPI_PORTDIR}/${imp} -maxdepth 1 -mindepth 1 -type l);do + d=${d##*/} + [[ ${d} == ${mpi_imp_pn} ]] && continue + for i in ${MPI_ALL_IMPS}; do + [[ ${i} == ${d} ]] \ + && die "${imp} already has MPI implementation ${d}, refusing to add ${mpi_imp_pn}" + done + done + + if [[ -d "${MPI_PORTDIR}"/${imp} ]]; then + [[ ${VERBOSE} -ne 0 ]] && ewarn "${imp} has already been created." + else + mkdir -p ${MPI_PORTDIR}/${imp} + link_ebuild_dir + fi + if ! grep "^${imp}$" /etc/portage/categories &>/dev/null; then + echo "${imp}" >> /etc/portage/categories + fi + + +cat << EOF +Creating ${HILITE}${imp}${NORMAL} + Implementation: ${GOOD}${imp}${NORMAL} + MPI Package: ${GOOD}${mpi_imp_pkg}${NORMAL} + Source: ${GOOD}${ebuild_dir}${NORMAL} + Destination: ${GOOD}${MPI_PORTDIR}/${imp}${NORMAL} +EOF + do_emerge ${targets[0]} +} + + +add_packages(){ + local i j deps + + [[ -d "${MPI_PORTDIR}"/${imp} ]] || die "Implementation ${imp} has not been created yet." + [[ ${#targets[@]} -lt 1 ]] && die "You need to specify at least one package" + + parse_pkgspecs + for ((i=0;i<${#targets[@]};i++)); do + get_ebuild_dir ${targets[i]} + if ebuild_uses_mpi ${ebuild_dir} ${targets[i]}; then + link_ebuild_dir + handle_etc_portage ${targets[i]} + targets[i]="=${imp}/${targets[i]##*/}" + else + targets[i]="=${targets[i]}" + fi + + # I don't know about this, but do you have a better idea? + deps="$(emerge --color=n --onlydeps -p --quiet ${targets[i]})" + if [[ $? -ne 0 ]]; then + emerge --onlydeps -p ${targets[i]} + die "Unable to calculate deps for ${targets[i]}" + fi + deps=( $(echo ${deps} | sed -e 's:\[[a-z]* [A-Z] \] :=:g') ) + for ((j=0;j<${#deps[@]};j++)); do + get_ebuild_dir ${deps[j]} + if ebuild_uses_mpi ${deps[i]}; then + link_ebuild_dir + fi + done + done +cat << EOF +Adding packages to ${HILIGHT}${imp}${NORMAL} + Packages: ${GOOD}${targets[@]}${NORMAL} +EOF + do_emerge ${targets[@]} +} + + +delete_implementation() { + local pkgs=( $(ls /var/db/pkg/${imp}/) ) + local ext d i + [[ -d "${MPI_PORTDIR}"/${imp} ]] || die "Implementation ${imp} has not been created yet." + + for (( i=0; i<${#pkgs[@]}; i++)); do + pkgs[i]="=${imp}/${pkgs[i]}" + done + + if ! emerge -C ${emerge_opts/-u/} ${pkgs[@]}; then + die "Failed to unmerge ${pkgs[@]}" + fi + + for ext in "keywords" "use"; do + if [ -d /etc/portage/package.${ext} ]; then + rm /etc/portage/package.${ext}/${imp} &>/dev/null + else + sed -i -e "/${imp}\//d" /etc/portage/package.${ext} + fi + done + sed -i -e "/^${imp}$/d" /etc/portage/categories + + for d in $(ls "${MPI_PORTDIR}"/${imp}/); do + rm "${MPI_PORTDIR}"/${imp}/${d} + done + rmdir "${MPI_PORTDIR}"/${imp} + rmdir /var/db/pkg/${imp} +} + + +[[ ${UID} -ne 0 ]] && die "You must be root." +targets="" +emerge_opts="-u -a -v" +portage_tree="" +action="" +while [[ $# -gt 0 ]]; do + case $1 in + -h|--help) + usage;; + -c|--create) + action="${action}create";; + -a|--add) + action="${action}add";; + -d|--delete) + action="${action}delete" + shift; imp=${1};; + -i|--implementation) + shift; imp=${1};; + -t|--tree) + shift; portage_tree=${1};; + -v|--verbose) + VERBOSE=1;; + -*) + emerge_opts="${emerge_opts} ${1}";; + *) + targets=( $(echo ${targets[@]}) ${1} );; + esac + shift +done + +[[ -z ${action} ]] && usage 1 "No action defined." +[[ -z ${imp} ]] && usage 1 "No implementation defined." +imp_is_valid + +[[ ${action} == *create* ]] && create_implementation +[[ ${action} == *add* ]] && add_packages +[[ ${action} == *delete* ]] && delete_implementation diff --git a/sys-cluster/empi/files/empi-0.2.patch b/sys-cluster/empi/files/empi-0.2.patch new file mode 100644 index 000000000..6076034fd --- /dev/null +++ b/sys-cluster/empi/files/empi-0.2.patch @@ -0,0 +1,110 @@ +diff -urN a/empi b/empi +--- a/empi 2008-03-10 19:52:32.000000000 -0400 ++++ b/empi 2008-03-10 19:53:31.000000000 -0400 +@@ -1,16 +1,8 @@ + #!/bin/bash + + source /etc/init.d/functions.sh +-#[ -f /etc/empi.conf ] && source /etc/empi.conf +-MPI_IMPS="openmpi lam-mpi" +-MPI_ALL_IMPS="mpich mpich2 openmpi lam-mpi" + VERBOSE=0 + +-[[ -z ${MPI_PORTDIR} ]] \ +- && MPI_PORTDIR="$(portageq portdir_overlay)" \ +- && MPI_PORTDIR="${MPI_PORTDIR%% *}" \ +- +-[[ -z ${COMPILER} ]] && COMPILER=gcc + # imp (category) Implementation we're installing for. mpi-* + # targets Packages to run action on. When creating, the implementation to use. + # action create, add, update, remove. +@@ -32,9 +24,9 @@ + ${GOOD}-c, --create${NORMAL} (Re)Initialize setup for implementation. + ${GOOD}-a, --add${NORMAL} pkgspec(s) Add packages using specified implementation. + ${GOOD}-i, --implementation${NORMAL} imp Implementation to use. +- ${GOOD}-l, --list${NORMAL} List installed implementations. + ${GOOD}-t, --tree${NORMAL} path Path to portage tree to use ebuilds from. + ${GOOD}-d, --delete${NORMAL} imp Remove everything related to specified implementation. ++ ${GOOD}-o, --overlaydir${NORMAL} path Directory to use for the empi portage overlay. + + pkgspec is specified by a package string. Without a version, the best_visible is used. + openmpi, sys-cluster/openmpi, =sys-cluster/openmpi-1.2.5 +@@ -150,11 +142,6 @@ + grep 'inherit .*mpi' "${1}/${2##*/}.ebuild" &>/dev/null + } + +-setup_portage_vars() { +- export PORTDIR_OVERLAY="${MPI_PORTDIR} $(portageq portdir_overlay)" +- export PKGDIR="$(portageq envvar PKGDIR)/mpi/${imp}" +-} +- + link_ebuild_dir() { + ln -snf "${ebuild_dir}" "${MPI_PORTDIR}"/${imp}/${ebuild_dir##*/} \ + || die "Failed to link ${ebuild_dir} to ${MPI_PORTDIR}/${imp}/${ebuild_dir##*/}" +@@ -162,7 +149,6 @@ + + do_emerge() { + ebegin "Emerging $*" +- setup_portage_vars + emerge ${emerge_opts} $* || die "emerge failed!" + eend + } +@@ -172,7 +158,11 @@ + local mpi_imp_pkg d mpi_imp_pn + + [[ ${#targets[@]} -ne 1 ]] && die "Can only create one implementation at a time." +- ++ ++ for d in $(eselect mpi list -p); do ++ [ "${d}" == "${imp}" ] && die "${imp} has already been created." ++ done ++ + # Prevent laziness + [[ ${targets[0]} == ${targets[0]##*/} ]] \ + && targets[0]="sys-cluster/${targets[0]}" +@@ -187,7 +177,7 @@ + # Refuse to break systems. If there is already an implementation + # installed in that directory, we're not going to add another one as + # the eclass doesn't fix one problem just to introduce a bigger one. +- for d in $(find ${MPI_PORTDIR}/${imp} -maxdepth 1 -mindepth 1 -type l);do ++ for d in $(find ${MPI_PORTDIR}/${imp} -maxdepth 1 -mindepth 1 -type l 2>/dev/null);do + d=${d##*/} + [[ ${d} == ${mpi_imp_pn} ]] && continue + for i in ${MPI_ALL_IMPS}; do +@@ -197,7 +187,7 @@ + done + + if [[ -d "${MPI_PORTDIR}"/${imp} ]]; then +- [[ ${VERBOSE} -ne 0 ]] && ewarn "${imp} has already been created." ++ [[ ${VERBOSE} -ne 0 ]] && ewarn "Overlay for ${imp} has already been created." + else + mkdir -p ${MPI_PORTDIR}/${imp} + link_ebuild_dir +@@ -307,6 +297,8 @@ + shift; imp=${1};; + -t|--tree) + shift; portage_tree=${1};; ++ -o|--overlaydir) ++ shift; MPI_PORTDIR=${1};; + -v|--verbose) + VERBOSE=1;; + -*) +@@ -317,6 +309,18 @@ + shift + done + ++if [ -z "${MPI_PORTDIR}" ]; then ++ MPI_PORTDIR="$(portageq portdir_overlay)" ++ MPI_PORTDIR="${MPI_PORTDIR%% *}" ++fi ++ ++if [ ! -d "${MPI_PORTDIR}" ]; then ++ mkdir -p "${MPI_PORTDIR}" || die "Failed to mkdir ${MPI_PORTDIR}" ++fi ++ ++export PORTDIR_OVERLAY="${MPI_PORTDIR} $(portageq portdir_overlay)" ++export PKGDIR="$(portageq envvar PKGDIR)/mpi/${imp}" ++ + [[ -z ${action} ]] && usage 1 "No action defined." + [[ -z ${imp} ]] && usage 1 "No implementation defined." + imp_is_valid |