#!/bin/bash # In a format suitable for a DEPEND string PACKAGE_ATOM="${1:-net-www/mozilla-firebird-0.9.1_pre2-r1}" # Pick the name of the variable you want the revision set to REVISION_NAME="${2:-COREUTILS_REVISION}" # Pick the name of the variable you want the specialversion set to SPECIALVERSION_NAME="${3:-COREUTILS_SPECIALVERSION}" # Pick the name of the variable you want the special set to SPECIAL_NAME="${4:-COREUTILS_SPECIAL}" # Pick the name of the variable you want the version set to VERSION_NAME="${5:-COREUTILS_VERSION}" # Pick the name of the variable you want the name set to PACKAGE_NAME="${6:-COREUTILS_PACKAGE}" # Pick the name of the variable you want the category set to CATEGORY_NAME="${7:-COREUTILS_CATEGORY}" #echo ${PACKAGE_ATOM} | sed -e "s:[^a-zA-Z0-9]\?\([a-zA-Z0-9-]*\)/\([a-zA-Z0-9+_-]*\)-\([0-9\.]*[a-zA-Z]\?\)\(_\(alpha\|beta\|pre\|rc\|p\)[0-9]*\)\?\(-r[0-9]*\)\?:PARTS=( '\1' '\2' '\3' '\4' '\6'):" #PARTS=($(echo ${PACKAGE_ATOM} | sed -e "s:\([a-zA-Z0-9-]*\)/\([a-zA-Z0-9+_-]*\)-\([0-9\.]*[a-zA-Z]\?\)\(_\(alpha\|beta\|pre\|rc\|p\)[0-9]*\)\?\(-\(r[0-9]*\)\)\?:'\1' '\2' '\3' '\4' '\7':")) PARTS=($(echo ${PACKAGE_ATOM} | sed -e "s:\([a-zA-Z0-9-]*\)/\([a-zA-Z0-9+_-]*\)-\([0-9\.]*[a-zA-Z]\?\)\(_\(alpha\|beta\|pre\|rc\|p\)\([0-9]*\)\)\?\(-\(r[0-9]*\)\)\?:\1 \2 \3 \5 \6 \8:")) echo "PARTS=${PARTS[@]}" declare ${CATEGORY_NAME}="${PARTS[0]}" ${PACKAGE_NAME}="${PARTS[1]}" ${VERSION_NAME}="${PARTS[2]}" ${SPECIAL_NAME}="${PARTS[3]}" ${SPECIALVERSION_NAME}="${PARTS[4]}" ${REVISION_NAME}="${PARTS[5]}" echo "C=${!CATEGORY_NAME} P=${!PACKAGE_NAME} V=${!VERSION_NAME} S=${!SPECIAL_NAME} SV=${!SPECIALVERSION_NAME} R=${!REVISION_NAME}"