xref: /netbsd-src/distrib/syspkg/notes/PROPOSAL (revision 6bf98a75969ff8f3fed18a7d59df1f98f11e9d57)
1dec9565bSjwiseProposal: NetBSD System Installation Packages
2dec9565bSjwise=============================================
3dec9565bSjwise
4dec9565bSjwiseCONTENTS
5dec9565bSjwise--------
6dec9565bSjwise0. Introduction
7dec9565bSjwise1. System Packages
8dec9565bSjwise  1.1 Package Format
9dec9565bSjwise  1.2 Package Granularity
10dec9565bSjwise    1.2.1 Root/User/Share separation
11dec9565bSjwise2. Package Sets
12dec9565bSjwise  2.1 Set format
13dec9565bSjwise3. Creation of Packages and Sets
14dec9565bSjwise4. Modifications to the NetBSD installation process
15dec9565bSjwiseA. Working Plan
16dec9565bSjwise
17dec9565bSjwise------------------------------------------------------------------------
18dec9565bSjwise
19dec9565bSjwise0. Introduction
20dec9565bSjwise
21dec9565bSjwise  The current NetBSD installation process involves the downloading
22dec9565bSjwise  of binary `sets', which the user can choose among at install time.
23dec9565bSjwise  A set is a tarred, gzipped set of files, to be untarred relative
24dec9565bSjwise  to '/'.  No facility exists to choose convenient subsets of the files
25dec9565bSjwise  in a set to be installed, or to remove a set which has been installed.
26dec9565bSjwise
27dec9565bSjwise  The current granularity of sets is very large, being divided into:
28dec9565bSjwise
29dec9565bSjwise  	base	-- general system binaries
30dec9565bSjwise	comp	-- compilers and related tools
31dec9565bSjwise	etc	-- system configuration files
32dec9565bSjwise	games	-- games and other amusements
33dec9565bSjwise	man	-- system manual pages
34dec9565bSjwise	misc	-- items not falling into other categories
35dec9565bSjwise	secr	-- items not exportable under US law
36dec9565bSjwise	text	-- text processing tools
37*6bf98a75Sabs	xbase	-- general X11R7 binaries
38*6bf98a75Sabs	xcomp	-- X11R7 development items
39*6bf98a75Sabs	xfont	-- X11R7 fonts
40*6bf98a75Sabs	xserver -- X11R7 servers for various video hardware
41dec9565bSjwise
42dec9565bSjwise  Users who wish to install part of a set need to either install
43dec9565bSjwise  the full set and then determine which files they need to remove,
44dec9565bSjwise  or abandon the normal install process, and figure out which files
45dec9565bSjwise  to unpack by hand.  Similarly, if a set is later determined to
46dec9565bSjwise  be unnecessary, the only way to remove it is to figure out which
47dec9565bSjwise  files on the system belonged to that set, and remove them by hand.
48dec9565bSjwise
49dec9565bSjwise  When it comes time to upgrade a system which has been installed this
50dec9565bSjwise  way, the usual procedure is to unpack a new version of each installed
51dec9565bSjwise  set over the previous version.  When a file is moved, renamed, or
52dec9565bSjwise  removed in a newer version of a set, the old version often remains on
53dec9565bSjwise  the system for some time.  In at least one recent instance (the move
54dec9565bSjwise  of /sbin/mountd to /usr/sbin/mountd) this has resulted in much
55dec9565bSjwise  confusion, and large amounts of traffic on the relevant mailing lists.
56dec9565bSjwise
57dec9565bSjwise  The remainder of this document describes a proposed method of handling
58dec9565bSjwise  these and other problems with the current install set system by
59dec9565bSjwise  moving to the use of fine-grained `system packages', based on the
60dec9565bSjwise  currently existing package system for third-party software, and
61dec9565bSjwise  allowing users to choose among either `package sets' at the same
62dec9565bSjwise  granularity as our current install sets, or individual `packages'
63dec9565bSjwise  at a much finer level of granularity.  In either case, the new system
64dec9565bSjwise  would also greatly simplify upgrading or removal of such packages
65dec9565bSjwise  and sets at a later time, and would allow tracking of dependencies
66dec9565bSjwise  between the various sets and packages distributed as part of NetBSD.
67dec9565bSjwise
68dec9565bSjwise  First, the format of system packages in the proposed system is
69dec9565bSjwise  discussed, followed by the format of package sets, which will serve
70dec9565bSjwise  as a replacement for the current install sets.  The creation of
71dec9565bSjwise  packages in an automated fashion from a NetBSD source tree is
72dec9565bSjwise  discussed as is the effect of this system on the NetBSD installation
73dec9565bSjwise  process.  An appendix discusses my work plan to implement this new
74dec9565bSjwise  system.
75dec9565bSjwise
76dec9565bSjwise  It is hoped that this document will serve as a basis for discussion
77dec9565bSjwise  of what is involved in changing NetBSD to use system packages for
78dec9565bSjwise  system installation and upgrades, and that after several iterations
79dec9565bSjwise  of discussion and revision, it will serve as a plan for the actual
80dec9565bSjwise  implementation of this system.
81dec9565bSjwise
82dec9565bSjwise------------------------------------------------------------------------
83dec9565bSjwise
84dec9565bSjwise1. System Packages
85dec9565bSjwise
86dec9565bSjwise  System packages will be the basic building blocks of a NetBSD system.
87dec9565bSjwise  At install time, the user will choose which system packages to install,
88dec9565bSjwise  subject to dependencies between packages.  After system install,
89dec9565bSjwise  users will be able to install additional packages or remove installed
90dec9565bSjwise  packages.  When it comes time to upgrade the system, packages can
91dec9565bSjwise  be removed and reinstalled in a reliable fashion.  All of this
92dec9565bSjwise  functionality is already available for third-party software via the
93dec9565bSjwise  use of the software package system in /usr/pkgsrc.  This proposal
94dec9565bSjwise  extends that functionality to the NetBSD system itself.
95dec9565bSjwise
96dec9565bSjwise1.1 Package Format
97dec9565bSjwise
98dec9565bSjwise  System packages will be identical in format to the binary packages
99dec9565bSjwise  used by the current third-party package system.  This will allow the
100dec9565bSjwise  same tools to be used for working with system packages as are
101dec9565bSjwise  currently used for working with third-party packages.  This will also
102dec9565bSjwise  also allow the system to benefit from the fact that the workings of
103dec9565bSjwise  the current package system are well understood.
104dec9565bSjwise
105dec9565bSjwise1.2 Package Granularity
106dec9565bSjwise
107dec9565bSjwise  System packages will be at the granularity of groups of related tools
108dec9565bSjwise  and their support files.  Thus, `Kerberos', `UUCP', `Text formatting'
109dec9565bSjwise  and `amd' might each be packages which depended on nothing but a few
110dec9565bSjwise  base packages, while `C Development' and `Fortran development' might
111dec9565bSjwise  be separate packages which each depended upon `Binutils' and `Base
112dec9565bSjwise  EGCS utilities' packages.  Packages sets, described below, would add
113dec9565bSjwise  the ability to choose entire broad categories of software to install,
114dec9565bSjwise  like todays install sets, while maintaining the ability to remove
115dec9565bSjwise  individual packages later.
116dec9565bSjwise
117dec9565bSjwise1.2.1 Root/User/Share separation
118dec9565bSjwise
119dec9565bSjwise  In order to support a variety of system configurations, it is crucial
120dec9565bSjwise  that the new package system support the possibility of some part of
121dec9565bSjwise  a system residing on a server and possibly being shared between
122dec9565bSjwise  multiple machines on a network.  A machine which has some filesystems
123dec9565bSjwise  local and some shared must, at the very least, be able to add and
124dec9565bSjwise  remove packages from local filesystems, and should be able to
125dec9565bSjwise  determine what packages have been added or removed from the volumes
126dec9565bSjwise  mounted over the network.
127dec9565bSjwise
128dec9565bSjwise  The most common shared configurations are to have a system share
129dec9565bSjwise  /usr/share from the network, and have all other filesystems local,
130dec9565bSjwise  or to share the entirety of /usr from the network, and maintain
131dec9565bSjwise  local root and /var hierarchies, possibly as a single filesystem.
132*6bf98a75Sabs  Other commonly shared hierarchies include /usr/X11R7 and /usr/pkg.
133dec9565bSjwise
134dec9565bSjwise  Two steps are necessary to support this type of sharing: the system
135dec9565bSjwise  must be able to check separate repositories for packages installed
136dec9565bSjwise  on different filesystems, and packages must be designed so as to
137dec9565bSjwise  allow a client to install only those parts of the system which reside
138dec9565bSjwise  on local filesystems.
139dec9565bSjwise
140dec9565bSjwise  The first of these is addressed by a set of patches described by
141dec9565bSjwise  Alistair Crooks in a post to the netbsd-current mailing list on
142dec9565bSjwise  Friday, September 18, 1998.  These patches, which have not yet been
143dec9565bSjwise  committed cause third-party software packages installed in /usr/pkg
144dec9565bSjwise  to be registered in /usr/pkg/etc/pkg, and packages installed in
145*6bf98a75Sabs  /usr/X11R7 to be registered in /usr/X11R7/etc/pkg.  This could be
146dec9565bSjwise  extended easily to allow sharing of system package installations by
147*6bf98a75Sabs  having the new system X11R7 packages also use /usr/X11R7/etc/pkg
148dec9565bSjwise  for package registration, to have system packages installed in /usr
149dec9565bSjwise  use /usr/etc/pkg for package registration, and to have system
150dec9565bSjwise  packages installed in / and /var use /etc/pkg for package
151dec9565bSjwise  registration.  This would allow all of the types of filesystem
152dec9565bSjwise  sharing described above, without introducing too much complication
153dec9565bSjwise  into the package system.
154dec9565bSjwise
155dec9565bSjwise  The second step, that of insuring that a client can choose to install
156dec9565bSjwise  only the parts of the system which reside on local volumes can be
157dec9565bSjwise  most easily addressed by careful consideration of package contents.
158dec9565bSjwise  A look through the contents of the current install sets suggests
159dec9565bSjwise  that relatively few packages will in fact need to install in more
160*6bf98a75Sabs  than one of /, /usr, /usr/share and /usr/X11R7.  Were such packages
161dec9565bSjwise  split into separate components, based on filesystem boundaries,
162dec9565bSjwise  users would easily be able to install only the parts which are local
163dec9565bSjwise  in their particular configuration.
164dec9565bSjwise
165dec9565bSjwise------------------------------------------------------------------------
166dec9565bSjwise
167dec9565bSjwise2. Package Sets
168dec9565bSjwise
169dec9565bSjwise  In moving to fine-grained system packages, it is important that
170dec9565bSjwise  beginning users still be able to select broad categories of software
171dec9565bSjwise  to install at once.  The introduction of `package sets', analogous
172dec9565bSjwise  in granularity, but not mechanism, to the current binary install sets
173dec9565bSjwise  addresses this concern, while maintaining the ability of more advanced
174dec9565bSjwise  users to choose among individual packages at install time, and
175dec9565bSjwise  maintaining the ability to remove, upgrade, or add individual
176dec9565bSjwise  packages at a later time.
177dec9565bSjwise
178dec9565bSjwise  These package sets will maintain the same layout as the current
179dec9565bSjwise  install sets, so that a user who chooses the same sets as he would
180dec9565bSjwise  have chosen now will see the same results.  In the new system,
181dec9565bSjwise  however, these sets will be made up of binary packages, and installing
182dec9565bSjwise  a set will simply result in the installation of the constituent
183dec9565bSjwise  packages.
184dec9565bSjwise
185dec9565bSjwise2.1 Set format
186dec9565bSjwise
187dec9565bSjwise  A set will be a tar archive containing the packages which make up the
188dec9565bSjwise  set plus a contents file.  At the least, the index file will contain
189dec9565bSjwise  the name of each included package, plus a one line description of each
190dec9565bSjwise  package's contents.  Installation utilities will offer the option of
191dec9565bSjwise  installing the whole set, or choosing among individual packages,
192dec9565bSjwise  based on the descriptions in the contents file.  It is expected that the
193dec9565bSjwise  contents file itself will be automatically generated from the one-line
194dec9565bSjwise  descriptions provided in each package's pkg/COMMENT file.
195dec9565bSjwise
196dec9565bSjwise  When a set is installed, the contents file will be recorded in a
197dec9565bSjwise  manner similar to the registration of package information in the
198dec9565bSjwise  current third-party package system.  This will allow users to remove
199dec9565bSjwise  an entire set at a later date, without needing to know what individual
200dec9565bSjwise  packages came from that set.
201dec9565bSjwise
202dec9565bSjwise------------------------------------------------------------------------
203dec9565bSjwise
204dec9565bSjwise3. Creation of Packages and Sets
205dec9565bSjwise
206dec9565bSjwise  Under the current distribution-building system, the Makefile in
207dec9565bSjwise  /usr/src/etc creates binary install sets from an installed system,
208dec9565bSjwise  based on the set lists in /usr/src/distrib/sets/lists.  In the new
209dec9565bSjwise  system, a new directory hierarchy, /usr/src/distrib/pkg, will
210dec9565bSjwise  contain Makefiles and data files relevant to the creation of
211dec9565bSjwise  system packages and package sets.
212dec9565bSjwise
213dec9565bSjwise  The directory /usr/src/distrib/pkg/sets will contain a directory
214dec9565bSjwise  for each package set, and each of these directories will contain
215dec9565bSjwise  a directory for each package in that set.  The Makefile in
216dec9565bSjwise  /usr/src/distrib/pkg/sets will recurse into these set directories
217dec9565bSjwise  to build each set.  The individual set Makefiles will recurse into
218dec9565bSjwise  each package directory to build the individual packages, and will
219dec9565bSjwise  then create a set file from the constituent packages and from the
220dec9565bSjwise  contents file, which will be automatically generated from the
221dec9565bSjwise  package directories.
222dec9565bSjwise
223dec9565bSjwise  The package directories will resemble the package directories for
224dec9565bSjwise  third-party software packages in /usr/pkgsrc, except that they will
225dec9565bSjwise  probably rely on the files making up the package already being
226dec9565bSjwise  present in ${DESTDIR}, rather than building them directly.  This
227dec9565bSjwise  assumption is already present in the current distribution package
228dec9565bSjwise  Makefile code, and is probably reasonable to keep.
229dec9565bSjwise
230dec9565bSjwise------------------------------------------------------------------------
231dec9565bSjwise
232dec9565bSjwise4. Modifications to the NetBSD installation process
233dec9565bSjwise
234dec9565bSjwise  Once the NetBSD system is available as system packages and package
235dec9565bSjwise  sets, it will be possible to modify the various installation tools
236dec9565bSjwise  to use these sets to install the system.  It is expected that
237dec9565bSjwise  installation tools will default to allow users to choose among
238dec9565bSjwise  package sets at install time, but allow an `advanced mode' in which
239dec9565bSjwise  packages could be selected and deselected on an individual basis.
240dec9565bSjwise
241dec9565bSjwise  This will require that the various package tools (at least pkg_add)
242dec9565bSjwise  be present on install media to be used with system packages.
243dec9565bSjwise  Modifications to sysinst and other install tools are beyond the
244dec9565bSjwise  current scope of this proposal, but will be necessary to take
245dec9565bSjwise  advantage of the new capabilities provided by this system.
246dec9565bSjwise
247dec9565bSjwise------------------------------------------------------------------------
248dec9565bSjwise
249dec9565bSjwiseA. Working Plan
250dec9565bSjwise
251dec9565bSjwise  My current plan for implementing system packages and package sets
252dec9565bSjwise  for NetBSD consists of four steps.  All of these steps should be
253dec9565bSjwise  taken in the CVS source tree (segregated into src/distrib/pkg, of
254dec9565bSjwise  course), and hopefully will involve other contributors in addition
255dec9565bSjwise  to myself:
256dec9565bSjwise
257dec9565bSjwise    1.) Hammer this proposal into a more detailed specification
258dec9565bSjwise
259dec9565bSjwise        I am submitting this proposal now in the hopes that it
260dec9565bSjwise	will spark discussion which will lead to a refinement
261dec9565bSjwise	of the planned system package system.  Once some sort
262dec9565bSjwise	of consensus is reached on the relevant mailing lists,
263dec9565bSjwise	I will begin work in earnest on implementing this.
264dec9565bSjwise
265dec9565bSjwise    2.) Create the /usr/src/distrib/pkg hierarchy, and a template
266dec9565bSjwise        package
267dec9565bSjwise
268dec9565bSjwise	The first step in actually implementing this system will
269dec9565bSjwise	be to create either an actual or mocked-up system package
270dec9565bSjwise	which can be used as a template for creation of the
271dec9565bSjwise	remaining system packages.
272dec9565bSjwise
273dec9565bSjwise    3.) Create system packages
274dec9565bSjwise
275dec9565bSjwise        I expect that this step will involve most of the actual
276dec9565bSjwise	work in implementing the new system.  Packages will have
277dec9565bSjwise	to be created for each functional group of binaries
278dec9565bSjwise	currently shipped with NetBSD.  A lot of discussion and
279dec9565bSjwise	design will have to go into the decisions as to how
280dec9565bSjwise	many packages should make up each set and what files
281dec9565bSjwise	belong in which packages.
282dec9565bSjwise
283dec9565bSjwise    4.) Create Package Sets
284dec9565bSjwise
285dec9565bSjwise        Once all system packages exist, it will be necessary to
286dec9565bSjwise	put together some code to automatically generate set
287dec9565bSjwise	contents files and to create sets from each directory
288dec9565bSjwise	of packages in /usr/src/distrib/pkg/sets.
289dec9565bSjwise
290dec9565bSjwise  Once these steps are complete, NetBSD will have system packages,
291dec9565bSjwise  and it will be possible to begin looking at modifying the NetBSD
292dec9565bSjwise  install process to use them.  It is important to note that none
293dec9565bSjwise  of these changes will require modifying the current installation
294dec9565bSjwise  set building code in any way, so the use of the current system
295dec9565bSjwise  can continue unhindered while the new system is being implemented.
296dec9565bSjwise
297dec9565bSjwise------------------------------------------------------------------------
298*6bf98a75Sabs$Id: PROPOSAL,v 1.3 2021/11/02 22:02:42 abs Exp $
299