On 23:20 Thu 20 Sep     , Alistair Bush wrote:
> -             # Create package.env
> -             (
> -                     echo "DESCRIPTION=\"${DESCRIPTION}\""
> -                     echo "GENERATION=\"2\""
> -
> -                     [[ -n "${JAVA_PKG_CLASSPATH}" ]] && echo 
> "CLASSPATH=\"${JAVA_PKG_CLASSPATH}\""
> -                     [[ -n "${JAVA_PKG_LIBRARY}" ]] && echo 
> "LIBRARY_PATH=\"${JAVA_PKG_LIBRARY}\""
> -                     [[ -n "${JAVA_PROVIDE}" ]] && echo 
> "PROVIDES=\"${JAVA_PROVIDE}\""
> -                     [[ -f "${JAVA_PKG_DEPEND_FILE}" ]] \
> -                             && echo "DEPEND=\"$(cat 
> "${JAVA_PKG_DEPEND_FILE}" | uniq | tr '\n' ':')\""
> -                     [[ -f "${JAVA_PKG_OPTIONAL_DEPEND_FILE}" ]] \
> -                             && echo "OPTIONAL_DEPEND=\"$(cat 
> "${JAVA_PKG_OPTIONAL_DEPEND_FILE}" | uniq | tr '\n' ':')\""
> -                     echo "VM=\"$(echo ${RDEPEND} ${DEPEND} | sed -e 's/ 
> /\n/g' | sed -n -e '/virtual\/\(jre\|jdk\)/ { p;q }')\"" # TODO cleanup !
> -             ) > "${JAVA_PKG_ENV}"

Why not use a code block {} instead of a subshell ()?

> -             # register target/source
> -             local target="$(java-pkg_get-target)"
> -             local source="$(java-pkg_get-source)"
> -             [[ -n ${target} ]] && echo "TARGET=\"${target}\"" >> 
> "${JAVA_PKG_ENV}"
> -             [[ -n ${source} ]] && echo "SOURCE=\"${source}\"" >> 
> "${JAVA_PKG_ENV}"
> -
> -             # register javadoc info
> -             [[ -n ${JAVADOC_PATH} ]] && echo 
> "JAVADOC_PATH=\"${JAVADOC_PATH}\"" \
> -                     >> ${JAVA_PKG_ENV}
> -             # register source archives
> -             [[ -n ${JAVA_SOURCES} ]] && echo 
> "JAVA_SOURCES=\"${JAVA_SOURCES}\"" \
> -                     >> ${JAVA_PKG_ENV}
> -
> -
> -             echo "MERGE_VM=\"${GENTOO_VM}\"" >> "${JAVA_PKG_ENV}"
> -             [[ -n ${GENTOO_COMPILER} ]] && echo 
> "MERGE_COMPILER=\"${GENTOO_COMPILER}\"" >> "${JAVA_PKG_ENV}"

I don't understand why all these things are done down here instead of in the 
same code block as $JAVA_PKG_ENV is created.

> -             # Strip unnecessary leading and trailing colons
> -             # TODO try to cleanup if possible
> -             sed -e "s/=\":/=\"/" -e "s/:\"$/\"/" -i "${JAVA_PKG_ENV}" || 
> die "Did you forget to call java_init ?"
> +     
> +     if [[ $1 != provider ]]; then

Could you explain what the next section is supposed to do, as opposed to 
the above section? Are they expected to be mutually exclusive? The 
comments suggest so, since both have a 'Create package.env'. But the 
tests suggest otherwise, since it's not an if...else pair.

> +             # Create directory for package.env
> +             dodir "${JAVA_PKG_SHAREPATH}"
> +             if [[ -n "${JAVA_PKG_CLASSPATH}" || -n "${JAVA_PKG_LIBRARY}" || 
> -f \
> +                             "${JAVA_PKG_DEPEND_FILE}" || -f \
> +                             "${JAVA_PKG_OPTIONAL_DEPEND_FILE}" ]]; then
> +                     # Create package.env
> +                     (
> +                             echo "DESCRIPTION=\"${DESCRIPTION}\""
> +                             echo "GENERATION=\"2\""
> +
> +                             [[ -n "${JAVA_PKG_CLASSPATH}" ]] && echo 
> "CLASSPATH=\"${JAVA_PKG_CLASSPATH}\""
> +                             [[ -n "${JAVA_PKG_LIBRARY}" ]] && echo 
> "LIBRARY_PATH=\"${JAVA_PKG_LIBRARY}\""
> +                             [[ -n "${JAVA_PROVIDE}" ]] && echo 
> "PROVIDES=\"${JAVA_PROVIDE}\""
> +                             [[ -f "${JAVA_PKG_DEPEND_FILE}" ]] \
> +                                     && echo "DEPEND=\"$(cat 
> "${JAVA_PKG_DEPEND_FILE}" | uniq | tr '\n' ':')\""
> +                             [[ -f "${JAVA_PKG_OPTIONAL_DEPEND_FILE}" ]] \
> +                                     && echo "OPTIONAL_DEPEND=\"$(cat 
> "${JAVA_PKG_OPTIONAL_DEPEND_FILE}" | uniq | tr '\n' ':')\""
> +                             echo "VM=\"$(echo ${RDEPEND} ${DEPEND} | sed -e 
> 's/ /\n/g' | sed -n -e '/virtual\/\(jre\|jdk\)/ { p;q }')\"" # TODO cleanup !
> +                     ) > "${JAVA_PKG_ENV}"

Thanks,
Donnie
-- 
[EMAIL PROTECTED] mailing list

Reply via email to