Subject: Re: questions on package system
To: None <tech-pkg@netbsd.org>
From: Greg A. Woods <woods@most.weird.com>
List: tech-pkg
Date: 03/11/2000 12:52:41
[ On Saturday, March 11, 2000 at 12:37:04 (-0400), David Maxwell wrote: ]
> Subject: Re: questions on package system
>
> > > 3. Is there recommended way to test for X installed on the
> > >    build target in the Makefile?
> > 
> > USE_X11=yes
> 
> That says the package uses X. To test for X - (For a package 
> that builds both text and gui mode apps?) I don't see
> a canonical example. How about this?
> 
> .if exists (${X11BASE})

I would not like that test to be used.  It would potentially cause
binary packages to fail to run on a target machine that did not have X11
installed.

However that does mean that there needs to be some way to communicate
system dependencies to the pkg system, at least until the system itself
uses the pkg system exclusively too.  At the moment there are probably
only maybe three important system "options": crypto, IPV6, and X11.
Other difference, such as specific optional kernel services like SYSVSHM
are not "important" in this sense in that they are really and truly only
run-time dependencies and can be "installed" on a system at any time
without really disrupting the target system in any way.  That is to say
that the lack of these "unimportant" dependencies on any given target
system is not reason to prevent installation of a binary package that
depends upon them.

Perhaps for now all packages which have "important" target system
dependencies, such as X11, should have a REQ (hopefully renamed to
REQUIRE R.S.N.!) script that does a test for the required feature.
Perhaps this could even be done relatively painlessly and automatically
by putting a couple of very simple constraints on the way such scripts
are written so that they can be automatically extended to include
commonly required procedures such as these dependency tests.  In the
case of X11 (i.e. when a pkgsrc Makefile declares USE_X11=yes) the pkg
build system could include a default REQUIRE script, or include a
procedure in an existing REQUIRE script, that tests for X11 on the
target system.

FYI I've written a number of REQUIRE scripts for pkgsrc modules I've
upgraded or written which include tests for system dependencies and they
do work very well for binary-only systems.  I've found that care has to
be take though to really think through the implications of failing an
installation requirement vs. simply doing the install and assuming the
pkg won't "run" until the requirement has been fulfilled.  In the case
where additional software needs to be installed or upgraded I think a
fail is worthwhile.  I think that even extends to kernel services
(i.e. when a kernel needs to be re-compiled, tested, and installed).
However failing the installation of a package that requires the
portmapper just because it isn't currently running obviously isn't very
productive.  (Having the package install turn on the portmap startup
automatically is different issue and is related to whether or not
packages should automatically enable their startup on boot or not.)

I've also done a global s/REQ/REQUIRE/ on my pkgsrc system too -- I
think such unnecessary and superfluous abberations in naming conventions
make systems really hard to understand and maintain, especially for
people who do not speak English as a first language.

-- 
							Greg A. Woods

+1 416 218-0098      VE3TCP      <gwoods@acm.org>      <robohack!woods>
Planix, Inc. <woods@planix.com>; Secrets of the Weird <woods@weird.com>