11.1SjwiseProposal: NetBSD System Installation Packages
21.1Sjwise=============================================
31.1Sjwise
41.1SjwiseCONTENTS
51.1Sjwise--------
61.1Sjwise0. Introduction
71.1Sjwise1. System Packages
81.1Sjwise  1.1 Package Format
91.1Sjwise  1.2 Package Granularity
101.1Sjwise    1.2.1 Root/User/Share separation
111.1Sjwise2. Package Sets
121.1Sjwise  2.1 Set format
131.1Sjwise3. Creation of Packages and Sets
141.1Sjwise4. Modifications to the NetBSD installation process
151.1SjwiseA. Working Plan
161.1Sjwise
171.1Sjwise------------------------------------------------------------------------
181.1Sjwise
191.1Sjwise0. Introduction
201.1Sjwise
211.1Sjwise  The current NetBSD installation process involves the downloading
221.1Sjwise  of binary `sets', which the user can choose among at install time.
231.1Sjwise  A set is a tarred, gzipped set of files, to be untarred relative
241.1Sjwise  to '/'.  No facility exists to choose convenient subsets of the files
251.1Sjwise  in a set to be installed, or to remove a set which has been installed.
261.1Sjwise
271.1Sjwise  The current granularity of sets is very large, being divided into:
281.1Sjwise
291.1Sjwise  	base	-- general system binaries
301.1Sjwise	comp	-- compilers and related tools
311.1Sjwise	etc	-- system configuration files
321.1Sjwise	games	-- games and other amusements
331.1Sjwise	man	-- system manual pages
341.1Sjwise	misc	-- items not falling into other categories
351.1Sjwise	secr	-- items not exportable under US law
361.1Sjwise	text	-- text processing tools
371.3Sabs	xbase	-- general X11R7 binaries
381.3Sabs	xcomp	-- X11R7 development items
391.3Sabs	xfont	-- X11R7 fonts
401.3Sabs	xserver -- X11R7 servers for various video hardware
411.1Sjwise
421.1Sjwise  Users who wish to install part of a set need to either install
431.1Sjwise  the full set and then determine which files they need to remove,
441.1Sjwise  or abandon the normal install process, and figure out which files
451.1Sjwise  to unpack by hand.  Similarly, if a set is later determined to
461.1Sjwise  be unnecessary, the only way to remove it is to figure out which
471.1Sjwise  files on the system belonged to that set, and remove them by hand.
481.1Sjwise
491.1Sjwise  When it comes time to upgrade a system which has been installed this
501.1Sjwise  way, the usual procedure is to unpack a new version of each installed
511.1Sjwise  set over the previous version.  When a file is moved, renamed, or
521.1Sjwise  removed in a newer version of a set, the old version often remains on
531.1Sjwise  the system for some time.  In at least one recent instance (the move
541.1Sjwise  of /sbin/mountd to /usr/sbin/mountd) this has resulted in much
551.1Sjwise  confusion, and large amounts of traffic on the relevant mailing lists.
561.1Sjwise
571.1Sjwise  The remainder of this document describes a proposed method of handling
581.1Sjwise  these and other problems with the current install set system by
591.1Sjwise  moving to the use of fine-grained `system packages', based on the
601.1Sjwise  currently existing package system for third-party software, and
611.1Sjwise  allowing users to choose among either `package sets' at the same
621.1Sjwise  granularity as our current install sets, or individual `packages'
631.1Sjwise  at a much finer level of granularity.  In either case, the new system
641.1Sjwise  would also greatly simplify upgrading or removal of such packages
651.1Sjwise  and sets at a later time, and would allow tracking of dependencies
661.1Sjwise  between the various sets and packages distributed as part of NetBSD.
671.1Sjwise
681.1Sjwise  First, the format of system packages in the proposed system is
691.1Sjwise  discussed, followed by the format of package sets, which will serve
701.1Sjwise  as a replacement for the current install sets.  The creation of
711.1Sjwise  packages in an automated fashion from a NetBSD source tree is
721.1Sjwise  discussed as is the effect of this system on the NetBSD installation
731.1Sjwise  process.  An appendix discusses my work plan to implement this new
741.1Sjwise  system.
751.1Sjwise
761.1Sjwise  It is hoped that this document will serve as a basis for discussion
771.1Sjwise  of what is involved in changing NetBSD to use system packages for
781.1Sjwise  system installation and upgrades, and that after several iterations
791.1Sjwise  of discussion and revision, it will serve as a plan for the actual
801.1Sjwise  implementation of this system.
811.1Sjwise
821.1Sjwise------------------------------------------------------------------------
831.1Sjwise
841.1Sjwise1. System Packages
851.1Sjwise
861.1Sjwise  System packages will be the basic building blocks of a NetBSD system.
871.1Sjwise  At install time, the user will choose which system packages to install,
881.1Sjwise  subject to dependencies between packages.  After system install,
891.1Sjwise  users will be able to install additional packages or remove installed
901.1Sjwise  packages.  When it comes time to upgrade the system, packages can
911.1Sjwise  be removed and reinstalled in a reliable fashion.  All of this
921.1Sjwise  functionality is already available for third-party software via the
931.1Sjwise  use of the software package system in /usr/pkgsrc.  This proposal
941.1Sjwise  extends that functionality to the NetBSD system itself.
951.1Sjwise
961.1Sjwise1.1 Package Format
971.1Sjwise
981.1Sjwise  System packages will be identical in format to the binary packages
991.1Sjwise  used by the current third-party package system.  This will allow the
1001.1Sjwise  same tools to be used for working with system packages as are
1011.1Sjwise  currently used for working with third-party packages.  This will also
1021.1Sjwise  also allow the system to benefit from the fact that the workings of
1031.1Sjwise  the current package system are well understood.
1041.1Sjwise
1051.1Sjwise1.2 Package Granularity
1061.1Sjwise
1071.1Sjwise  System packages will be at the granularity of groups of related tools
1081.1Sjwise  and their support files.  Thus, `Kerberos', `UUCP', `Text formatting'
1091.1Sjwise  and `amd' might each be packages which depended on nothing but a few
1101.1Sjwise  base packages, while `C Development' and `Fortran development' might
1111.1Sjwise  be separate packages which each depended upon `Binutils' and `Base
1121.1Sjwise  EGCS utilities' packages.  Packages sets, described below, would add
1131.1Sjwise  the ability to choose entire broad categories of software to install,
1141.1Sjwise  like todays install sets, while maintaining the ability to remove
1151.1Sjwise  individual packages later.
1161.1Sjwise
1171.1Sjwise1.2.1 Root/User/Share separation
1181.1Sjwise
1191.1Sjwise  In order to support a variety of system configurations, it is crucial
1201.1Sjwise  that the new package system support the possibility of some part of
1211.1Sjwise  a system residing on a server and possibly being shared between
1221.1Sjwise  multiple machines on a network.  A machine which has some filesystems
1231.1Sjwise  local and some shared must, at the very least, be able to add and
1241.1Sjwise  remove packages from local filesystems, and should be able to
1251.1Sjwise  determine what packages have been added or removed from the volumes
1261.1Sjwise  mounted over the network.
1271.1Sjwise
1281.1Sjwise  The most common shared configurations are to have a system share
1291.1Sjwise  /usr/share from the network, and have all other filesystems local,
1301.1Sjwise  or to share the entirety of /usr from the network, and maintain
1311.1Sjwise  local root and /var hierarchies, possibly as a single filesystem.
1321.3Sabs  Other commonly shared hierarchies include /usr/X11R7 and /usr/pkg.
1331.1Sjwise
1341.1Sjwise  Two steps are necessary to support this type of sharing: the system
1351.1Sjwise  must be able to check separate repositories for packages installed
1361.1Sjwise  on different filesystems, and packages must be designed so as to
1371.1Sjwise  allow a client to install only those parts of the system which reside
1381.1Sjwise  on local filesystems.
1391.1Sjwise  
1401.1Sjwise  The first of these is addressed by a set of patches described by
1411.1Sjwise  Alistair Crooks in a post to the netbsd-current mailing list on
1421.1Sjwise  Friday, September 18, 1998.  These patches, which have not yet been
1431.1Sjwise  committed cause third-party software packages installed in /usr/pkg
1441.1Sjwise  to be registered in /usr/pkg/etc/pkg, and packages installed in
1451.3Sabs  /usr/X11R7 to be registered in /usr/X11R7/etc/pkg.  This could be
1461.1Sjwise  extended easily to allow sharing of system package installations by
1471.3Sabs  having the new system X11R7 packages also use /usr/X11R7/etc/pkg
1481.1Sjwise  for package registration, to have system packages installed in /usr
1491.1Sjwise  use /usr/etc/pkg for package registration, and to have system
1501.1Sjwise  packages installed in / and /var use /etc/pkg for package
1511.1Sjwise  registration.  This would allow all of the types of filesystem
1521.1Sjwise  sharing described above, without introducing too much complication
1531.1Sjwise  into the package system.
1541.1Sjwise
1551.1Sjwise  The second step, that of insuring that a client can choose to install
1561.1Sjwise  only the parts of the system which reside on local volumes can be
1571.1Sjwise  most easily addressed by careful consideration of package contents.
1581.1Sjwise  A look through the contents of the current install sets suggests
1591.1Sjwise  that relatively few packages will in fact need to install in more
1601.3Sabs  than one of /, /usr, /usr/share and /usr/X11R7.  Were such packages
1611.1Sjwise  split into separate components, based on filesystem boundaries,
1621.1Sjwise  users would easily be able to install only the parts which are local
1631.1Sjwise  in their particular configuration.
1641.1Sjwise
1651.1Sjwise------------------------------------------------------------------------
1661.1Sjwise
1671.1Sjwise2. Package Sets
1681.1Sjwise
1691.1Sjwise  In moving to fine-grained system packages, it is important that
1701.1Sjwise  beginning users still be able to select broad categories of software
1711.1Sjwise  to install at once.  The introduction of `package sets', analogous
1721.1Sjwise  in granularity, but not mechanism, to the current binary install sets
1731.1Sjwise  addresses this concern, while maintaining the ability of more advanced
1741.1Sjwise  users to choose among individual packages at install time, and
1751.1Sjwise  maintaining the ability to remove, upgrade, or add individual
1761.1Sjwise  packages at a later time.
1771.1Sjwise
1781.1Sjwise  These package sets will maintain the same layout as the current
1791.1Sjwise  install sets, so that a user who chooses the same sets as he would
1801.1Sjwise  have chosen now will see the same results.  In the new system,
1811.1Sjwise  however, these sets will be made up of binary packages, and installing
1821.1Sjwise  a set will simply result in the installation of the constituent
1831.1Sjwise  packages.
1841.1Sjwise
1851.1Sjwise2.1 Set format
1861.1Sjwise
1871.1Sjwise  A set will be a tar archive containing the packages which make up the
1881.1Sjwise  set plus a contents file.  At the least, the index file will contain
1891.1Sjwise  the name of each included package, plus a one line description of each
1901.1Sjwise  package's contents.  Installation utilities will offer the option of
1911.1Sjwise  installing the whole set, or choosing among individual packages,
1921.1Sjwise  based on the descriptions in the contents file.  It is expected that the
1931.1Sjwise  contents file itself will be automatically generated from the one-line
1941.1Sjwise  descriptions provided in each package's pkg/COMMENT file.
1951.1Sjwise
1961.1Sjwise  When a set is installed, the contents file will be recorded in a
1971.1Sjwise  manner similar to the registration of package information in the
1981.1Sjwise  current third-party package system.  This will allow users to remove
1991.1Sjwise  an entire set at a later date, without needing to know what individual
2001.1Sjwise  packages came from that set.
2011.1Sjwise
2021.1Sjwise------------------------------------------------------------------------
2031.1Sjwise
2041.1Sjwise3. Creation of Packages and Sets
2051.1Sjwise
2061.1Sjwise  Under the current distribution-building system, the Makefile in
2071.1Sjwise  /usr/src/etc creates binary install sets from an installed system,
2081.1Sjwise  based on the set lists in /usr/src/distrib/sets/lists.  In the new
2091.1Sjwise  system, a new directory hierarchy, /usr/src/distrib/pkg, will
2101.1Sjwise  contain Makefiles and data files relevant to the creation of
2111.1Sjwise  system packages and package sets.
2121.1Sjwise
2131.1Sjwise  The directory /usr/src/distrib/pkg/sets will contain a directory
2141.1Sjwise  for each package set, and each of these directories will contain
2151.1Sjwise  a directory for each package in that set.  The Makefile in
2161.1Sjwise  /usr/src/distrib/pkg/sets will recurse into these set directories
2171.1Sjwise  to build each set.  The individual set Makefiles will recurse into
2181.1Sjwise  each package directory to build the individual packages, and will
2191.1Sjwise  then create a set file from the constituent packages and from the
2201.1Sjwise  contents file, which will be automatically generated from the
2211.1Sjwise  package directories.
2221.1Sjwise
2231.1Sjwise  The package directories will resemble the package directories for
2241.1Sjwise  third-party software packages in /usr/pkgsrc, except that they will
2251.1Sjwise  probably rely on the files making up the package already being
2261.1Sjwise  present in ${DESTDIR}, rather than building them directly.  This
2271.1Sjwise  assumption is already present in the current distribution package
2281.1Sjwise  Makefile code, and is probably reasonable to keep.
2291.1Sjwise
2301.1Sjwise------------------------------------------------------------------------
2311.1Sjwise
2321.1Sjwise4. Modifications to the NetBSD installation process
2331.1Sjwise
2341.1Sjwise  Once the NetBSD system is available as system packages and package
2351.1Sjwise  sets, it will be possible to modify the various installation tools
2361.1Sjwise  to use these sets to install the system.  It is expected that
2371.1Sjwise  installation tools will default to allow users to choose among
2381.1Sjwise  package sets at install time, but allow an `advanced mode' in which
2391.1Sjwise  packages could be selected and deselected on an individual basis.
2401.1Sjwise
2411.1Sjwise  This will require that the various package tools (at least pkg_add)
2421.1Sjwise  be present on install media to be used with system packages.
2431.1Sjwise  Modifications to sysinst and other install tools are beyond the
2441.1Sjwise  current scope of this proposal, but will be necessary to take
2451.1Sjwise  advantage of the new capabilities provided by this system.
2461.1Sjwise
2471.1Sjwise------------------------------------------------------------------------
2481.1Sjwise
2491.1SjwiseA. Working Plan
2501.1Sjwise
2511.1Sjwise  My current plan for implementing system packages and package sets
2521.1Sjwise  for NetBSD consists of four steps.  All of these steps should be
2531.1Sjwise  taken in the CVS source tree (segregated into src/distrib/pkg, of
2541.1Sjwise  course), and hopefully will involve other contributors in addition
2551.1Sjwise  to myself:
2561.1Sjwise
2571.1Sjwise    1.) Hammer this proposal into a more detailed specification
2581.1Sjwise    
2591.1Sjwise        I am submitting this proposal now in the hopes that it
2601.1Sjwise	will spark discussion which will lead to a refinement
2611.1Sjwise	of the planned system package system.  Once some sort
2621.1Sjwise	of consensus is reached on the relevant mailing lists,
2631.1Sjwise	I will begin work in earnest on implementing this.
2641.1Sjwise
2651.1Sjwise    2.) Create the /usr/src/distrib/pkg hierarchy, and a template
2661.1Sjwise        package
2671.1Sjwise
2681.1Sjwise	The first step in actually implementing this system will
2691.1Sjwise	be to create either an actual or mocked-up system package
2701.1Sjwise	which can be used as a template for creation of the
2711.1Sjwise	remaining system packages.
2721.1Sjwise
2731.1Sjwise    3.) Create system packages
2741.1Sjwise
2751.1Sjwise        I expect that this step will involve most of the actual
2761.1Sjwise	work in implementing the new system.  Packages will have
2771.1Sjwise	to be created for each functional group of binaries
2781.1Sjwise	currently shipped with NetBSD.  A lot of discussion and
2791.1Sjwise	design will have to go into the decisions as to how
2801.1Sjwise	many packages should make up each set and what files
2811.1Sjwise	belong in which packages.
2821.1Sjwise
2831.1Sjwise    4.) Create Package Sets
2841.1Sjwise
2851.1Sjwise        Once all system packages exist, it will be necessary to
2861.1Sjwise	put together some code to automatically generate set
2871.1Sjwise	contents files and to create sets from each directory
2881.1Sjwise	of packages in /usr/src/distrib/pkg/sets.
2891.1Sjwise
2901.1Sjwise  Once these steps are complete, NetBSD will have system packages,
2911.1Sjwise  and it will be possible to begin looking at modifying the NetBSD
2921.1Sjwise  install process to use them.  It is important to note that none
2931.1Sjwise  of these changes will require modifying the current installation
2941.1Sjwise  set building code in any way, so the use of the current system
2951.1Sjwise  can continue unhindered while the new system is being implemented.
2961.1Sjwise
2971.1Sjwise------------------------------------------------------------------------
2981.3Sabs$Id: PROPOSAL,v 1.3 2021/11/02 22:02:42 abs Exp $
299