Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 27029 - search paths for `epatch`
Summary: search paths for `epatch`
Status: RESOLVED WONTFIX
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Unclassified (show other bugs)
Hardware: All Linux
: High enhancement (vote)
Assignee: Martin Schlemmer (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-08-20 20:14 UTC by SpanKY
Modified: 2011-10-30 22:19 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description SpanKY gentoo-dev 2003-08-20 20:14:32 UTC
often times we put patches in ${FILESDIR} or we d/l them from some place via
SRC_URI ... seems silly that so many patches given to `epatch` are of the form:
${FILESDIR}/patch ...

why not do this:
if [ -n "$1" ] ; then
    if [ "${EPATCH_SOURCE}" = "${WORKDIR}/patch" ] ; then
        EPATCH_SOURCE="$1"
    fi

    if [ ! -f "$1" ] ; then
        if [ -f "${FILESDIR}/$1" ] ; then
            EPATCH_SOURCE="${FILESDIR}/$1"
        elif [ -f "${DISTDIR}/$1" ] ; then
            EPATCH_SOURCE="${DISTDIR}/$1"
        elif [ -f "${WORKDIR}/$1" ] ; then # maybe we dont really need this ...
            EPATCH_SOURCE="${WORKDIR}/$1"
        fi
    fi
fi

eerror "Cannot find \$EPATCH_SOURCE!  Value for \$EPATCH_SOURCE is:"
Comment 1 Martin Schlemmer (RETIRED) gentoo-dev 2003-08-22 13:21:40 UTC
Bit ambiguous.  What if you specify a bulk patch dir != "$WORKDIR/patch" ?

More like (you can do form cleanups later on):

if [ -n "$1" ] ; then
    if [ -d "$1" ] ; then
        EPATCH_SOURCE="$1"
    elif [ ! -f "$1" -a -f "${EPATCH_SOURCE}/$1" ] ; then
        EPATCH_SOURCE="${EPATCH_SOURCE}/$1"
    fi

    if [ ! -e "${EPATCH_SOURCE}" ] ; then
        if [ -f "${FILESDIR}/$1" ] ; then
            EPATCH_SOURCE="${FILESDIR}/$1"
        elif [ -f "${DISTDIR}/$1" ] ; then
            EPATCH_SOURCE="${DISTDIR}/$1"
        elif [ -f "${WORKDIR}/$1" ] ; then # maybe we dont really need this ...
            EPATCH_SOURCE="${WORKDIR}/$1"
        fi
    fi
fi
Comment 2 SpanKY gentoo-dev 2003-08-22 13:54:18 UTC
i'll let you handle the details, i just more wanted the idea of search paths ...the bit of 
code was to help express my thoughts ;) 
Comment 3 SpanKY gentoo-dev 2004-06-17 18:43:56 UTC
actually i just realized this could lead to some obscure bugs ...

for example, you have a patch in $WORKDIR and another patch in $FILESDIR which are named the same ... but you misspell the patch while putting it into $FILESDIR and epatch goes and uses the one in $WORKDIR instead of the one in $FILESDIR :)

lame, but could easily lead to a lot of wasted time