Subject: Re: pkgsrc installing binary packages
To: Jeremy C. Reed <reed@reedmedia.net>
From: Hubert Feyrer <hubert.feyrer@informatik.fh-regensburg.de>
List: tech-pkg
Date: 05/03/2001 04:08:58
On Wed, 2 May 2001, Jeremy C. Reed wrote:
> I want it to be recursive; I want it to try remote FTP servers.

pkg_add is always native. 
And for the remote FTP servers... well, shouldn't be hard to do that...

>  rainier:/usr/pkgsrc/games/pacman$ export
>  PKG_PATH=ftp://ftp.netbsd.org/pub/NetBSD/packages/1.5.1/i386/All/

Note that we'll put 1.5.1 pkgs in a "1.5" dir as both are binary
compatible. (Yes, that's a change to 1.4 and 1.3 :-). 


>  rainier:/usr/pkgsrc/games/pacman$ make bin-install 2>&1 | tee LOG
>  Please unset PKG_PATH before doing pkgsrc works!
> 
> I want to be able to use PKG_PATH. But to work-around this, I retrieved
> one of the required files and put into /usr/pkgsrc/packages/All.

Try the patch below to make 'bin-install' set PKG_PATH automatically for
now. It's a quick hack but might indeed work. Let me know if/if not.

Doing pkgsrc work with PKG_PATH set has too many side effects, that's why
it's prevented. If you want to fix it, send patches. :)


>  rainier:/usr/pkgsrc/games/pacman$ make bin-install 2>&1 | tee LOG
>  Installing from source
>  ===> Validating dependencies for Pacman-0.3
>  => Checksum OK for Pacman-0.3-CVS-00-11-17.tar.gz.
>  ===> Extracting for Pacman-0.3
>  ===> Required package ClanLib>=0.2.2: NOT found
>  ===> Verifying package for ../../graphics/clanlib
>  ===> Validating dependencies for ClanLib-0.4.4
>  => ClanLib-0.4.4.tar.gz doesn't seem to exist on this system.
>  => Attempting to fetch ClanLib-0.4.4.tar.gz from
>  http://dark.x.dtu.dk/~mbn/clanlib/download/.
> 
> I want it to use /usr/pkgsrc/packages/All/ClanLib-0.4.4.tgz instead of
> building from source. (But for anything missing, then use the source.)

set DEPENDS_TARGET=bin-install.


 - Hubert

Here's the patch for bin-install to try FTP:

--- bsd.pkg.mk  2001/04/26 08:35:38     1.730
+++ bsd.pkg.mk  2001/05/03 02:03:40
@@ -2613,10 +2613,15 @@
                ${ECHO_MSG} "Installing from binary pkg ${PKGFILE}" ;   \
                ${PKG_ADD} ${PKGFILE} ;                                 \
        else                                                            \
-               ${SHCOMMENT} Cycle through some FTP server here ;\
-               ${ECHO_MSG} "Installing from source" ;                  \
-               ${MAKE} ${MAKEFLAGS} package &&                         \
-               ${MAKE} ${MAKEFLAGS} clean ;                            \
+               rel=`uname -r | sed 's@\.\([0-9]*\)[\._].*@\.\1@'`;     \
+               arch=`sysctl -n hw.machine_arch`;                       \
+               ${SETENV} PKG_PATH="ftp://ftp.netbsd.org/pub/NetBSD/packages/$${rel}/$${arch}/All" ${PKG_ADD} ${PKGFILE} ;                      \
+               if ! ${PKG_INFO} -e ${PKGNAME} ; then \
+                       ${SHCOMMENT} Cycle through some FTP server here ;\
+                       ${ECHO_MSG} "Installing from source" ;          \
+                       ${MAKE} ${MAKEFLAGS} package &&                 \
+                       ${MAKE} ${MAKEFLAGS} clean ;                    \
+               fi ; \
        fi
 


-- 
Hubert Feyrer <hubert.feyrer@informatik.fh-regensburg.de>