Subject: Sub package proposal
To: None <tech-pkg@netbsd.org>
From: TAKEMURA Shin <takemura@netbsd.org>
List: tech-pkg
Date: 10/21/2000 22:46:45
Hi

I want to improve pkg_* comanads to save disk space. On some
platfroms like hpcmips, you can't use large disk space because you
have to use PC card or CF instead of HDD. Currently, max size of CF
is up to 160MB or so and it's very expensive.

The basic idea is that I want to install a part of a package. Mostly,
I need man pages but I don't need document files. To do that, I want
to introduce 'sub package'. We have to define some 'pre-defined sub
packages', for example,

  - core
    this contains essential files of the package.
    (typically, executable binaries and shared objects)
  - ext
    additional files to provide extended functions.
    (for example, executable binaries which are used in special case)
  - dev
    files which are need for development.
    (include header files, *.h and static libraries, *.a)
  - sample
    sample data
  - man
    man pages
  - doc
    documents excepting man pages.

All packages should have these sub packages in it and pkg_add and
pkg_delete commands should take care of sub packages. All files of a
package should belong to a pre-defined sub package. It needs some
new directives for PLIST and +CONTENTS.

 - @if <sub_package_name> ~ @endif
   files which are surrounded this directive should be installed only
   if user specified to install <sub_package_name>.
 - @installed <sub_package_name>...
   +CONTENTS should contain this directive to record which sub
   package were installed.

User can specify which sub packages should be installed in pkg_add
command line or with environment variable. If you don't specifiy any
sub packages, all files of packages will be installed.

Here is an example, which explains how that works.

  PLIST:
        @name bash
        bin/bash
        @if ext
        bin/bashbug
        @endif
        @if man
        man/man1/bash.1.gz
        man/man1/bashbug.1.gz
        @endif
        @if doc
        info/bash.info
        share/doc/bash/article.ps.gz
        share/doc/bash/bashref.ps.gz
        share/doc/bash/bash.html
        share/doc/bash/bashref.html
        share/doc/bash/article.txt
        @endif

  environment variable:
        PKG_SUBPACKAGES='core man'

  command line:
        pkg_add bash-2.04.tar.gz +ext

  pkg_add sets internal variable for each sub packages:
        core=1, ext=1, dev=0, sample=0, man=1, doc=0

  and install files:
        bin/bash
        bin/bashbug
        man/man1/bash.1.gz
        man/man1/bashbug.1.gz

  +CONTENTS should be:
        @installed core ext man
        @name bash
        bin/bash
        @if ext
        bin/bashbug
        @endif
        @if man
        man/man1/bash.1.gz
        man/man1/bashbug.1.gz
        @endif
        @if doc
        info/bash.info
        share/doc/bash/article.ps.gz
        share/doc/bash/bashref.ps.gz
        share/doc/bash/bash.html
        share/doc/bash/bashref.html
        share/doc/bash/article.txt
        @endif

  if command line is like:
        pkg_add bash-2.04.tar.gz -man

  pkg_add will install only:
        bin/bash

I think the modification has compatibility with current pkgsrc and
installed packages so that users and package mainteners can transfer
to the new pkg_* commands.

Please comment.
I'm going to start hacking on pkg_add and pkg_delete.

Takemura