On 10/04/2011 01:39 PM, Antoine Jacoutot wrote:
On Tue, 4 Oct 2011, David Cantrell wrote:

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:

Why don't you create a tarball of the checkout and host it?

That's not really the solution I'm after. The project itself does not have a release engineer and I'm not looking to become one for it. I am just trying to put together a local port that some other coworkers can use to build packages of a specific checkout from the svn repo.


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