poudriere: "Permission denied" in the extract phase?

Marcin Cieslak saper at saper.info
Sun Feb 25 13:37:58 UTC 2018


On Sun, 25 Feb 2018, Adam Weinberger wrote:

> > > (full log:
> > > https://gist.github.com/saper/0be3f9b4e9eb819d3ec00f5273705517#file-node-sass-4-7-2-log
> > > )
> > > 
> > > Why are /bin/mkdir -p and /bin/cp commands invoked again in the "extract"
> > > phase?
> > > 
> > > FreeBSD 11.1-STABLE #10 r321629 running poudriere-3.2.4 (I have updated
> > > poudriere today)
> 
> First of all, just so you know, npm module ports won't be added to the ports
> tree. I just wanted to be clear in case you were planning on submitting it.
> There were a couple threads about this a while back.
> 
> With that out of the way, you're hitting errors for two reasons here.

Yes, this is my private port that I am using to produce FreeBSD binaries
for node-sass. Getting binary npm modules into our ports tree is another conversation.

The problem here is that a whole thing worked for me before for months
so I am aware of all those limitations for particular build phases
(it took me long to figure out that).

> The first problem is that npm needs network access, and poudriere prevents
> ports from dialing out. You can work around this with the
> ALLOW_NETWORKING_PACKAGES variable in poudriere.conf.
> 
> The other problem you're hitting is that npm saves a cache, and for some
> reason you're trying to run it from /usr/ports/distfiles/node-sass. Ports
> themselves should never, ever have the ability to create files in
> /usr/ports/distfiles. If you run 'npm install' from ${WRKSRC}, then you can
> do:
> 	cd ${WRKSRC} && ${SETENV} HOME=/tmp npm install

Aren't ports allowed to write in /usr/ports/distfiles during the fetch phase?
That would be new to me...

This whole thing was working for me before (with older poudriere/bsd.port.mk maybe).
I try to force npm to fetch everything (including dependent modules)
in the fetch phase:

 42 post-fetch:
 43         ${MKDIR} ${DISTDIR}/${PORTNAME}
 44         ${MKDIR} ${NPM_CACHE}
 45         ${CP} ${FILESDIR}/package-lock.json ${DISTDIR}/${PORTNAME}
 46         ${CP} ${FILESDIR}/package.json ${DISTDIR}/${PORTNAME}
 47         (cd ${DISTDIR}/${PORTNAME} && ${SETENV} NPM_CONFIG_CACHE=${NPM_CACHE} npm install --ignore-scripts)

I copy everything I need from distfiles to ${WRKSRC} in the extract phase:

 49 post-extract:
 50         (cd ${DISTDIR}/${PORTNAME} && ${FIND} node_modules | ${PAX} -rw ${WRKSRC})
 51 

I build everything without touching the network:

 52 do-build:
 53         (cd ${WRKSRC} && ${SETENV} ${CONFIGURE_ENV} ${MAKE_ENV} NPM_CONFIG_CACHE=${NPM_CACHE} npm instal    l --nodedir=${LOCALBASE})

The problem in particular is that "post-fetch" target is invoked ALSO during the "extract" target,
I don't know why:

=======================<phase: extract        >============================
                               ^^^^^^^^^^^^
===>  License MIT accepted by the user
===> Fetching all distfiles required by node-sass-4.7.2 for building
     ^^^^^^^^^^^^
/bin/mkdir -p /portdistfiles/node-sass
/bin/mkdir -p /portdistfiles/npm

It did that already in the fetch phase:

===========================================================================
=======================<phase: fetch          >============================
===>  License MIT accepted by the user
===> Fetching all distfiles required by node-sass-4.7.2 for building
/bin/mkdir -p /portdistfiles/node-sass
/bin/mkdir -p /portdistfiles/npm

and it tries that again in the checksum phase:

===========================================================================
=======================<phase: checksum       >============================
===>  License MIT accepted by the user
===> Fetching all distfiles required by node-sass-4.7.2 for building
/bin/mkdir -p /portdistfiles/node-sass
/bin/mkdir -p /portdistfiles/npm

Maybe there is an additional check for a successful fetch that I have missed.

Marcin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3663 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.freebsd.org/pipermail/freebsd-ports/attachments/20180225/df793bef/attachment.bin>


More information about the freebsd-ports mailing list