I'm working on a local port where the source archive is not available via anything other than svn. I'm trying to use pre-fetch to see if a checkout of the release I want already exists in /usr/ports/distfiles and if not, check it out. I'm trying something like this:

V = 1.2.3     # program version
R = 4321      # svn ID
DISTNAME = something-${V}-svn${R}

pre-fetch:
.if !exists(${DISTDIR}/${DISTNAME}.tar.gz)
        rm -rf ${WRKDIR}/svn
        mkdir -p ${WRKDIR}/svn
        ( cd ${WRKDIR}/svn ; ${FILESDIR}/checkout.sh ${V} ${R} )
        cp ${WRKDIR}/svn/${DISTNAME}.tar.gz ${DISTDIR}
.endif


The block inside the .if/.endif works fine. 'checkout.sh' is something I wrote to handle checking out the source for the specified version and svn ID. The problem I'm hitting is that !exists() is not working as I think it should.

exists() ignores ${DISTDIR} entirely.  It works fine if I do:

.if !exists(/usr/ports/distfiles/${DISTNAME}.tar.gz)

If I turn on debugging on make(1), I see that exists() searches the current directory, /usr/share/mk, and /etc for ${DISTNAME}.tar.gz.

The man page lacks an example usage and nothing I see in /usr/ports/infrastructure/mk looks to be doing anything different from what I'm trying to do. There are absolute path checks in there too.

Anyone have any ideas or suggestions?

--
David Cantrell <david.l.cantr...@gmail.com>
WH6DSN | http://blog.burdell.org/

Reply via email to