On 2012/05/08 22:08, Aaron Bieber wrote: > Lawrence Teo pointed out that having "/usr/ports/" hard coded is a bad > idea. > > This updated diff fixes that:
I actually think this is a bit of a bad idea, because it's not resolved at runtime it means it produces packages dependent on the directory layout of the build machine, which is more likely to have a 'special' dir layout due to the large number of distfiles needed, whereas on a machine where the package would be installed, /usr/ports/distfiles is much more common. As it's a bit of a hack in the first place, and the fallback mechanism does work (as long as you don't have systrace enabled), I think if it's done this way, it's probably better hardcoded. On the other hand, it would be cleaner to actually include the tar.gz file in the *package* and patch node-gyp to use that instead. It's simpler too, we don't need a fallback mechanism because the file is going to be there. If you think this adds too much to the size of the packages (current amd64 package, ~4MB, tar.gz adds another 10MB or so) then node-gyp could be made into a subpackage instead, but 14MB isn't terribly huge and I certainly wouldn't object to just including it there. What does anyone else think? > Index: Makefile > =================================================================== > RCS file: /cvs/ports/www/node/Makefile,v > retrieving revision 1.35 > diff -N -u -p Makefile > --- Makefile 8 May 2012 15:38:01 -0000 1.35 > +++ Makefile 9 May 2012 04:04:59 -0000 > @@ -11,7 +11,7 @@ COMMENT= V8 JavaScript for clients and servers > NODE_VERSION= v0.6.17 > DISTNAME= node-${NODE_VERSION} > PKGNAME= ${DISTNAME:S/v//g} > -REVISION= 1 > +REVISION= 2 > > CATEGORIES= www devel > > @@ -47,6 +47,7 @@ REGRESS_TARGET= test > CONFIGURE_STYLE= simple > > SUBST_VARS+= CFLAGS > +SUBST_VARS+= DISTDIR > > MAKE_ENV+= CXX=c++ CCFLAGS+="${CFLAGS}" CXXFLAGS="${CXXFLAGS}" > > @@ -56,7 +57,8 @@ pre-configure: > @# Bad practice, but prevents a whole stack of patches. > ln -sf ${LOCALBASE}/bin/python${MODPY_VERSION} ${WRKDIR}/bin/python > ${SUBST_CMD} ${WRKDIST}/lib/module.js \ > - ${WRKDIST}/deps/npm/node_modules/node-gyp/lib/configure.js > + ${WRKDIST}/deps/npm/node_modules/node-gyp/lib/configure.js \ > + ${WRKDIST}/deps/npm/node_modules/node-gyp/lib/install.js > > post-install: > ${MODPY_BIN} ${MODPY_LIBDIR}/compileall.py \ > Index: patches/patch-deps_npm_node_modules_node-gyp_lib_install_js > =================================================================== > RCS file: patches/patch-deps_npm_node_modules_node-gyp_lib_install_js > diff -N -u -p patches/patch-deps_npm_node_modules_node-gyp_lib_install_js > --- /dev/null 8 May 2012 22:04:59 -0000 > +++ patches/patch-deps_npm_node_modules_node-gyp_lib_install_js 9 May > 2012 04:04:59 -0000 > @@ -0,0 +1,30 @@ > +$OpenBSD$ > +--- deps/npm/node_modules/node-gyp/lib/install.js.orig Tue May 8 > 20:06:20 2012 > ++++ deps/npm/node_modules/node-gyp/lib/install.js Tue May 8 20:08:56 2012 > +@@ -166,11 +166,21 @@ function install (gyp, argv, callback) { > + extracter.on('error', cb) > + extracter.on('end', afterTarball) > + > +- // download the tarball, gunzip and extract! > +- var req = download(tarballUrl, downloadError) > +- .pipe(gunzip) > +- .pipe(extracter) > +- > ++ var filePath = '${DISTDIR}/node-v' + version + '.tar.gz'; > ++ gyp.info('If this fails, please ensure ' + filePath + ' exists!!') > ++ fs.stat(filePath, function(err, stat) { > ++ if (err) { > ++ // download the tarball > ++ var req = download(tarballUrl, downloadError) > ++ .pipe(gunzip) > ++ .pipe(extracter) > ++ } else { > ++ // use existing tarball > ++ fs.createReadStream(filePath) > ++ .pipe(gunzip) > ++ .pipe(extracter) > ++ } > ++ }); > + // something went wrong downloading the tarball? > + function downloadError (err, res) { > + if (err || res.statusCode != 200) { >