Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 25 Feb 2018 00:20:20 -0700
From:      Adam Weinberger <adamw@adamw.org>
To:        Marcin Cieslak <saper@saper.info>
Cc:        ports@FreeBSD.org
Subject:   Re: poudriere: "Permission denied" in the extract phase?
Message-ID:  <371FB508-F90E-41E4-8B3D-85F7DA54FFAA@adamw.org>
In-Reply-To: <nycvar.OFS.7.76.6.1802250252140.2659@z.fncre.vasb>
References:  <nycvar.OFS.7.76.6.1802250231290.2659@z.fncre.vasb> <nycvar.OFS.7.76.6.1802250252140.2659@z.fncre.vasb>

next in thread | previous in thread | raw e-mail | index | archive | help
> On 24 Feb, 2018, at 19:53, Marcin Cieslak <saper@saper.info> wrote:
>
> On Sun, 25 Feb 2018, Marcin Cieslak wrote:
>
>> Hello,
>>
>> why is poudriere on 11.1-STABLE trying to build by custom port which has  
>> the following
>> in the Makefile:
>>
>> post-fetch:
>> 	${MKDIR} ${DISTDIR}/${PORTNAME}
>> 	${MKDIR} ${NPM_CACHE}
>> 	${CP} ${FILESDIR}/package-lock.json ${DISTDIR}/${PORTNAME}
>> 	${CP} ${FILESDIR}/package.json ${DISTDIR}/${PORTNAME}
>> 	(cd ${DISTDIR}/${PORTNAME} && ${SETENV} NPM_CONFIG_CACHE=${NPM_CACHE} npm install --ignore-scripts)
>>
>> ( complete port:  
>> https://github.com/saper/ports-exp/tree/master/textproc/node-sass )
>>
>> The results are those:
> ( this was wrong, the full log is also corrected )
>
> ===>   Returning to build of node-sass-4.7.2
> ===========================================================================
> =======================<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
> /bin/cp /usr/ports/textproc/node-sass/files/package-lock.json  
> /portdistfiles/node-sass
> /bin/cp /usr/ports/textproc/node-sass/files/package.json  
> /portdistfiles/node-sass
> (cd /portdistfiles/node-sass && /usr/bin/env  
> NPM_CONFIG_CACHE=/portdistfiles/npm npm install --ignore-scripts)
> npm WARN lifecycle node-sass@4.7.2~install: cannot run in wd %s %s  
> (wd=%s) node-sass@4.7.2 node scripts/install.js /portdistfiles/node-sass
> npm WARN lifecycle node-sass@4.7.2~postinstall: cannot run in wd %s %s  
> (wd=%s) node-sass@4.7.2 node scripts/build.js /portdistfiles/node-sass
> npm WARN prepublish-on-install As of npm@5, `prepublish` scripts are  
> deprecated.
> npm WARN prepublish-on-install Use `prepare` for build steps and  
> `prepublishOnly` for upload-only.
> npm WARN prepublish-on-install See the deprecation note in `npm help  
> scripts` for more information.
> npm WARN lifecycle node-sass@4.7.2~prepublish: cannot run in wd %s %s  
> (wd=%s) node-sass@4.7.2 not-in-install && node scripts/prepublish.js ||  
> in-install /portdistfiles/node-sass
> added 356 packages in 10.684s
> ===========================================================================
> =======================<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
> /bin/cp /usr/ports/textproc/node-sass/files/package-lock.json  
> /portdistfiles/node-sass
> /bin/cp /usr/ports/textproc/node-sass/files/package.json  
> /portdistfiles/node-sass
> (cd /portdistfiles/node-sass && /usr/bin/env  
> NPM_CONFIG_CACHE=/portdistfiles/npm npm install --ignore-scripts)
> npm WARN lifecycle node-sass@4.7.2~install: cannot run in wd %s %s  
> (wd=%s) node-sass@4.7.2 node scripts/install.js /portdistfiles/node-sass
> npm WARN lifecycle node-sass@4.7.2~postinstall: cannot run in wd %s %s  
> (wd=%s) node-sass@4.7.2 node scripts/build.js /portdistfiles/node-sass
> npm WARN prepublish-on-install As of npm@5, `prepublish` scripts are  
> deprecated.
> npm WARN prepublish-on-install Use `prepare` for build steps and  
> `prepublishOnly` for upload-only.
> npm WARN prepublish-on-install See the deprecation note in `npm help  
> scripts` for more information.
> npm WARN lifecycle node-sass@4.7.2~prepublish: cannot run in wd %s %s  
> (wd=%s) node-sass@4.7.2 not-in-install && node scripts/prepublish.js ||  
> in-install /portdistfiles/node-sass
> npm WARN ajv-keywords@1.5.1 requires a peer of ajv@>=4.10.0 but none is  
> installed. You must install peer dependencies yourself.
>
> up to date in 2.13s
> => SHA256 Checksum OK for sass-node-sass-v4.7.2_GH0.tar.gz.
> ===========================================================================
> =======================<phase: extract-depends>============================
> ===========================================================================
> =======================<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
> /bin/cp /usr/ports/textproc/node-sass/files/package-lock.json  
> /portdistfiles/node-sass
> cp: /portdistfiles/node-sass/package-lock.json: Permission denied
> *** Error code 1
>
> Stop.
> make: stopped in /usr/ports/textproc/node-sass
> =>> Cleaning up wrkdir
> ===>  Cleaning for node-sass-4.7.2
> build of textproc/node-sass | node-sass-4.7.2 ended at Sun Feb 25  
> 02:33:55 UTC 2018
>
>
>> (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)
>>
>> What's wrong? That part of port code didn't change for some time.
>>
>> Marcin

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.

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

You'll have to redefine HOME there because npm writes to $HOME/.npm, which  
causes a stage-fs violation.

# Adam


--
Adam Weinberger
adamw@adamw.org
http://www.adamw.org





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?371FB508-F90E-41E4-8B3D-85F7DA54FFAA>