1 USAGE_LICENSE="[-author?Glenn Fowler <glenn.s.fowler@gmail.com>][-copyright?Copyright (c) 1994-2015 AT&T Intellectual Property][-license?http://www.eclipse.org/org/documents/epl-v10.html]"
2 ########################################################################
4 # This software is part of the ast package #
5 # Copyright (c) 1994-2013 AT&T Intellectual Property #
6 # and is licensed under the #
7 # Eclipse Public License, Version 1.0 #
8 # by AT&T Intellectual Property #
10 # A copy of the License is available at #
11 # http://www.eclipse.org/org/documents/epl-v10.html #
12 # (with md5 checksum b35adb5213ca9657e911e9befb180842) #
14 # Information and Software Systems Research #
18 # Glenn Fowler <glenn.s.fowler@gmail.com> #
20 ########################################################################
21 ### this script contains archaic constructs that work with all sh variants ###
22 # package - source and binary package control
23 # Glenn Fowler <gsf@research.att.com>
27 case $-:$BASH_VERSION in
28 *x*:[0123456789]*) : bash set -x is broken :; set +ex ;;
31 # ksh checks -- ksh between 2007-11-05 and 2011-11-11 conflict with new -lcmd -- wea culpa
34 egrep 'Version.*(88|1993)' $1 >/dev/null 2>&1 ||
35 $1 -c '(( .sh.version >= 20111111 ))' >/dev/null 2>&1
38 case $_AST_BIN_PACKAGE_:$SHELL:$0 in
42 _AST_BIN_PACKAGE_=1 # prevent non-interactive sh .rc referencing bin/package recursion #
43 export _AST_BIN_PACKAGE_
45 then : no -lcmd conflict :
47 *" debug "*|*" DEBUG "*|*" show "*)
48 echo $command: $SHELL: warning: possible -lcmd conflict -- falling back to /bin/sh >&2
61 src="cmd contrib etc lib"
62 use="/usr/common /exp /usr/local /usr/add-on /usr/addon /usr/tools /usr /opt"
64 lib="" # nee /usr/local/lib /usr/local/shlib
65 ccs="/usr/kvm /usr/ccs/bin"
67 makefiles="Mamfile Nmakefile nmakefile Makefile makefile"
68 env="HOSTTYPE NPROC PACKAGEROOT INSTALLROOT PATH"
70 checksum_commands="$checksum md5"
71 checksum_empty="d41d8cd98f00b204e9800998ecf8427e"
73 package_use='=$HOSTTYPE=$PACKAGEROOT=$INSTALLROOT=$EXECROOT=$CC='
75 PACKAGE_admin_tail_timeout=${PACKAGE_admin_tail_timeout:-"1m"}
82 admin_ditto="ditto --checksum --delete --verbose"
83 admin_ditto_update=--update
84 admin_ditto_skip="OFFICIAL|core|old|*.core|*.tmp|.nfs*"
85 admin_list='PACKAGE.$type.lst'
86 admin_ping="ping -c 1 -w 5"
90 default_url=default.url
91 MAKESKIP=${MAKESKIP:-"*[-.]*"}
99 all_types='*.*|sun4' # all but sun4 match *.*
101 case `(getopts '[-][123:xyz]' opt --xyz; echo 0$opt) 2>/dev/null` in
104 @(#)$Id: package (AT&T Research) 2013-12-05 $
106 [+NAME?package - source and binary package control]
107 [+DESCRIPTION?The \bpackage\b command controls source and binary
108 packages. It is a \bsh\b(1) script coded for maximal portability. All
109 package files are in the \b$PACKAGEROOT\b directory tree.
110 \b$PACKAGEROOT\b must at minumum contain a \bbin/package\b command or a
111 \blib/package\b directory. Binary package files are in the
112 \b$INSTALLROOT\b (\b$PACKAGEROOT/arch/\b\ahosttype\a) tree, where
113 \ahosttpe\a=`\bpackage\b`. All \aactions\a but \bhost\b and \buse\b
114 require the current directory to be under \b$PACKAGEROOT\b. See
115 \bDETAILS\b for more information.]
116 [+?Note that no environment variables need be set by the user;
117 \bpackage\b determines the environment based on the current working
118 directory. The \buse\b action starts a \bsh\b(1) with the environment
119 initialized. \bCC\b, \bCCFLAGS\b, \bHOSTTYPE\b and \bSHELL\b may be set
120 by explicit command argument assignments to override the defaults.]
121 [+?Packages are composed of components. Each component is built and
122 installed by an \bast\b \bnmake\b(1) makefile. Each package is also
123 described by an \bnmake\b makefile that lists its components and
124 provides a content description. The package makefile and component
125 makefiles provide all the information required to read, write, build
126 and install packages.]
127 [+?Package recipients only need \bsh\b(1) and \bcc\b(1) to build and
128 install source packages, and \bsh\b to install binary packages.
129 \bnmake\b and \bksh93\b are required to write new packages. An
130 \b$INSTALLROOT/bin/cc\b script may be supplied for some architectures.
131 This script supplies a reasonable set of default options for compilers
132 that accept multiple dialects or generate multiple object/executable
134 [+?The command arguments are composed of a sequence of words: zero or
135 more \aqualifiers\a, one \aaction\a, and zero or more action-specific
136 \aarguments\a, and zero or more \aname=value\a definitions. \apackage\a
137 names a particular package. The naming scheme is a \b-\b separated
138 hierarchy; the leftmost parts describe ownership, e.g.,
139 \bgnu-fileutils\b, \bast-base\b. If no packages are specified then all
140 packages are operated on. \boptget\b(3) documentation options are also
141 supported. The default with no arguments is \bhost type\b.]
142 [+?The qualifiers are:]
144 [+authorize \aname\a?Remote authorization user name or license
146 [+debug|environment?Show environment and actions but do not
148 [+flat?Collapse \b$INSTALLROOT\b { bin fun include lib } onto
150 [+force?Force the action to override saved state.]
151 [+never?Run make -N and show other actions.]
152 [+only?Only operate on the specified packages.]
153 [+password \apassword\a?Remote authorization or license
154 acceptance password.]
155 [+quiet?Do not list captured action output.]
156 [+show?Run make -n and show other actions.]
157 [+verbose?Provide detailed action output.]
158 [+DEBUG?Trace the package script actions in detail.]
162 [+admin\b [\ball\b]] [\bdb\b \afile\a]] [\bon\b \apattern\a]][\aaction\a ...]]?Apply
163 \aaction\a ... to the hosts listed in \afile\a. If \afile\a is
164 omitted then \badmin.db\b is assumed. The caller must have
165 \brcp\b(1) and \brsh\b(1) or \bscp\b(1) and \bssh\b(1) access
166 to the hosts. Output for \aaction\a is saved per-host in the
167 file \aaction\a\b.log/\b\ahost\a. Logs can be viewed by
168 \bpackage admin\b [\bon\b \ahost\a]] \bresults\b [\aaction\a]].
169 By default only local PACKAGEROOT hosts are selected from
170 \afile\a; \ball\b selects all hosts. \bon\b \apattern\a selects
171 only hosts matching the \b|\b separated \apattern\a. \afile\a
172 contains four types of lines. Blank lines and lines beginning
173 with \b#\b are ignored. Lines starting with \aid\a=\avalue\a
174 are variable assignments. Set admin_ping to local conventions
175 if \"'$admin_ping$'\" fails. If a package list is not specified
176 on the command line the \aaction\a applies to all packages; a
177 variable assigment \bpackage\b=\"\alist\a\" applies \aaction\a
178 to the packages in \alist\a for subsequent hosts in \afile\a.
179 The remaining line type is a host description consisting of 6
180 tab separated fields. The first 3 are mandatory; the remaining
181 3 are updated by the \badmin\b action. \afile\a is saved in
182 \afile\a\b.old\b before update. The fields are:]
184 [+hosttype?The host type as reported by
186 [+[user@]]host?The host name and optionally user name
187 for \brcp\b(1) and \brsh\b(1) access.]
188 [+[remote::[[master]]::]]]]PACKAGEROOT?The absolute remote package
189 root directory and optionally the remote protocol (rsh
190 or ssh) if the directory is on a different server than
191 the master package root directory. If
192 \blib/package/admin/'$admin_env$'\b exists under this
193 directory then it is sourced by \bsh\b(1) before
194 \aaction\a is done. If this field begins with \b-\b
195 then the host is ignored. If this field contains \b:\b
196 then \bditto\b(1) is used to sync the remote \bsrc\b
197 directory hierarchy to the local one. If [\amaster\a]]:
198 is specified then the sync is deferred to the \amaster\a
199 host. If \amaster\a is omitted (two :) then the sync is
200 disabled. These directories must exist on the remote side:
201 \blib/package\b, \bsrc/cmd\b, \bsrc/lib\b.]
202 [+date?\aYYMMDD\a of the last action.]
203 [+time?Elapsed wall time for the last action.]
204 [+M T W?The \badmin\b action \bmake\b, \btest\b and
205 \bwrite\b action error counts. A non-numeric value in
206 any of these fields disables the corresponding action.]
207 [+owner?The owner contact information.]
208 [+attributes?\aname=value\a attributes. Should at least contain
209 \bcc\b=\acompiler-version\a.]
211 [+clean | clobber?Delete the \barch/\b\aHOSTTYPE\a hierarchy; this
212 deletes all generated files and directories for \aHOSTTYPE\a.
213 The heirarchy can be rebuilt by \bpackage make\b.]
214 [+contents\b [ \apackage\a ... ]]?List description and
215 components for \apackage\a on the standard output.]
216 [+copyright\b [ \apackage\a ... ]]?List the general copyright
217 notice(s) for \apackage\a on the standard output. Note that
218 individual components in \apackage\a may contain additional or
219 replacement notices.]
220 [+export\b [ \avariable\a ...]]?List \aname\a=\avalue\a for
221 \avariable\a, one per line. If the \bonly\b attribute is
222 specified then only the variable values are listed. If no
223 variables are specified then \b'$env$'\b are assumed.]
224 [+help\b [ \aaction\a ]]?Display help text on the standard
225 error (standard output for \aaction\a).]
226 [+host\b [ \aattribute\a ... ]]?List
227 architecture/implementation dependent host information on the
228 standard output. \btype\b is listed if no attributes are
229 specified. Information is listed on a single line in
230 \aattribute\a order. The attributes are:]
232 [+canon \aname\a?An external host type name to be
233 converted to \bpackage\b syntax.]
234 [+cpu?The number of cpus; 1 if the host is not a
236 [+name?The host name.]
237 [+rating?The cpu rating in pseudo mips; the value is
238 useful useful only in comparisons with rating values of
239 other hosts. Other than a vax rating (mercifully) fixed
240 at 1, ratings can vary wildly but consistently from
241 vendor mips ratings. \bcc\b(1) may be required to
242 determine the rating.]
243 [+type?The host type, usually in the form
244 \avendor\a.\aarchitecture\a, with an optional trailing
245 -\aversion\a. The main theme is that type names within
246 a family of architectures are named in a similar,
247 predictable style. OS point release information is
248 avoided as much as possible, but vendor resistance to
249 release incompatibilities has for the most part been
252 [+html\b [ \aaction\a ]]?Display html help text on the standard
253 error (standard output for \aaction\a).]
254 [+install\b [ \aarchitecture\a ... ]] \adirectory\a [ \apackage\a ... ]]?Copy
255 the package binary hierarchy to \adirectory\a. If
256 \aarchitecture\a is omitted then all architectures are
257 installed. If \bflat\b is specified then exactly one
258 \aarchitecture\a must be specified; this architecture will be
259 installed in \adirectory\a without the \barch/\b\aHOSTTYPE\a
260 directory prefixes. Otherwise each architecture will be
261 installed in a separate \barch/\b\aHOSTTYPE\a subdirectory of
262 \adirectory\a. The \aarchitecture\a \b-\b names the current
263 architecture. \adirectory\a must be an existing directory. If
264 \apackage\a is omitted then all binary packages are installed.
265 This action requires \bnmake\b.]
266 [+license\b [ \apackage\a ... ]]?List the source license(s) for
267 \apackage\a on the standard output. Note that individual
268 components in \apackage\a may contain additional or replacement
270 [+list\b [ \apackage\a ... ]]?List the name, version and
271 prerequisites for \apackage\a on the standard output.]
272 [+make\b [ \apackage\a ]] [ \aoption\a ... ]] [ \atarget\a ... ]]?Build
273 and install. The default \atarget\a is \binstall\b, which makes
274 and installs \apackage\a. If the standard output is a terminal
275 then the output is also captured in
276 \b$INSTALLROOT/lib/package/gen/make.out\b. The build is done in
277 the \b$INSTALLROOT\b directory tree viewpathed on top of the
278 \b$PACKAGEROOT\b directory tree. If \bflat\b is specified then
279 the \b$INSTALLROOT\b { bin fun include lib } directories are
280 linked to the same directories in the package root. Only one
281 architecture may be \bflat\b. Leaf directory names matching the
282 \b|\b-separated shell pattern \b$MAKESKIP\b are ignored. The
283 \bview\b action is done before making. \aoption\a operands are
284 passed to the underlying make command.]
285 [+read\b [ \apackage\a ... | \aarchive\a ... ]]?Read the named
286 package or archive(s). Must be run from the package root
287 directory. Archives are searched for in \b.\b and
288 \blib/package/tgz\b. Each package archive is read only once.
289 The file \blib/package/tgz/\b\apackage\a[.\atype\a]]\b.tim\b
290 tracks the read time. See the \bwrite\b action for archive
291 naming conventions. Text file archive member are assumed to be
292 ASCII or UTF-8 encoded.]
293 [+regress?\bdiff\b(1) the current and previous \bpackage test\b
295 [+release\b [ [\aCC\a]]\aYY-MM-DD\a [ [\acc\a]]\ayy-mm-dd\a ]]]] [ \apackage\a ]]?Display
296 recent changes for the date range [\aCC\a]]\aYY-MM-DD\a (up to
297 [\acc\a]]\ayy-mm-dd\a.), where \b-\b means lowest (or highest.)
298 If no dates are specified then changes for the last 4 months
299 are listed. \apackage\a may be a package or component name.]
300 [+remove\b [ \apackage\a ]]?Remove files installed for
302 [+results\b [ \bfailed\b ]] [ \bpath\b ]] [ \bold\b ]] [\bmake\b | \btest\b | \bwrite\b ]]?List
303 results and interesting messages captured by the most recent
304 \bmake\b (default), \btest\b or \bwrite\b action. \bold\b
305 specifies the previous results, if any (current and previous 9
306 results are retained.) \b$HOME/.pkgresults\b, if it exists,
307 must contain an \begrep\b(1) expression of result lines to be
308 ignored. \bfailed\b lists failures only and \bpath\b lists the
309 results file path name only.]
310 [+setup\b [ beta ]] [ binary ]] [ source ]] [ \aarchitecture\a ... ]] [ \aurl\a ]] [ \apackage\a ... ]]?This
311 action initializes the current directory as a package root, runs the
312 \bupdate\b action to download new or out of date packages, and runs the
313 \bread\b action on those packages. If \bflat\b is specified then the
314 \b$INSTALLROOT\b { bin fun include lib } directories are linked to the
315 same directories in the package root. Only one architecture may be
316 \bflat\b. See the \bupdate\b and \bread\b action descriptions for
318 [+test\b [ \apackage\a ]]?Run the regression tests for
319 \apackage\a. If the standard output is a terminal then the
320 output is also captured in
321 \b$INSTALLROOT/lib/package/gen/test.out\b. In general a package
322 must be made before it can be tested. Components tested with
323 the \bregress\b(1) command require \bksh93\b. If \bonly\b is
324 also specified then only the listed package components are
325 tested, otherwise the closure of the components is tested.]
326 [+update\b [ beta ]] [ binary ]] [ source ]] [\aarchitecture\a ... ]] [ \aurl\a ]] [ \apackage\a ... ]]?Download
327 the latest release of the selected and required packages from \aurl\a
328 (e.g., \bhttp://www.research.att.com/sw/download\b) into the directory
329 \b$PACKAGEROOT/lib/package/tgz\b. \bbeta\b acesses beta packages;
330 download these at your own risk. If \aarchitecture\a is omitted then
331 only architectures already present in the \btgz\b directory will be
332 downloaded. If \aarchitecture\a is \b-\b then all posted architectures
333 will be downloaded. If \aurl\a matches \b*.url\b then it is interpreted
334 as a file containing shell variable assignments for \burl\b,
335 \bauthorize\b and \bpassword\b. If \aurl\a is omitted then the
336 definitions for \burl\b, \bauthorize\b and \bpassword\b in
337 \b$PACKAGEROOT/lib/package/tgz/default.url\b, if it exists, are used.
338 If \b$PACKAGEROOT/lib/package/tgz/default.url\b does not exist then it
339 is initialized with the current \burl\b, \bauthorize\b and \bpassword\b
340 values and read permission for the current user only. If \apackage\a is
341 omitted then only packages already present in the tgz directory will be
342 downloaded. If \apackage\a is \b-\b then all posted packages will be
343 downloaded. If \bsource\b and \bbinary\b are omitted then both source
344 and binary packages will be downloaded. If \bonly\b is specified then
345 only the named packages are updated; otherwise the closure of required
346 packages is updated. This action requires \bwget\b(1), \blynx\b(1),
347 \bcurl\b(1) or a shell that supports io to
348 \b/dev/tcp/\b\ahost\a/\aport\a.]
349 [+use\b [ \auid\a | \apackage\a | . [ 32 | 64 ]] | 32 | 64 | - ]] [ command ...]]?Run
350 \acommand\a, or an interactive shell if \acommand\a is omitted,
351 with the environment initialized for using the package (can you
352 say \ashared\a \alibrary\a or \adll\a without cussing?) If
353 \auid\a or \apackage\a or \a.\a is specified then it is used
354 to determine a \b$PACKAGEROOT\b, possibly different from
355 the current directory. For example, to try out bozo`s package:
356 \bpackage use bozo\b. The \buse\b action may be run from any
357 directory. If the file \b$INSTALLROOT/lib/package/profile\b is
358 readable then it is sourced to initialize the environment. 32 or 64
359 implies \b$PACKAGEROOT\b of . and specifies the target architecture
360 word size (which may be silently ignored.)]
361 [+verify\b [ \apackage\a ]]?Verify installed binary files
362 against the checksum files in
363 \b$INSTALLROOT/lib/\b\apackage\a\b/gen/*.sum\b. The checksum
364 files contain mode, user and group information. If the checksum
365 matches for a given file then the mode, user and group are
366 changed as necessary to match the checksum entry. A warning is
367 printed on the standard error for each mismatch. Requires the
368 \bast\b package \bcksum\b(1) command.]
369 [+view\b?Initialize the architecture specific viewpath
370 hierarchy. If \bflat\b is specified then the \b$INSTALLROOT\b {
371 bin fun include lib } directories are linked to the same
372 directories in the package root. Only one architecture may be
373 \bflat\b. The \bmake\b action implicitly calls this action.]
374 [+write\b [\aformat\a]] \atype\a ... [ \apackage\a ...]]?Write
375 a package archive for \apackage\a. All work is done in the
376 \b$PACKAGEROOT/lib/package\b directory. \aformat\a-specific
377 files are placed in the \aformat\a subdirectory. A
378 \apackage\a[.\atype\a]]\b.tim\b file in this directory tracks
379 the write time and prevents a package from being read in the
380 same root it was written. If more than one file is generated
381 for a particular \aformat\a then those files are placed in the
382 \aformat\a/\apackage\a subdirectory. File names in the
383 \aformat\a subdirectory will contain the package name, a
384 \ayyyy-mm-dd\a date, and for binary packages, \aHOSTTYPE\a. If
385 \apackage\a is omitted then an ordered list of previously
386 written packages is generated. If \bonly\b is specified then
387 only the named packages will be written; otherwise prerequisite
388 packages are written first. Package components must be listed
389 in \apackage\a\b.pkg\b. \aformat\a may be one of:]
391 [+cyg?Generate a \bcygwin\b package.]
392 [+exp?Generate an \bexptools\b maintainer source
393 archive and \aNPD\a file, suitable for \bexpmake\b(1)]
394 [+lcl?Generate a package archive suitable for
395 restoration into the local source tree (i.e., the
396 source is not annotated for licencing.)]
397 [+pkg?Generate a \bpkgmk\b(1) package suitable for
399 [+rpm?Generate an \brpm\b(1) package.]
400 [+tgz?Generate a \bgzip\b(1) \btar\b(1) package
401 archive. This is the default.]
402 [+tst?Generate a \btgz\b format package archive in the
403 \btst\b subdirectory. Version state files are not updated.]
405 [+?\btype\b specifies the package type which must be one of
406 \bsource\b, \bbinary\b or \bruntime\b. A source package
407 contains the source needed to build the corresponding binary
408 package. A binary package includes the libraries and headers
409 needed for compiling and linking against the public interfaces.
410 A runtime package contains the commands and required dynamic
412 [+?A package may be either a \bbase\b or \bdelta\b. A base
413 package contains a complete copy of all components. A delta
414 package contains only changes from a previous base package.
415 Delta recipients must have the \bast\b \bpax\b(1) command (in
416 the \bast-base\b package.) If neither \bbase\b nor \bdelta\b is
417 specified, then the current base is overwritten if there are no
418 deltas referring to the current base. Only the \btgz\b and
419 \blcl\b formats support \bdelta\b. If \bbase\b is specified
420 then a new base and two delta archives are generated: one delta
421 to generate the new base from the old, and one delta to
422 generate the old base from the new; the old base is then
423 removed. If \bdelta\b is specified then a new delta referring
424 to the current base is written.]
425 [+?\apackage\a\b.pkg\b may reference other packages. By default
426 a pointer to those packages is written. The recipient \bpackage
427 read\b will then check that all required packages have been
428 downloaded. If \bclosure\b is specified then the components for
429 all package references are included in the generated package.
430 This may be useful for \blcl\b and versioning.]
431 [+?All formats but \blcl\b annotate each \bsource\b file (not
432 already annotated) with a license comment as it is written to
433 the package archive using \bproto\b(1).]
435 [+DETAILS?The package directory hierarchy is rooted at
436 \b$PACKAGEROOT\b. All source and binaries reside under this tree. A two
437 level viewpath is used to separate source and binaries. The top view is
438 architecture specific, the bottom view is shared source. All building
439 is done in the architecture specific view; no source view files are
440 intentionally changed. This means that many different binary
441 architectures can be made from a single copy of the source.]
442 [+?Independent \b$PACKAGEROOT\b hierarchies can be combined by
443 appending \b$INSTALLROOT:$PACKAGEROOT\b pairs to \bVPATH\b. The
444 \bVPATH\b viewing order is from left to right. Each \b$PACKAGEROOT\b
445 must have a \b$PACKAGEROOT/lib/package\b directory.]
446 [+?Each package contains one or more components. Component source for
447 the \afoo\a command is in \b$PACKAGEROOT/src/cmd/\b\afoo\a, and source
448 for the \abar\a library is in \b$PACKAGEROOT/src/lib/lib\b\abar\a. This
449 naming is for convenience only; the underlying makefiles handle
450 inter-component build order. The \bINIT\b component, which contains
451 generic package support files, is always made first, then the
452 components named \bINIT\b*, then the component order determined by the
453 closure of component makefile dependencies.]
454 [+?\b$PACKAGEROOT/lib/package\b contains package specific files. The
455 package naming convention is \agroup\a[-\apart\a]]; e.g., \bast-base\b,
456 \bgnu-fileutils\b. The *\b.pkg\b files are ast \bnmake\b(1) makefiles
457 that contain the package name, package components, references to other
458 packages, and a short package description. *\b.pkg\b files are used by
459 \bpackage write\b to generate new source and binary packages.]
460 [+?\b$PACKAGEROOT/lib/package/\b\agroup\a\b.lic\b files contain license
461 information that is used by the \bast\b \bproto\b(1) and \bnmake\b(1)
462 commands to generate source and binary license strings. \agroup\a is
463 determined by the first \b:PACKAGE:\b operator name listed in the
464 component \bnmake\b makefile. \agroup\a\b.lic\b files are part of the
465 licensing documentation. Each component may have its own \bLICENSE\b file
466 that overrides the \agroup\a\b.lic\b file. The full text of the licenses
467 are in the \b$PACKAGEROOT/lib/package/LICENSES\b and
468 \b$INSTALLROOT/lib/package/LICENSES\b directories.]
469 [+?A few files are generated in \b$PACKAGEROOT/lib/package/gen\b and
470 \b$INSTALLROOT/lib/package/gen\b. \apackage\a\b.ver\b contains one line
471 consisting of \apackage version release\a \b1\b for the most recent
472 instance of \apackage\a read into \b$PACKAGEROOT\b, where \apackage\a
473 is the package name, \aversion\a is the \aYYYY-MM-DD\a base version,
474 and \arelease\a is \aversion\a for the base release or \aYYYY-MM-DD\a
475 for delta releases. \apackage\a\b.req\b contains *\b.ver\b entries for
476 the packages required by \apackage\a, except that the fourth field is
477 \b0\b instead of \b1\b. All packages except \bINIT\b require the
478 \bINIT\b package. A simple sort of \apackage\a\b.pkg\b and *\b.ver\b
479 determines if the required package have been read in. Finally,
480 \apackage\a\b.README\b and \apackage\a\a.html\b contain the README text
481 for \apackage\a and all its components. Included are all changes added
482 to the component \bRELEASE\b, \bCHANGES\b or \bChangeLog\b files dated
483 since the two most recent base releases. Component \bRELEASE\b files
484 contain tag lines of the form [\aYY\a]]\aYY-MM-DD\a [ \atext\a ]] (or
485 \bdate\b(1) format dates) followed by README text, in reverse
486 chronological order (newer entries at the top of the file.) \bpackage
487 release\b lists this information, and \bpackage contents ...\b lists
488 the descriptions and components.]
489 [+?\b$HOSTYPE\b names the current binary architecture and is determined
490 by the output of \bpackage\b (no arguments.) The \b$HOSTTYPE\b naming
491 scheme is used to separate incompatible executable and object formats.
492 All architecture specific binaries are placed under \b$INSTALLROOT\b
493 (\b$PACKAGEROOT/arch/$HOSTTYPE\b.) There are a few places that match
494 against \b$HOSTTYPE\b when making binaries; these are limited to
495 makefile compiler workarounds, e.g., if \b$HOSTTYPE\b matches \bhp.*\b
496 then turn off the optimizer for these objects. All other architecture
497 dependent logic is handled either by the \bast\b \biffe\b(1) command or
498 by component specific configure scripts. Explicit \b$HOSTYPE\b
499 values matching *,*cc*[,-*,...]] optionally set the default \bCC\b and
500 \bCCFLAGS\b. This is handy for build farms that support different
501 compilers on the same architecture.]
502 [+?Each component contains an \bast\b \bnmake\b(1) makefile (either
503 \bNmakefile\b or \bMakefile\b) and a \bMAM\b (make abstract machine)
504 file (\bMamfile\b.) A Mamfile contains a portable makefile description
505 that is used by \bmamake\b(1) to simulate \bnmake\b. Currently there is
506 no support for old-make/gnu-make makefiles; if the binaries are just
507 being built then \bmamake\b will suffice; if source or makefile
508 modifications are anticipated then \bnmake\b (in the \bast-base\b
509 package) should be used. Mamfiles are automatically generated by
511 [+?Most component C source is prototyped. If \b$CC\b (default value
512 \bcc\b) is not a prototyping C compiler then \bpackage make\b runs
513 \bproto\b(1) on portions of the \b$PACKAGEROOT/src\b tree and places
514 the converted output files in the \b$PACKAGEROOT/proto/src\b tree.
515 Converted files are then viewpathed over the original source.
516 \bproto\b(1) converts an ANSI C subset to code that is compatible with
517 K&R, ANSI, and C++ dialects.]
518 [+?All scripts and commands under \b$PACKAGEROOT\b use \b$PATH\b
519 relative pathnames (via the \bast\b \bpathpath\b(3) function); there
520 are no imbedded absolute pathnames. This means that binaries generated
521 under \b$PACKAGEROOT\b may be copied to a different root; users need
522 only change their \b$PATH\b variable to reference the new installation
523 root \bbin\b directory. \bpackage install\b installs binary packages in
524 a new \b$INSTALLROOT\b.]
526 [ qualifier ... ] [ action ] [ arg ... ] [ n=v ... ]
528 [+SEE ALSO?\bautoconfig\b(1), \bcksum\b(1), \bexecrate\b(1), \bexpmake\b(1),
529 \bgzip\b(1), \bmake\b(1), \bmamake\b(1), \bnmake\b(1), \bpax\b(1),
530 \bpkgadd\b(1), \bpkgmk\b(1), \bproto\b(1), \bratz\b(1), \brpm\b(1),
531 \bsh\b(1), \btar\b(1), \boptget\b(3)]
534 help) set -- --man ;;
536 while getopts -a $command "$USAGE" OPT
593 unset FIGNORE BINDIR DLLDIR ETCDIR FUNDIR INCLUDEDIR LIBDIR LOCALEDIR MANDIR SHAREDIR 2>/dev/null || true
600 admin|clean|clobber|contents|copyright|export|host|install|license|list|make|read|regress|release|remove|results|setup|test|update|use|verify|view|write|TEST)
607 1) echo $command: $1: authorization user name argument expected >&2; exit 1 ;;
615 exec=echo make=echo show=echo
621 never) exec=echo noexec=-N
627 1) echo $command: $1: authorization password argument expected >&2; exit 1 ;;
636 show) exec=echo noexec=-n
641 PS4='+$LINENO:$SECONDS+ '
644 help|HELP|html|man|--[?m]*)
660 <TITLE>$2 package installation instructions</TITLE>
662 <BODY bgcolor=white link=teal vlink=dimgray>"
665 bH="<CENTER><H3><FONT face=courier color=red>"
666 eH='</FONT></H3></CENTER>'
668 bL='<P><TABLE cellpadding=0 cellspacing=2>'
669 bL2='<P><TABLE border=0 cellpadding=0 cellspacing=2>'
671 bT='<TR><TD align=right valign=top><B>'
672 bD='</B></TD><TD align=left>' eD='</TD></TR>'
675 bX='<PRE>' eX='</PRE>'
678 Mcurl='<A href=../../man/man1/curl.html>curl</A>(1)'
679 Mdate='<A href=../../man/man1/date.html>date</A>(1)'
680 Mfile='<A href=../../man/man1/file.html>file</A>(1)'
681 Mgunzip='<A href=../../man/man1/gzip.html>gunzip</A>(1)'
682 Mhurl='<A href=../../man/man1/hurl.html>hurl</A>(1)'
683 Mlynx='<A href=../../man/man1/lynx.html>lynx</A>(1)'
684 Mnmake='<A href=../../man/man1/nmake.html>nmake</A>(1)'
685 Mpackage='<A href=../../man/man1/package.html>package</A>(1)'
686 Mproto='<A href=../../man/man1/proto.html>proto</A>(1)'
687 Mratz='<A href=../../man/man1/ratz.html>ratz</A>'
688 Mtar='<A href=../../man/man1/tar.html>tar</A>(1)'
689 Mwget='<A href=../../man/man1/wget.html>wget</A>(1)'
710 Mpackage='package(1)'
719 ${bH}Binary Package Installation Instructions${eH}
721 ${bT}(1)${bD}Do not install packages as ${bI}root/super-user${eI}. Although some components may
722 have setuid executables, few must be owned by ${bI}root${eI}. These are best
723 changed manually when the security implications are understood.${eD}
724 ${bT}(2)${bD}Choose a package root directory and cd to it. This will be a local work
725 area for all packages.${eD}
726 ${bT}(3)${bD}These instructions bypass the ${bI}click to download${eI} package links on the
727 download site. If you already clicked, or if your system does not have
728 ${Mcurl}, ${Mhurl}, ${Mlynx} or ${Mwget} then use the alternate instructions
729 for (3),(4),(5) in plan ${bB}B${eB} below. Plan ${bB}B${eB} installs the ${Mhurl}
730 script which works with ksh and modern bash. The top level URL is:${bX}
731 URL=http://www.research.att.com/sw/download${eX}${eD}
732 ${bT}(4)${bD}If the ${bB}bin/package${eB} script does not exist then run:${bX}
733 test -d bin || mkdir bin
735 (wget -O - \$url||curl -L \$url||hurl \$url) > bin/package
736 chmod +x bin/package${eX}${eD}
737 ${bT}(5)${bD}Determine the list of package names you want from the download site, then
738 use the ${Mpackage} command to do the actual download:${bX}
739 bin/package authorize \"${bI}NAME${eI}\" password \"${bI}PASSWORD${eI}\" \\
740 setup binary \$URL ${bI}PACKAGE${eI} ...${eX}
741 (Refer to the ${bB}AUTHORIZATION${eB} paragraph on the main download page for
742 ${bI}NAME${eI}/${bI}PASSWORD${eI} details.) This downloads the closure of the latest
743 binary package(s); covered and up-to-date packages are not downloaded again unless
744 ${bB}package force ...${eB} is specified. Package content is verified using ${bB}${checksum}${eB}.
745 If the package root will contain only one architecture then you can install in ${bB}bin${eB} and
746 ${bB}lib${eB} instead of ${bB}arch/${eB}${bI}HOSTTYPE${eI}${bB}/bin${eB} and ${bB}arch/${eB}${bI}HOSTTYPE${eI}${bB}/lib${eB} by running this
748 bin/package authorize \"${bI}NAME${eI}\" password \"${bI}PASSWORD${eI}\" \\
749 flat setup binary \$URL ${bB}PACKAGE${eB} ...${eX}
750 To update the same packages from the same URL run:${bX}
751 bin/package setup binary${eX}${eD}
752 ${bT}(6)${bD}The packaged binaries are position independent, i.e., they do not
753 contain hard-coded paths. However, commands with related files, like
754 ${Mfile} and ${Mnmake}, require the path of the bin directory to be
755 exported in ${bB}PATH${eb}.${eD}
756 ${bT}(7)${bD}You can run the binaries directly from the package root, or you can
757 install them in a public root (requires the ${bI}AT${Camp}T${eI} ${Mnmake} command):${bX}
758 bin/package flat install ${bI}DIRECTORY PACKAGE${eI}${eX}
759 This will install in ${bI}DIRECTORY${eI}${bB}/bin${eB} and ${bI}DIRECTORY${eI}${bB}/lib${eB}. If you want to
760 preserve the ${bB}arch/${eB}${bI}HOSTTYPE${eI} hierarchy under ${bI}DIRECTORY${eI} then omit the
761 ${bB}flat${eB} argument. If you don't have ${Mnmake} then the following will do a
764 cp -p -r bin lib include ${bI}DIRECTORY${eI}${eX}${eD}
765 ${bT}(8)${bD}To summarize, after the first time, the download cycle for the latest
766 binary release is:${bX}
767 bin/package setup binary${eX}${eD}${eL}
769 ${bH}Binary Package Installation Instructions -- Plan B${eH}
771 ${bT}(3)${bD}Create the subdirectory ${bB}lib/package/tgz${eB} and download all package archives
772 into that directory.${eD}
773 ${bT}(4)${bD}If the ${bB}bin/package${eB} script does not exist then manually read the ${bB}INIT${eB}
775 gunzip < lib/package/tgz/INIT.${bI}YYYY-MM-DD.HOSTTYPE${eI}.tgz |
776 ${TAR} ${TARFLAGS}f -${eX}
777 Note that some browsers automatically unzip downloaded without warning.
778 If the gunzip fails try:
779 ${TAR} ${TARFLAGS}f -${eX} lib/package/tgz/INIT.${bI}YYYY-MM-DD.HOSTTYPE${eI}.tgz
780 If your system does not have ${Mtar} or ${Mgunzip} then download the ${Mratz}
783 cp lib/package/tgz/ratz.${bI}YYYY-MM-DD.HOSTTYPE${eI}.exe bin/ratz
785 bin/ratz -lm < lib/package/tgz/INIT.${bI}YYYY-MM-DD/HOSTTYPE${eI}.tgz
786 ${bT}(5)${bD}Read all unread package archive(s):${bX}
787 bin/package read${eX}
788 Both source and binary packages will be read by this step.${eD}${eL}${eO}"
791 ${bH}Package Hierarchy Details${eH}
793 The package directory hierarchy is rooted at ${bB}\$PACKAGEROOT${eB}. All source and
794 binaries reside under this tree. A two level viewpath is used to separate
795 source and binaries. The top view is architecture specific, the bottom view
796 is shared source. All building is done in the architecture specific view;
797 no source view files are intentionally changed. This means that many
798 different binary architectures can be made from a single copy of the source.
800 Each package contains one or more components. Component source for the ${bI}FOO${eI}
801 command is in ${bB}\$PACKAGEROOT/src/cmd/${eB}${bI}FOO${eI}, and source for the ${bI}BAR${eI} library is
802 in ${bB}\$PACKAGEROOT/src/lib/lib${eB}${bI}BAR${eI}. This naming is for convenience only; the
803 underlying makefiles handle inter-component build order. The ${bB}INIT${eB} component,
804 which contains generic package support files, is always made first, then the
805 components named ${bB}INIT${eB}*, then the order determined by the closure of component
806 makefile dependencies.
808 ${bB}\$PACKAGEROOT/lib/package${eB} contains package specific files. The package naming
809 convention is ${bI}GROUP${eI}[${bI}-PART${eI}]; e.g., ${bB}ast-base${eB}, ${bB}gnu-fileutils${eB}. The *${bB}.pkg${eB} files
810 are ${bB}ast${eB} ${Mnmake} makefiles that contain the package name, package components,
811 references to other packages, and a short package description. *${bB}.pkg${eB} files
812 are used by ${bF}package write${eF} to generate new source and binary packages.
814 ${bB}\$PACKAGEROOT/lib/package/${eB}${bI}GROUP${eI}${bB}.lic${eB} files contain license information that
815 is used by the ${bB}ast${eB} ${Mproto} and ${Mnmake} commands to generate source and
816 binary license strings. ${bI}GROUP${eI} is determined by the first ${bB}:PACKAGE:${eB} operator
817 name listed in the component ${bB}nmake${eB} makefile. ${bI}GROUP${eI}${bB}.lic${eB} files are part of the
818 licensing documentation. Each component may have its own ${bB}LICENSE${eB} file that
819 overrides the ${bI}GROUP${eI}${bB}.lic${eB} file. The full text of the licenses are in the
820 ${bB}\$PACKAGEROOT/lib/package/LICENSES${eB} and ${bB}\$INSTALLROOT/lib/package/LICENSES${eB}
823 A few files are generated in ${bB}\$PACKAGEROOT/lib/package/gen${eB} and
824 ${bB}\$INSTALLROOT/lib/package/gen${eB}. ${bI}PACKAGE${eI}${bB}.ver${eB} contains one line consisting of${bX}
825 ${bI}PACKAGE VERSION RELEASE${eI} 1${eX}
826 for the most recent instance of ${bI}PACKAGE${eI} read into ${bB}\$PACKAGEROOT${eB}, where
827 ${bI}PACKAGE${eI} is the package name, ${bI}VERSION${eI} is the ${bI}YYYY-MM-DD${eI} base version,
828 and ${bI}RELEASE${eI} is ${bI}VERSION${eI} for the base release or ${bI}YYYY-MM-DD${eI} for delta releases.
829 ${bI}PACKAGE${eI}${bB}.req${eB} contains *${bB}.ver${eB} entries for the packages required by
830 ${bI}PACKAGE${eI}, except that the fourth field is 0 instead of 1. All packages
831 except ${bB}INIT${eB} and ${Mratz} require the ${bB}INIT${eB} package. A simple sort of ${bI}PACKAGE${eI}${bB}.pkg${eB}
832 and *${bB}.ver${eB} determines if the required package have been read in. Finally,
833 ${bI}PACKAGE${eI}${bB}.README${eB} contains the ${bB}README${eB} text for ${bI}PACKAGE${eI} and all its
834 components. Included are all changes added to the component ${bB}RELEASE${eB},
835 ${bB}CHANGES${eB} or ${bB}ChangeLog${eB} files dated since the two most recent base
836 releases. Component ${bB}RELEASE${eB} files contain tag lines of the form
837 [${bI}CC${eI}]${bI}YY-MM-DD${eI} [ ${bI}TEXT${eI} ] (or ${Mdate} format dates) followed by README
838 text, in reverse chronological order (newer entries at the top of the
839 file.) ${bF}package release${eF} generates this information, and
840 ${bF}package contents ...${eF} lists the descriptions and components.
842 ${bB}\$HOSTYPE${eB} names the current binary architecture and is determined by the
843 output of ${bF}package${eF} (no arguments.) The ${bB}\$HOSTTYPE${eB} naming scheme is used
844 to separate incompatible executable and object formats. All architecture
845 specific binaries are placed under ${bB}\$INSTALLROOT${eB} (${bB}\$PACKAGEROOT/arch/\$HOSTTYPE${eB}.)
846 There are a few places that match against ${bB}\$HOSTTYPE${eB} when making binaries; these
847 are limited to makefile compiler workarounds, e.g., if ${bB}\$HOSTTYPE${eB} matches
848 'hp.*' then turn off the optimizer for these objects. All other architecture
849 dependent logic is handled either by ${bB}\$INSTALLROOT/bin/iffe${eB} or by component
850 specific configure scripts. Explicit ${bB}\$HOSTYPE${eB} values matching *,*cc*[,-*,...]
851 optionally set the default ${bB}CC${eB} and ${bB}CCFLAGS${eB}. This is handy for build
852 farms that support different compilers on the same architecture.
854 Each component contains an ${bB}ast${eB} ${Mnmake} makefile (either ${bB}Nmakefile${eB} or ${bB}Makefile${eB})
855 and a ${bI}MAM${eI} (make abstract machine) file (${bB}Mamfile${eB}.) A Mamfile contains a portable
856 makefile description that is used by ${bB}\$INSTALLROOT/bin/mamake${eB} to simulate
857 ${bB}nmake${eB}. Currently there is no support for old-make/gnu-make makefiles; if
858 the binaries are just being built then ${bB}mamake${eB} will suffice; if source or
859 makefile modifications are anticipated then ${bB}nmake${eB} (from the ${bB}ast-open${eB} or
860 ${bB}ast-base${eB} package) should be used. Mamfiles are automatically generated by
861 ${bF}package write${eF}.
863 Most component C source is prototyped. If ${bB}\$CC${eB} (default value ${bB}cc${eB}) is not a
864 prototyping C compiler then ${bF}package make${eF} runs ${Mproto} on portions of the
865 ${bB}\$PACKAGEROOT/src${eB} tree and places the converted output files in the
866 ${bB}\$PACKAGEROOT/proto/src${eB} tree. Converted files are then viewpathed over the
867 original source. The ${bB}ast${eB} ${Mproto} command converts an ANSI C subset to code
868 that is compatible with K&R, ANSI, and C++ dialects.
870 All scripts and commands under ${bB}\$PACKAGEROOT${eB} use ${bB}\$PATH${eB} relative pathnames;
871 there are no imbedded absolute pathnames. This means that binaries generated
872 under ${bB}\$PACKAGEROOT${eB} may be copied to a different root; users need only change
873 their ${bB}\$PATH${eB} variable to reference the new instalation root bin directory.
874 ${bF}package install${eF} installs binary packages in a new ${bB}\$INSTALLROOT${eB}.
878 ${bH}Source Package Installation Instructions${eH}
880 ${bT}(1)${bD}Do not install packages as ${bI}root/super-user${eI}. Although some components may
881 have setuid executables, few must be owned by ${bI}root${eI}. These are best
882 changed manually when the security implications are understood.${eD}
883 ${bT}(2)${bD}Choose a package root directory and cd to it. This will be a local work
884 area for all packages.
885 ${bT}(3)${bD}These instructions bypass the ${bI}click to download${eI} package links on the
886 download site. If you already clicked, or if your system does not have
887 ${Mcurl}, ${Mhurl}, ${Mlynx} or ${Mwget} then use the alternate instructions
888 for (3),(4),(5) in plan ${bB}B${eB} below. Plan ${bB}B${eB} installs the ${Mhurl}
889 script which works with ksh and modern bash. The top level URL is:${bX}
890 URL=http://www.research.att.com/sw/download${eX}${eD}
891 ${bT}(4)${bD}If the ${bB}bin/package${eB} script does not exist then run:${bX}
892 test -d bin || mkdir bin
894 (wget -O - \$url||curl -L \$url||hurl \$url) > bin/package
895 chmod +x bin/package${eX}${eD}
896 ${bT}(5)${bD}Determine the list of package names you want from the download site, then
897 use the ${Mpackage} command to do the actual download:${bX}
898 bin/package authorize \"${bI}NAME${eI}\" password \"${bI}PASSWORD${eI}\" \\
899 setup source \$URL ${bB}PACKAGE${eB} ...${eX}
900 (Refer to the ${bB}AUTHORIZATION${eB} paragraph on the main download page for
901 ${bI}NAME${eI}/${bI}PASSWORD${eI} details.) This downloads the closure of the latest
902 source package(s); covered and up-to-date packages are not downloaded again unless
903 ${bB}package force ...${eB} is specified. Package content is verified using ${bB}${checksum}${eB}.
904 If the package root will contain only one architecture then you can install in ${bB}bin${eB} and
905 ${bB}lib${eB} instead of ${bB}arch/${eB}${bI}HOSTTYPE${eI}${bB}/bin${eB} and ${bB}arch/${eB}${bI}HOSTTYPE${eI}${bB}/lib${eB} by running this
907 bin/package authorize \"${bI}NAME${eI}\" password \"${bI}PASSWORD${eI}\" \\
908 flat setup source \$URL ${bB}PACKAGE${eB} ...${eX}
909 To update the same packages from the same URL run:${bX}
910 bin/package setup source${eX}${eD}
911 ${bT}(6)${bD}Build and install; all generated files are placed under ${bB}arch/${eB}${bI}HOSTTYPE${eI}
912 (${bB}\$INSTALLROOT${eB}), where ${bI}HOSTTYPE${eI} is the output of ${bB}bin/package${eB} (with no
913 arguments.) ${bI}name=value${eI} arguments are supported; ${bB}CC${eB} and ${bB}debug=1${eB} (compile
914 with -g instead of -O) are likely candidates. The output is written to
915 the terminal and captured in ${bB}\$INSTALLROOT/lib/package/gen/make.out${eB}:${bX}
916 bin/package make${eX}${eD}
917 ${bT}(7)${bD}List make results and interesting errors:${bX}
918 bin/package results${eX}
919 Run the regression tests:${bX}
920 bin/package test${eX}
921 List test results and errors:${bX}
922 bin/package results test${eX}${eD}
923 ${bT}(8)${bD}The generated binaries are position independent, i.e., they do not
924 contain hard-coded paths. However, commands with related files, like
925 ${Mfile} and ${Mnmake}, require the path of the bin directory to be
926 exported in ${bB}PATH${eb}.${eD}
927 ${bT}(9)${bD}You can run the binaries directly from the package root, or you can
928 install them in a public root after you are satisfied with the make and
929 test actions (requires the ${bI}AT${Camp}T${eI} ${Mnmake} command):${bX}
930 bin/package flat install ${bI}DIRECTORY PACKAGE${eI}${eX}
931 This will install in ${bI}DIRECTORY${eI}${bB}/bin${eB} and ${bI}DIRECTORY${eI}${bB}/lib${eB}. If you want to
932 preserve the ${bB}arch/${eB}${bI}HOSTTYPE${eI} hierarchy under ${bI}DIRECTORY${eI} then omit the
933 ${bB}flat${eB} argument. If you don't have ${Mnmake} then the following will do a
936 cp -p -r bin lib include ${bI}DIRECTORY${eI}${eX}${eD}
937 ${bT}(10)${bD}To summarize, after the first time the download, build, and test cycle
938 for the latest source release is:${bX}
939 bin/package setup source
941 bin/package test${eX}${eD}${eL}
943 ${bH}Source Package Installation Instructions -- Plan B${eH}
945 ${bT}(3)${bD}Create the subdirectory ${bB}lib/package/tgz${eB} and download all package archives
946 into that directory.${eD}
947 ${bT}(4)${bD}If the ${bB}bin/package${eB} script does not exist then manually read the ${bB}INIT${eB}
949 gunzip < lib/package/tgz/INIT.${bI}YYYY-MM-DD${eI}.tgz | ${TAR} ${TARFLAGS}f -${eX}
950 Note that some browsers automatically unzip downloaded without warning.
951 If the gunzip fails try:
952 ${TAR} ${TARFLAGS}f -${eX} lib/package/tgz/INIT.${bI}YYYY-MM-DD${eI}.tgz
953 If your system does not have ${Mtar} or ${Mgunzip} then download the ${Mratz}
954 source package, compile it, and manually read the ${bB}INIT${eB}
957 cp lib/package/tgz/ratz.${bI}YYYY-MM-DD${eI}.c lib/package/tgz/ratz.c
958 cc -o bin/ratz lib/package/tgz/ratz.c
959 bin/ratz -lm < lib/package/tgz/INIT.${bI}YYYY-MM-DD${eI}.tgz
960 ${bT}(5)${bD}Read all unread package archive(s):${bX}
961 bin/package read${eX}
962 Both source and binary packages will be read by this step.${eD}${eL}${eO}"
964 *) echo "Usage: $command [ qualifier ... ] [ action ] [ arg ... ] [ n=v ... ]
966 The $command command controls source and binary packages. It must be run
967 within the package root directory tree. See \"$command help intro\" for
968 details. In the following, PACKAGE names either a package or a component
969 within a package; if omitted, all packages are operated on. The default
970 action is \"host type\".
973 authorize NAME Remote authorization name or license acceptance phrase.
974 debug|environment Show environment and actions; do not execute.
975 flat Collapse \$INSTALLROOT { bin fun include lib } onto \$PACKAGEROOT.
976 force Force the action to override saved state.
977 never Run make -N; otherwise show other actions.
978 only Only operate on the specified packages.
979 password PASSWORD Remote authorization or license acceptance password.
980 quiet Do not list captured make and test action output.
981 show Run make -n; otherwise show other actions.
982 DEBUG Trace the package script actions in detail for debugging.
984 admin [ all ] [ db FILE ] [ on PATTERN ] [ action ... ]
985 Apply ACTION ... to the hosts listed in FILE. If FILE is
986 omitted then "admin.db" is assumed. The caller must have rcp(1)
987 and rsh(1) or scp(1) and ssh(1) access to the hosts. Output
988 for the action is saved per-host in ACTION.log/HOST. Logs
989 can be viewed by \"package admin [on HOST] results [ACTION]\".
990 By default only local PACKAGEROOT hosts are selected from FILE;
991 \"all\" selects all hosts. \"on PATTERN\" selects only
992 hosts matching the | separated PATTERN. FILE contains four
993 types of lines. Blank lines and lines beginning with # are
994 ignored. Lines starting with id=value are variable assignments.
995 Set admin_ping to local conventions if \"$admin_ping\" fails.
996 If a package list is not specified on the command line the
997 action applies to all packages; a variable assigment
998 package=list applies action to the packages in list for
999 subsequent hosts in FILE. The remaining line type is a host
1000 description consisting of 6 tab separated fields. The first 3
1001 are mandatory; the remaining 3 are updated by the admin action:
1003 The host type as reported by package.
1005 The host name and optionally user name for rcp(1)
1007 [remote:[[master]:]]PACKAGEROOT
1008 The absolute remote package root directory and
1009 optionally the remote prorocol (rsh or ssh) if
1010 the directory is on a different server than the
1011 master package root directory. If
1012 lib/package/admin/$admin_env exists under
1013 this directory then it is sourced by sh(1)
1014 before ACTION is done. If this field begins with -
1015 then the host is ignored. If this field contains
1016 : then ditto(1) is used to sync the remote src
1017 directory hierarchy to the local one. If [master]:
1018 is specified then the sync is deferred to the
1019 master host. If master is omitted (two :) then
1020 the sync is disabled. These directories must exist
1021 on the remote side: lib/package, src/cmd, src/lib.
1022 date YYMMDD of the last action.
1023 date Elapsed wall time of the last action.
1024 M T W The admin action make, test and write action error
1025 counts. A non-numeric value in any of these fields
1026 disables the corresponding action.
1027 owner The owner contact information.
1029 NAME=VALUE attributes. Should at least contain
1030 cc=compiler-version.
1032 Delete the arch/HOSTTYPE hierarchy; this deletes all generated
1033 files and directories for HOSTTYPE. The heirarchy can be rebuilt
1035 contents [ package ... ]
1036 List description and components for PACKAGE on the standard
1038 copyright [ package ... ]
1039 List the general copyright notice(s) for PACKAGE on the
1040 standard output. Note that individual components in PACKAGE
1041 may contain additional or replacement notices.
1042 export [ VARIABLE ... ]
1043 List NAME=VALUE for each VARIABLE, one per line. If the
1044 \"only\" attribute is specified then only the variable
1045 values are listed. If no variables are specified then
1048 Display help text on the standard error [ standard output
1050 host [ canon cpu name rating type ... ]
1051 List architecture/implementation dependent host information
1052 on the standard output. type is listed if no attributes are
1053 specified. Information is listed on a single line in attributes
1054 order. The attributes are:
1055 canon The next argument is a host type name to be
1056 converted to package syntax.
1057 cpu The number of cpus; 1 if the host is not a
1060 rating The cpu rating in pseudo mips; the value is useful
1061 useful only in comparisons with rating values of
1062 other hosts. Other than a vax rating fixed at 1,
1063 ratings can vary wildly but consistently from
1064 vendor mips ratings. cc(1) may be required to
1065 determine the rating.
1066 type The host type, usually of the form
1067 vendor.architecture, with an optional trailing
1068 -version. The main theme is that type names within
1069 a family of architectures are named in a similar,
1070 predictable style. Os point release information is
1071 avoided as much as possible, but vendor resistance
1072 to release incompatibilities has for the most part
1075 Display html help text on the standard error [ standard output
1077 install [ ARCHITECTURE ... ] DIR [ PACKAGE ... ]
1078 Copy the package binary hierarchy to DIR. If ARCHITECTURE is
1079 omitted then all architectures are installed. If the \"flat\"
1080 attribute is specified then exactly one ARCHITECTURE must be
1081 specified; this architecture will be installed in DIR without
1082 the \"arch/HOSTTYPE\" directory prefixes. Otherwise each
1083 architecture will be installed in a separate \"arch/HOSTTYPE\"
1084 subdirectory of DIR. The ARCHITECTURE - names the current
1085 architecture. DIR must be an existing directory. If PACKAGE
1086 is omitted then all binary packages are installed. This action
1088 license [ package ... ]
1089 List the source license(s) for PACKAGE on the standard output.
1090 Note that individual components in PACKAGE may contain
1091 additional or replacement licenses.
1092 list [ PACKAGE ... ]
1093 List the name, version and prerequisites for PACKAGE on the
1095 make [ PACKAGE ] [ OPTION ... ] [ TARGET ... ]
1096 Build and install. The default TARGET is install, which
1097 makes and installs all packages. If the standard output
1098 is a terminal then the output is also captured in
1099 \$INSTALLROOT/lib/package/gen/make.out. The build is done
1100 in the \$INSTALLROOT directory tree viewpathed on top of
1101 the \$PACKAGEROOT directory tree. If \"flat\" is specified then
1102 the \$INSTALLROOT { bin fun include lib } directories are
1103 linked to the same directories in the package root. Only
1104 one architecture may be flat. Leaf directory names matching
1105 the |-separated shell pattern \$MAKESKIP are ignored. The
1106 view action is done before making. OPTION operands are
1107 passed to the underlying make command.
1108 read [ package ... | archive ... ]
1109 Read the named package archive(s). Must be run from the
1110 package root directory. Archives are searched for in .
1111 and lib/package/tgz. Each package is read only once. The
1112 file lib/package/tgz/package[.type].tim tracks the read time.
1113 See the write action for archive naming conventions. Text
1114 file archive member are assumed to be ASCII or UTF-8 encoded.
1115 regress diff(1) the current and previous package test results.
1116 release [ [CC]YY-MM-DD [ [cc]yy-mm-dd ] ] [ package ]
1117 Display recent changes since [CC]YY-MM-DD (up to [cc]yy-mm-dd),
1118 where - means lowest (or highest.) If no dates are specified
1119 then changes for the last 4 months are listed. PACKAGE may
1120 be a package or component name.
1122 Remove files installed for PACKAGE.
1123 results [ path ] [ old ] [ make | test ]
1124 List results and interesting messages captured by the most
1125 recent make (default), test or write action. old specifies the
1126 previous results, if any (current and previous 9 results are
1127 retained.) $HOME/.pkgresults, if it exists, must contain an
1128 egrep(1) expression of result lines to be ignored. failed lists
1129 failures only and path lists the results file path only.
1130 setup [ beta ] [ binary ] [ source ] [ ARCHITECTURE ... ] [ URL ] [ PACKAGE ... ]
1131 The action initializes the current directory as a package root,
1132 runs the update action to download new or out of date packages,
1133 and runs the read action on those packages. If \"flat\" is
1134 specified then the \$INSTALLROOT { bin fun include lib }
1135 directories are linked to the same directories in the package
1136 root. Only one architecture may be flat. See the update and
1137 read actions for argument details.
1139 Run the regression tests for PACKAGE. If the standard output
1140 is a terminal then the output is also captured in
1141 \$INSTALLROOT/lib/package/gen/test.out. In general a package
1142 must be made before it can be tested. Components tested with
1143 the \bregress\b(1) command require \bksh93\b. If only is
1144 also specified then only the listed package components are
1145 tested, otherwise the closure of the components is tested.
1146 update [ beta ] [ binary ] [ source ] [ ARCHITECTURE ... ] [ URL ] [ PACKAGE ... ]
1147 Download the latest release of the selected and required
1148 packages from URL (e.g.,
1149 http://www.research.att.com/sw/download) into the directory
1150 \$PACKAGEROOT/lib/package/tgz. beta acesses beta packages;
1151 download these at your own risk. If ARCHITECTURE is omitted
1152 then only architectures already present in the tgz directory
1153 will be downloaded. If ARCHITECTURE is - then all posted
1154 architectures will be downloaded. If URL matches *.url then
1155 it is interpreted as a file containing shell variable
1156 assignments for url, authorize and password. If URL is
1157 omitted then the definitions for url, authorize and password
1158 in \$PACKAGEROOT/lib/package/tgz/$default_url, if it exists,
1159 are used. If \$PACKAGEROOT/lib/package/tgz/$default_url does
1160 not exist then it is initialized with the current url,
1161 authorize and password values and read permission for the
1162 current user only. If PACKAGE is omitted then only
1163 packages already present in the tgz directory will be
1164 downloaded. If PACKAGE is - then all posted packages will be
1165 downloaded. If source and binary are omitted then both source
1166 and binary packages will be downloaded. If \bonly\b is
1167 specified then only the named packages are updated; otherwise
1168 the closure of required packages is updated. This action
1169 requires wget(1), lynx(1), curl(1) or a shell that supports
1170 io to /dev/tcp/HOST/PORT.
1171 use [ uid | PACKAGE | . [ 32 | 64 ] | 32 | 64 | - ] [ COMMAND ... ]
1172 Run COMMAND or an interactive shell if COMMAND is omitted, with
1173 the environment initialized for using the package (can you say
1174 shared library without cussing?) If uid or PACKAGE or . is
1175 specified then it is used to determine a \$PACKAGEROOT,
1176 possibly different from the current directory. For example, to
1177 try out bozo's package: \"package use bozo\". In this case the
1178 command may be run from any directory. If the file
1179 \$INSTALLROOT/lib/package/profile is readable then it is
1180 sourced to initialize the environment. 32 or 64 implies
1181 \$PACKAGEROOT of . and specifies the target architecture word
1182 size (which may be silently ignored.)
1184 Verify installed binary files against the checksum files in
1185 \$INSTALLROOT/lib/package/gen/*.sum. The checksum files contain
1186 mode, user and group information. If the checksum matches
1187 for a given file then the mode, user and group are changed
1188 as necessary to match the checksum entry. A warning is printed
1189 on the standard error for each mismatch. Requires the ast
1190 package cksum(1) command.
1192 Initialize the architecture specific viewpath hierarchy. The
1193 make action implicitly calls this action. If \"flat\" is specified
1194 then the \$INSTALLROOT { bin fun include lib } directories are
1195 linked to the same directories in the package root. Only one
1196 architecture may be flat.
1197 write [closure] [cyg|exp|lcl|pkg|rpm|tgz|tst] [base|delta]
1198 [binary|runtime|source] PACKAGE
1199 Write a package archive for PACKAGE. All work is done in the
1200 \$PACKAGEROOT/lib/package directory. FORMAT-specific files
1201 are placed in the FORMAT subdirectory. A PACKAGE[.TYPE].tim
1202 file in this directory tracksthe write time and prevents a
1203 package from being read in the same root it was written. If
1204 more than one file is generated for a particular FORMAT then
1205 those files are placed in the FORMAT/PACKAGE subdirectory.
1206 File names in the FORMAT subdirectory will contain the package
1207 name, a YYYY-MM-DD date, and for binary packages, HOSTTYPE.
1208 If PACKAGE is omitted then an ordered list of previously
1209 written packages is generated. If \"only\" is specified then
1210 only the named packages will be written; otherwise
1211 prerequisite packages are written first. Package components
1212 must be listed in PACKAGE.pkg. FORMAT may be one of:
1213 cyg generate a cygwin package
1214 exp generate an exptools(1) maintainer source archive
1215 and NPD file in the exp subdirectory, suitable for
1216 expmake(1); support files are placed in the
1217 exp/PACKAGE subdirectory
1218 lcl generate a package archive or delta in the lcl
1219 subdirectory, suitable for restoration into the
1220 primary source tree (no source licence annotation)
1221 pkg generate a pkgmk(1) package, suitable for pkgadd(1)
1222 rpm generate an rpm(1) package
1223 tgz generate a gzip(1) tar(1) package archive; this is
1225 tst generate tgz FORMAT package archive in the tst
1226 subdirectory; version state files are not updated
1227 The package type must be one of source, binary or runtime.
1228 A source package contains the source needed to build the
1229 corresponding binary package. A binary package includes the
1230 libraries and headers needed for compiling and linking
1231 against the public interfaces. A runtime package contains
1232 the commands and required dynamic libraries. A package may
1233 be either a base or delta. A base package contains a
1234 complete copy of all components. A delta package contains
1235 only changes from a previous base package. Delta recipients
1236 must have the ast pax(1) command (in the ast-base package.)
1237 If neither base nor delta is specified, then the current
1238 base is overwritten if there are no deltas referring to the
1239 current base. Only the tgz and lcl formats support delta.
1240 If base is specified then a new base and two delta archives
1241 are generated: one delta to generate the new base from the
1242 old, and one delta to generate the old base from the new;
1243 the old base is then removed. If delta is specified then a
1244 new delta referring to the current base is written.
1245 package.pkg may reference other packages. By default a
1246 pointer to those packages is written. The recipient package
1247 read will then check that all required packages have been
1248 downloaded. If closure is specified then the components for
1249 all package references are included in the generated
1250 package. This may be useful for lcl and versioning. All
1251 formats but lcl annotate each source file (not already
1252 annotated) with a license comment as it is written to the
1253 package archive using proto(1).
1255 variable definition: typically CC=cc or CCFLAGS=-g."
1260 *=*) set DEFAULT host type "$@"
1262 *) echo "Usage: $command [ options ] [ qualifier ... ] [ action ] [ arg ... ] [ n=v ... ]" >&2
1270 # gather HOSTTYPE *,* options
1271 # ,*cc*,-*,... set CC and CCFLAGS
1292 -*) case $assign_CCFLAGS in
1293 ?*) assign_CCFLAGS="$assign_CCFLAGS " ;;
1295 assign_CCFLAGS="$assign_CCFLAGS$2"
1307 # collect command line targets and definitions
1309 case $_PACKAGE_HOSTTYPE_ in
1310 ?*) HOSTTYPE=$_PACKAGE_HOSTTYPE_
1324 *:*=*) args="$args $i"
1327 *=*) eval `echo ' ' "$i" | sed 's,^[ ]*\([^=]*\)=\(.*\),n=\1 v='\''\2'\'','`
1332 assign="$assign $n='$v'"
1339 assign_CCFLAGS="CCFLAGS=\"\$CCFLAGS\""
1344 ?*) KEEP_HOSTTYPE=1 ;;
1347 HURL=*) eval $n='$'v
1351 case $PACKAGEROOT in
1352 ?*) KEEP_PACKAGEROOT=1 ;;
1355 SHELL=*)eval $n='$'v
1365 VPATH=*)eval USER_$n='$'v
1368 makeflags="$makeflags --debug-symbols"
1371 makeflags="$makeflags --strip-symbols"
1373 *=*) assign="$assign $n='$v'"
1380 *,*) hostopts $HOSTTYPE ;;
1382 case $assign_CCFLAGS in
1383 ?*) assign="$assign $assign_CCFLAGS"
1390 # grab action specific args
1403 1) echo $command: $action: $1: db file argument expected >&2
1411 1) echo $command: $action: $1: host pattern argument expected >&2
1427 debug|environment|force|never|only|quiet|show|DEBUG)
1435 setup) PACKAGEROOT=${PWD:-`pwd`}
1445 # HOSTTYPE specific setup
1451 32) case $HOSTTYPE in
1452 *-64) HOSTTYPE=${HOSTTYPE%-64} ;;
1459 64) case $HOSTTYPE in
1461 *) HOSTTYPE=$HOSTTYPE-64 ;;
1464 */32) echo $command: cannot build $bit-bit on $wow $sys >&2; exit 2 ;;
1470 '') PS1="($sys) " ;;
1471 *) PS1="($sys-$bit) " ;;
1475 $exec unset MAKESKIP
1478 $exec export A=$P/arch/$HOSTTYPE
1480 $exec export CDPATH=:..:$A/src/cmd:$A/src/lib:$A/src/uwin:$P/lib/package
1481 $exec export INSTALLROOT=$A
1482 $exec export PACKAGEROOT=$P
1483 $exec export PATH=$A/bin:$P/bin:$PATH
1484 $exec export PS1="$PS1"
1485 $exec export VPATH=$A:$P
1486 $exec export nativepp=/usr/lib
1488 if test '' != "$INSTALLROOT" -a -d $INSTALLROOT/include/ast
1489 then $exec export PACKAGE_ast=$INSTALLROOT
1490 elif test -d ${PWD%/*}/ast/arch/$HOSTTYPE
1491 then $exec export PACKAGE_ast=${PWD%/*}/ast/arch/$HOSTTYPE
1498 ':') $exec exec $SHELL ;;
1501 *) $exec exec $SHELL -c "$@"
1507 PACKAGEROOT=${PWD:-`pwd`}
1508 $show export PACKAGEROOT
1513 # true if arg is a valid PACKAGEROOT
1517 test -d $1/lib/$command -o -x $1/bin/$command
1520 # true if arg is executable
1522 executable() # [!] command
1525 '!') test ! -x "$2" -a ! -x "$2.exe"; return ;;
1526 *) test -x "$1" -o -x "$1.exe"; return ;;
1530 # initialize SHELLMAGIC
1531 # tangible proof of cygwin's disdain for unix (well, this and execrate)
1537 -) if test -f /emx/bin/sh.exe
1538 then SHELLMAGIC='#!/emx/bin/sh.exe'$nl
1539 elif test -f /bin/env.exe
1540 then SHELLMAGIC='#!/bin/env sh'$nl
1547 # true if arg is executable command on $PATH
1553 /*) if executable $_onpath_b
1554 then _onpath_=$_onpath_b
1565 do case $_onpath_d in
1568 if executable "$_onpath_d/$_onpath_b"
1569 then _onpath_=$_onpath_d/$_onpath_b
1576 # true if no nmake or nmake not from AT&T or nmake too old
1580 _nonmake_version=`( $1 -n -f - 'print $(MAKEVERSION:@/.*AT&T.* //:/-//G:@/.* .*/19960101/)' . ) </dev/null 2>/dev/null || echo 19840919`
1581 if test $_nonmake_version -lt 20001031
1587 # determine local host attributes
1589 hostinfo() # attribute ...
1602 do PATH=$PATH:$i/$j/bin
1606 # LD_LIBRARY_PATH may be out of sync with PATH here
1609 $SED 1d < /dev/null > /dev/null 2>&1 ||
1610 for dir in /bin /usr/bin
1611 do if test -x $dir/$SED
1617 $TR < /dev/null > /dev/null 2>&1 ||
1618 for dir in /bin /usr/bin
1619 do if test -x $dir/$TR
1626 case $PACKAGE_PATH in
1627 ?*) for i in `echo $PACKAGE_PATH | $SED 's,:, ,g'`
1628 do PATH=$PATH:$i/bin
1648 cpu|name|rating|type)
1651 *) echo "$command: $action: $info: unknown attribute" >&2
1659 -) echo "$command: $action: canon: host type name expected" >&2
1664 "") set "$@" type ;;
1680 _hostinfo_="$_hostinfo_ $NPROC"
1684 cpu=`grep -ic '^processor[ ][ ]*:[ ]*[0123456789]' /proc/cpuinfo`
1687 _hostinfo_="$_hostinfo_ $cpu"
1694 hinv '^Processor [0123456789]' \
1696 'cat /reg/LOCAL_MACHINE/Hardware/Description/System/CentralProcessor' '.' \
1697 'cat /proc/registry/HKEY_LOCAL_MACHINE/Hardware/Description/System/CentralProcessor' '.' \
1703 i=`$1 2>/dev/null | grep -c "$2"`
1721 then case `$1 | grep -ic '^cpu '` in
1722 1) cpu=`$1 | grep -ic '^ *[0123456789][0123456789]* '`
1734 /usr/kvm/mpstat 'cpu[0123456789]' \
1735 /usr/etc/cpustatus 'enable' \
1736 /usr/alliant/showsched 'CE' \
1737 'ls /config/hw/system/cpu' 'cpu' \
1738 prtconf 'cpu-unit' \
1744 i=`$1 2>/dev/null | $TR ' ' '
1758 0|1) # special match
1762 '/^[0123456789][0123456789]* .* Processors*$/' \
1766 '/^[0123456789][0123456789]* .* physically available\.*$/' \
1773 i=`$1 2>/dev/null | $SED -e "${2}!d" -e "s${3}"`
1788 trap 'rm -f $tmp.*' 0 1 2
1791 #include <pthread.h>
1794 printf("%d\n", pthread_num_processors_np());
1798 for o in -lpthread ''
1799 do if $CC $o -O -o $tmp.exe $tmp.c $o >/dev/null 2>&1 ||
1800 gcc $o -O -o $tmp.exe $tmp.c $o >/dev/null 2>&1
1812 _hostinfo_="$_hostinfo_ $cpu"
1814 name) _name_=`hostname || uname -n || cat /etc/whoami || echo local`
1815 _hostinfo_="$_hostinfo_ $_name_"
1817 rating) for rating in `grep -i ^bogomips /proc/cpuinfo 2>/dev/null | $SED -e 's,.*:[ ]*,,' -e 's,\(...*\)\..*,\1,' -e 's,\(\..\).*,\1,'`
1819 [0123456789]*) break ;;
1824 *) cd ${TMPDIR:-/tmp}
1826 trap 'rm -f $tmp.*' 0 1 2
1829 #include <sys/types.h>
1831 #include <sys/time.h>
1833 extern time_t time();
1837 register unsigned long i;
1838 register unsigned long j;
1839 register unsigned long k;
1858 gettimeofday(&b, &z);
1863 t = (unsigned long)time((time_t*)0);
1866 for (i = 0; i < l; i++)
1867 for (j = 0; j < 50000; j++)
1871 gettimeofday(&e, &z);
1875 t = (e.tv_sec - b.tv_sec) * 1000 + (e.tv_usec - b.tv_usec) / 1000;
1876 if (!x++ && t < 1000)
1883 t = ((unsigned long)time((time_t*)0) - t) * 1000;
1884 if (!x++ && t < 20000)
1892 printf("[ k=%lu l=%lu m=%lu t=%lu ] ", k, l, m, t);
1898 printf("%lu\n", ((l * m) / 10) / t);
1903 for o in -DTZ -DTD ''
1904 do if $CC $o -O -o $tmp.exe $tmp.c >/dev/null 2>&1 ||
1905 gcc $o -O -o $tmp.exe $tmp.c >/dev/null 2>&1
1906 then rating=`./$tmp.exe`
1916 _hostinfo_="$_hostinfo_ $rating"
1919 case $CROSS:$canon in
1921 cc) case $KEEP_HOSTTYPE:$HOSTTYPE in
1922 0:?*) if test -d ${PACKAGEROOT:-.}/arch/$HOSTTYPE
1923 then KEEP_HOSTTYPE=1
1929 case $KEEP_HOSTTYPE in
1930 1) _hostinfo_="$_hostinfo_ $HOSTTYPE"
1937 /*) a=`$cc -dumpmachine $CCFLAGS 2>/dev/null`
1939 '') case $CCFLAGS in
1940 ?*) a=`$cc -dumpmachine 2>/dev/null` ;;
1947 *.*-*) _hostinfo_="$_hostinfo_ $a"
1950 *-*-*) case $canon in
1954 *) _hostinfo_="$_hostinfo_ $a"
1964 f=../lib/hostinfo/typemap
1972 *) if executable $i/$cc
1973 then a=`$i/$cc -dumpmachine $CCFLAGS 2>/dev/null`
1975 '') case $CCFLAGS in
1976 ?*) a=`$cc -dumpmachine 2>/dev/null` ;;
1985 *) _hostinfo_="$_hostinfo_ $a"
1995 then map="`grep -v '^#' $i/$f` $map"
1999 # inconsistent -dumpmachine filtered here
2003 h=`hostname || uname -n || cat /etc/whoami`
2007 a=`arch || uname -m || att uname -m || uname -s || att uname -s`
2009 *[\ \ ]*) a=`echo $a | $SED "s/[ ]/-/g"` ;;
2014 m=`mach || machine || uname -p || att uname -p`
2016 *[\ \ ]*) m=`echo $m | $SED "s/[ ]/-/g"` ;;
2021 x=`uname -a || att uname -a`
2023 '') x="unknown $host unknown unknown unknown unknown unknown" ;;
2026 expected=$1 host=$2 arch=$3 mach=$4 os=$5 sys=$6 rel=$7 ver=$8
2034 2) host= mach= arch=$1 os=$2 sys= rel= ;;
2035 *) host= mach=$2 arch=$1 os=$3 sys= rel= ;;
2038 [abcdefghijklmnopqrstuvwxyz]*[0123456789])
2039 eval `echo $os | $SED -e 's/^\([^0123456789.]*\)\.*\(.*\)/os=\1 rel=\2/'`
2043 *) arch=$canon mach= os= sys= rel=
2050 *.*) host=`echo $host | $SED -e 's/\..*//'` ;;
2056 [Rr][0123][0123456789][0123456789][0123456789])
2059 [Rr][4][0123456789][0123456789][0123456789])
2062 [Rr][56789][0123456789][0123456789][0123456789]|[Rr][123456789][0123456789][0123456789][0123456789][0123456789])
2068 [Pp][Oo][Ww][Ee][Rr][Pp][Cc])
2073 34[0123456789][0123456789])
2083 /NextDeveloper -d next - \
2084 /config/hw/system/cpu -d tandem mach \
2098 shift;shift;shift;shift
2106 HP-UX) case $arch in
2110 */*) type=hp.`echo $arch | $SED 's,/,_,g'`
2117 set xx `hinv | $SED -e '/^CPU:/!d' -e 's/CPU:[ ]*\([^ ]*\)[ ]*\([^ ]*\).*/\1 \2/' -e q | $TR ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
2122 r[0123][0123456789][0123456789][0123456789])
2125 r[4][0123][0123456789][0123456789])
2128 r[4][456789][0123456789][0123456789]|r[5][0123456789][0123456789][0123456789])
2131 r[6789][0123456789][0123456789][0123456789]|r[123456789][0123456789][0123456789][0123456789][0123456789])
2136 [01234].*|5.[012]|5.[012].*)
2162 a=`strings $a < /dev/null | $SED -e 's/[^abcdefghijklmnopqrstuvwxyz0123456789]/ /g' -e 's/[ ][ ]*/\'"$split"'/g' | $SED -e "/^${type}[0123456789]$/!d" -e "s/^${type}//" -e q`
2164 [0123456789]) n=$a ;;
2167 4) a=`$cc -${type}3 2>&1`
2169 *unknown*|*install*|*conflict*)
2176 a=`$cc -show F0oB@r.c 2>&1`
2178 [!2]:*mips2*) n=2 ;;
2179 [!23]:*mips3*) n=3 ;;
2180 [!234]:*mips4*) n=4 ;;
2183 [!2]:*[Oo]32*) abi=-o32 ;;
2184 [!3]:*[Nn]32*) abi=-n32 ;;
2192 OS/390) type=mvs.390
2198 v=`echo $rel | $SED -e 's/^[25]\.//' -e 's/\.[^.]*$//'`
2217 [Ss]un*)type=`echo $arch | $SED -e 's/\(sun.\).*/\1/'`
2233 sparc*) type=sun4 ;;
2238 v=`echo $rel | $SED -e 's/^[25]\.//' -e 's/\.[^.]*$//'`
2255 [Uu][Nn][Ii][Xx]_[Ss][Vv])
2259 if test -x /bin/u370 -o -x /bin/u390
2269 *.*|*[0123456789]*86|*68*)
2272 *[0123456789]*86|*68*|mips)
2286 ?*) type=$type.$mach ;;
2294 *[0123456789][abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ]*)
2295 mach=`echo $mach | $SED -e 's/[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ]*$//'`
2305 *) type=`echo $os | $SED -e 's/[0123456789].*//' -e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_0123456789.].*//'`
2309 [Cc][Yy][Gg][Ww][Ii][Nn]_*)
2312 [Uu][Ww][Ii][Nn]*|[Ww]indows_[0123456789][0123456789]|[Ww]indows_[Nn][Tt])
2314 arch=`echo $arch | $SED -e 's/_[^_]*$//'`
2319 ?*) type=$type.$mach ;;
2322 *) type=$type.$arch ;;
2333 */MC) type=ncr.$type ;;
2337 *[0123456789]*86|*68*)
2344 [abcdefghijklmnopqrstuvwxyz]*[0123456789])
2346 [abcdefghijklmnopqrstuvwxyz]*) case $mach in
2348 Fault*|fault*|FAULT*)
2354 '') type=$type.$mach ;;
2355 *) type=$type.$arch ;;
2362 *[-_]32|*[-_]64|*[-_]128)
2363 bits=`echo $type | $SED 's,.*[-_],,'`
2364 type=`echo $type | $SED 's,[-_][0-9]*$,,'`
2369 type=`echo $type | $SED -e 's%[-+/].*%%' | $TR ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
2371 *.*) lhs=`echo $type | $SED -e 's/\..*//'`
2372 rhs=`echo $type | $SED -e 's/.*\.//'`
2374 [x0123456789]*86) rhs=i$rhs ;;
2378 i[x23456789]86|i?[x23456789]86|*86pc)
2381 s[0123456789]*[0123456789]x)
2382 rhs=`echo $rhs | $SED -e 's/x$/-64/'` ;;
2385 arm[abcdefghijklmnopqrstuvwxyz_][0123456789]*)
2390 ?*coff|?*dwarf|?*elf)
2396 lhs=`echo ${lhs}XXX | $SED -e "s/${x}XXX//"`
2401 darwin) case $rel in
2402 [01234567].*) lhs=${lhs}7 ;;
2405 freebsd) case $rel in
2406 [01234].*) lhs=${lhs}4 ;;
2407 [123456789]*.*) lhs=${lhs}`echo $rel | $SED -e 's/\..*//'` ;;
2416 *) type=$lhs.$rhs ;;
2423 mips2) type=sgi.$mach
2426 mips3) type=sgi.$mach
2439 trap 'rm -f $tmp.*' 0 1 2
2442 int main() { return b(); }
2445 int b() { return 0; }
2449 then for i in -n32 -o32 -64
2450 do if $cc $i -c $tmp.b.c &&
2451 $cc -o $tmp.exe $tmp.a.o $tmp.b.o
2453 for i in 2 3 4 5 6 7 8 9
2459 if $cc $abi -mips$i -c $tmp.b.c &&
2460 $cc -o $tmp.exe $tmp.a.o $tmp.b.o
2461 then type=`echo $type | $SED -e 's/.$//'`$i
2468 fi </dev/null >/dev/null 2>&1
2485 sgi.mips[456789]-64)
2492 '') case `file /bin/sh 2>/dev/null` in
2497 trap 'rm -f $tmp.*' 0 1 2
2499 int main() { return 0; }
2501 if $cc -o $tmp.a.exe $tmp.a.c
2502 then case `file $tmp.a.exe` in
2505 fi </dev/null >/dev/null 2>&1
2516 32) case $CC-$CCFLAGS in
2517 *-m64*) case $type in
2527 64) case $CC-$CCFLAGS in
2528 *-m32*) case $type in
2536 ?*) type=$type-$bits ;;
2539 # last chance mapping
2547 eval " case \$type in
2548 $1) type=\$2; break ;;
2551 _hostinfo_="$_hostinfo_ $type"
2559 # restore the global state
2571 note() # message ...
2573 echo $command: "$@" >&2
2578 # CC: compiler base name name
2579 # cc: full path, empty if not found
2596 make|test) note "$CC: not found"; exit 1 ;;
2597 *) note "warning: $CC: not found" ;;
2603 # some actions have their own PACKAGEROOT or kick out early
2606 host) eval u=$package_use
2611 then case $_onpath_ in
2612 */arch/$HOSTTYPE/bin/package)
2618 else KEEP_HOSTTYPE=0
2634 *:$INSTALLROOT/bin:*)
2636 $INSTALLROOT/bin:$INSTALLROOT/lib:*)
2637 case $SHLIB_PATH: in
2652 1) : accept the current package use environment
2654 KSH=$EXECROOT/bin/ksh
2656 NMAKE=$EXECROOT/bin/$MAKE
2657 SUM=$EXECROOT/bin/sum
2658 TEE=$EXECROOT/bin/tee
2659 INITROOT=$PACKAGEROOT/src/cmd/INIT
2663 case $KEEP_PACKAGEROOT in
2667 echo) exec=echo make=echo show=echo ;;
2680 else for i in `echo $HOME | sed -e 's,/[^/]*$,,'` $usr $use
2681 do if packageroot $i/$1
2682 then PACKAGEROOT=$i/$1
2686 case $PACKAGEROOT in
2698 case $PACKAGEROOT in
2699 '') PACKAGEROOT=${PWD:-`pwd`} ;;
2702 # . must be within the PACKAGEROOT tree
2715 case $PACKAGEROOT in
2736 *) if packageroot $d
2746 INITROOT=$PACKAGEROOT/src/cmd/INIT
2747 $show PACKAGEROOT=$PACKAGEROOT
2748 $show export PACKAGEROOT
2751 # initialize the architecture environment
2753 case $KEEP_HOSTTYPE in
2755 HOSTTYPE=$_hostinfo_
2757 1) _PACKAGE_HOSTTYPE_=$HOSTTYPE
2758 export _PACKAGE_HOSTTYPE_
2761 $show HOSTTYPE=$HOSTTYPE
2762 $show export HOSTTYPE
2764 INSTALLROOT=$PACKAGEROOT/arch/$HOSTTYPE
2766 admin|install|make|read|remove|test|verify|view|write)
2768 *) if test ! -d $INSTALLROOT
2769 then INSTALLROOT=$PACKAGEROOT
2773 $show INSTALLROOT=$INSTALLROOT
2774 $show export INSTALLROOT
2777 # check the basic package hierarchy
2781 packageroot $PACKAGEROOT || {
2782 echo "$command: $PACKAGEROOT: invalid package root directory" >&2
2785 case $KEEP_HOSTTYPE:$hosttype in
2786 0:?*) if test -d ${PACKAGEROOT:-.}/arch/$hosttype
2787 then KEEP_HOSTTYPE=1
2789 else echo "$command: $hosttype: package root not found" >&2
2795 *) packageroot $PACKAGEROOT || {
2796 case $KEEP_PACKAGEROOT in
2798 *) echo "$command: $PACKAGEROOT: must be in the package root directory tree" >&2
2806 *) for i in arch arch/$HOSTTYPE
2807 do test -d $PACKAGEROOT/$i || $exec mkdir $PACKAGEROOT/$i || exit
2810 do test -d $INSTALLROOT/$i || $exec mkdir $INSTALLROOT/$i || exit
2815 # no $INITROOT means INIT already installed elsewhere
2817 if test -d $INITROOT
2819 # update the basic package commands
2821 for i in execrate ignore mamprobe silent
2822 do test -h $PACKAGEROOT/bin/$i 2>/dev/null ||
2823 case `ls -t $INITROOT/$i.sh $PACKAGEROOT/bin/$i 2>/dev/null` in
2825 note update $PACKAGEROOT/bin/$i
2828 '') $exec cp $INITROOT/$i.sh $PACKAGEROOT/bin/$i || exit
2834 } > $PACKAGEROOT/bin/$i || exit
2837 echo \"$SHELLMAGIC\"
2839 } > $PACKAGEROOT/bin/$i"
2844 $exec chmod +x $PACKAGEROOT/bin/$i || exit
2852 PATH=$INSTALLROOT/bin:$PACKAGEROOT/bin:$PATH
2856 ?*) if test -f $INITROOT/hello.c
2858 # check if $CC (full path $cc) is a cross compiler
2862 trap "rm -f pkg$pid.*" 0 1 2
2863 cp $INITROOT/hello.c pkg$pid.c || exit 3
2864 $cc -o pkg$pid.exe pkg$pid.c > pkg$pid.e 2>&1 || {
2865 if $cc -Dnew=old -o pkg$pid.exe pkg$pid.c > /dev/null 2>&1
2866 then echo "$command: ${warn}$CC: must be a C compiler (not C++)" >&2
2868 echo "$command: ${warn}$CC: failed to compile and link $INITROOT/hello.c -- is it a C compiler?" >&2
2872 if ./pkg$pid.exe >/dev/null 2>&1
2886 EXECROOT=$INSTALLROOT
2888 0) # dll hackery -- why is this so complicated?
2892 sgi.mips[0123456789]*)
2894 if executable /lib32/$x || executable /lib64/$x
2895 then case $INSTALLROOT in
2896 */sgi.mips[0123456789]*)
2897 u=`echo $INSTALLROOT | sed -e 's,-[^-/]*$,,' -e 's,.$,,'`
2902 for a in "n=2 v= l=" "n=3 v=N32 l=lib32" "n=4-n32 v=N32 l=lib32" "n=4 v=64 l=lib64"
2905 N32) case $n:$HOSTTYPE in
2907 *-n32:*) continue ;;
2908 *:*-n32) continue ;;
2913 ?*) if executable ! /$l/$x
2919 '') case $HOSTTYPE in
2920 sgi.mips$n|sgi.mips$n-*)
2921 abi="$abi 'd=$INSTALLROOT v=$v'"
2928 then abi="$abi 'd=$u$n v=$v'"
2937 '') abi="'d=$INSTALLROOT v='" ;;
2944 case \\\$LD_LIBRARY\${v}_PATH: in
2947 *) x=\\\$LD_LIBRARY\${v}_PATH
2952 LD_LIBRARY\${v}_PATH=\$d/lib\\\$x
2953 export LD_LIBRARY\${v}_PATH
2960 case $LD_LIBRARY_PATH in
2963 do case $HOSTTYPE in
2964 *64) if test -d ${d}64
2969 case :$LD_LIBRARY_PATH: in
2972 then LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$d
2981 1) $show LD_LIBRARY_PATH=$LD_LIBRARY_PATH
2982 $show export LD_LIBRARY_PATH
2983 export LD_LIBRARY_PATH
2987 $INSTALLROOT/bin:$INSTALLROOT/lib:*)
2990 '') LIBPATH=/usr/lib:/lib ;;
2992 LIBPATH=$INSTALLROOT/bin:$INSTALLROOT/lib:$LIBPATH
2993 $show LIBPATH=$LIBPATH
2994 $show export LIBPATH
2998 case $SHLIB_PATH: in
3001 *) SHLIB_PATH=$INSTALLROOT/lib${SHLIB_PATH:+:$SHLIB_PATH}
3002 $show SHLIB_PATH=$SHLIB_PATH
3003 $show export SHLIB_PATH
3007 case $DYLD_LIBRARY_PATH: in
3010 *) DYLD_LIBRARY_PATH=$INSTALLROOT/lib${DYLD_LIBRARY_PATH:+:$DYLD_LIBRARY_PATH}
3011 $show DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH
3012 $show export DYLD_LIBRARY_PATH
3013 export DYLD_LIBRARY_PATH
3017 $INSTALLROOT/arch*) ;;
3018 ':') _RLD_ROOT=$INSTALLROOT/arch:/ ;;
3019 /|*:/) _RLD_ROOT=$INSTALLROOT/arch:$_RLD_ROOT ;;
3020 *) _RLD_ROOT=$INSTALLROOT/arch:$_RLD_ROOT:/ ;;
3022 $show _RLD_ROOT=$_RLD_ROOT
3023 $show export _RLD_ROOT
3028 # NOTE: PACKAGEROOT==INSTALLROOT is possible for binary installations
3033 *) PATH=$PACKAGEROOT/bin:$PATH
3039 *) PATH=$INSTALLROOT/bin:$PATH
3046 *) for i in package proto nmake
3048 then EXECROOT=`echo $_onpath_ | sed -e 's,//*[^/]*//*[^/]*$,,'`
3049 EXECTYPE=`echo $EXECROOT | sed -e 's,.*/,,'`
3058 EXECTYPE=$_hostinfo_
3061 echo "$command: $CC: seems to be a cross-compiler" >&2
3062 echo "$command: set HOSTTYPE to something other than the native $EXECTYPE" >&2
3068 $show EXECTYPE=$EXECTYPE
3069 $show export EXECTYPE
3073 $show EXECROOT=$EXECROOT
3074 $show export EXECROOT
3077 # use these if possible
3079 KSH=$EXECROOT/bin/ksh
3081 NMAKE=$EXECROOT/bin/$MAKE
3082 SUM=$EXECROOT/bin/sum
3083 TEE=$EXECROOT/bin/tee
3085 # grab a decent default shell
3088 0) executable "$SHELL" || SHELL=
3090 ?*) checksh $SHELL || SHELL= ;;
3093 ''|/bin/*|/usr/bin/*)
3095 '') SHELL=/bin/sh ;;
3097 for i in ksh sh bash
3098 do if onpath $i && checksh $_onpath_
3099 then SHELL=$_onpath_
3104 */*ksh) if executable $KSH
3112 # $SHELL must be /bin/sh compatible
3118 *) $SHELL -c 'trap "exit 0" 0; exit 1' 2>/dev/null
3122 *) # catch (our own) pipe/socket configuration mismatches
3123 $SHELL -c "date | $SHELL -c 'read x'"
3137 $show COSHELL=$COSHELL
3138 $show export COSHELL
3140 # tame the environment
3146 export ENV ERROR_OPTIONS
3150 # finalize the views
3161 */arch/$HOSTTYPE) ;;
3163 */arch/*) continue ;;
3166 then case $USER_VPATH in
3167 '') USER_VPATH=$i ;;
3168 ?*) USER_VPATH=$USER_VPATH:$i ;;
3185 ''|$PACKAGEROOT|$INSTALLROOT)
3187 ?*) USER_VPATH=$USER_VPATH:$i
3188 USER_VPATH_CHAIN="$USER_VPATH_CHAIN $p $i"
3191 -) executable $i/bin/mamake && PROTOROOT= ;;
3201 PACKAGESRC=$PACKAGEROOT/lib/package
3202 PACKAGEBIN=$INSTALLROOT/lib/package
3203 case $action:$run in
3214 # HOSTTYPE specific package profile
3216 if test -r $INSTALLROOT/lib/package/profile
3217 then . $INSTALLROOT/lib/package/profile
3220 # more cygwin hassles
3230 *) exe=/tmp/pkg$pid.exe
3242 *) lose="$lose binmode" ;;
3247 ?*) echo "$command: $HOSTTYPE: export '$lose' in CYGWIN or languish in windows" >&2
3254 # set up the view state
3256 VIEW_bin=$INSTALLROOT VIEW_src=$PACKAGEROOT VIEW_all="$INSTALLROOT $PACKAGEROOT"
3257 if (vpath $INSTALLROOT $PACKAGEROOT $USER_VPATH_CHAIN) >/dev/null 2>&1 &&
3258 vpath $INSTALLROOT $PACKAGEROOT $USER_VPATH_CHAIN
3259 then $show vpath $INSTALLROOT $PACKAGEROOT $USER_VPATH_CHAIN
3260 else VPATH=$INSTALLROOT:$PACKAGEROOT$USER_VPATH
3271 VIEW_src="$VIEW_src $i"
3274 VIEW_bin="$VIEW_bin $i"
3277 VIEW_src="$VIEW_src $i"
3280 VIEW_all="$VIEW_all $i"
3284 # return 0 if arg in src|bin|all view
3286 view() # [test] [-|type] [src|bin|all] file
3289 -[dfsx])_view_T_=$1; shift ;;
3298 all) shift; _view_v_=$VIEW_all ;;
3299 bin) shift; _view_v_=$VIEW_bin ;;
3300 src) shift; _view_v_=$VIEW_src ;;
3301 *) _view_v_=$VIEW_all ;;
3304 /*) if test $_view_T_ $1
3309 *) for _view_d_ in $_view_v_
3310 do if test $_view_T_ $_view_d_/$1
3311 then _view_=$_view_d_/$1
3319 ?*) echo $command: $1: $_view_t_ not found >&2 ;;
3324 # determine the package and targets
3327 admin) case $admin_action in
3328 results)action=$admin_action
3331 admin_args="admin $*"
3333 '') target=$admin_args ;;
3334 *) target="on $admin_on $admin_args" ;;
3339 release)set '' $args
3344 -|[0123456789][0123456789]-[0123456789][0123456789]-[0123456789][0123456789]|[0123456789][0123456789][0123456789][0123456789]-[0123456789][0123456789]-[0123456789][0123456789])
3353 setup) # { update read } with optional (bin|fun|include|lib) symlinks
3354 # flat option sets up { bin fun include lib } symlinks from
3355 # $INSTALLROOT to $PACKAGEROOT
3357 # . is the package root
3371 flat) flat=1 # backwards compatibility -- documentation dropped
3378 *) types="$types $1"
3383 if test ! -d $PACKAGEROOT/lib/package/tgz
3384 then $exec mkdir -p $PACKAGEROOT/lib/package/tgz || exit
3392 *) view - all src/cmd/INIT ||
3398 packages=`$0 $global authorize "$authorize" password "$password" update setup $types $url "$@" PACKAGEROOT=$PACKAGEROOT`
3400 ?*) $0 $global read $packages PACKAGEROOT=$PACKAGEROOT
3413 ''|-) target="$target $package"
3416 *) if view - src "lib/package/$1.pkg"
3417 then package="$package $1"
3418 else target="$target $package $1"
3427 # flatten -- assumes symlink support
3431 make|read|setup|update|use|view)
3432 if test ! -d $INSTALLROOT
3433 then $exec mkdir -p $INSTALLROOT || exit
3435 for i in bin include lib fun man share
3436 do if test ! -d $INSTALLROOT/../../$i
3437 then $exec mkdir $INSTALLROOT/../../$i
3439 if test ! -d $INSTALLROOT/$i
3440 then if test ! -h $INSTALLROOT/$i
3441 then $exec ln -s ../../$i $INSTALLROOT/$i
3443 elif test ! -h $INSTALLROOT/$i
3444 then for x in $INSTALLROOT/$i/.[a-z]* $INSTALLROOT/$i/*
3445 do if test -f $x -o -d $x
3446 then if test ! -d $INSTALLROOT/$i/$x || test ! -d $INSTALLROOT/../../$i/$x
3447 then $exec mv $x $INSTALLROOT/../../$i
3451 $exec rm -rf $INSTALLROOT/$i
3452 $exec ln -s ../../$i $INSTALLROOT/$i
3460 # check that cmd args are up to date a.out's
3462 checkaout() # cmd ...
3467 ratz) if test -f $INITROOT/ratz.c -a -w $PACKAGEROOT
3468 then test -f $INITROOT/hello.c || {
3469 cat > $INITROOT/hello.c <<'!'
3473 int main() { int new = 0; printf("hello world\n"); return new;}
3476 test -f $INITROOT/p.c || {
3477 cat > $INITROOT/p.c <<'!'
3479 * small test for prototyping cc
3482 int main(int argc, char** argv) { return argc || argv; }
3488 test -f $INITROOT/hello.c -a -f $INITROOT/p.c -a -w $PACKAGEROOT || {
3491 echo "$command: $i: command not found" >&2
3501 test -f $INITROOT/hello.c -a -f $INITROOT/p.c || {
3502 echo "$command: $INITROOT: INIT package source not found" >&2
3505 executable $INSTALLROOT/bin/nmake || {
3506 # check for prototyping cc
3507 # NOTE: proto.c must be K&R compatible
3509 $CC -c $INITROOT/p.c >/dev/null 2>&1
3513 checkaout proto || return
3514 PROTOROOT=$PACKAGEROOT/proto
3515 $show PROTOROOT=$PACKAGEROOT/proto
3517 INITPROTO=$PROTOROOT/src/cmd/INIT
3518 note proto convert $PACKAGEROOT/src into $PROTOROOT/src
3519 if test -d $PACKAGEROOT/src/cmd/nmake
3520 then dirs="src/cmd/INIT src/lib/libast src/lib/libardir src/lib/libcoshell src/lib/libpp src/cmd/probe src/cmd/cpp src/cmd/nmake"
3524 if test -f $PROTOROOT/UPDATE
3525 then newer="-newer $PROTOROOT/UPDATE"
3530 find $dirs -name '*.[CcHh]' $newer -print | proto -v -L - -C proto
3532 *) $exec cd $PACKAGEROOT
3533 $exec "find $dirs -name '*.[CcHh]' $newer -print | proto -L - -C proto"
3536 $exec touch $PROTOROOT/UPDATE
3538 if (vpath $INSTALLROOT - $INSTALLROOT $PROTOROOT $PROTOROOT $PACKAGEROOT) >/dev/null 2>&1 &&
3539 vpath $INSTALLROOT - $INSTALLROOT $PROTOROOT $PROTOROOT $PACKAGEROOT
3540 then $show vpath $INSTALLROOT $PROTOROOT $PROTOROOT $PACKAGEROOT $USER_VPATH_CHAIN
3541 else VPATH=$INSTALLROOT:$PROTOROOT:$PACKAGEROOT$USER_VPATH
3547 for i in arch arch/$HOSTTYPE arch/$HOSTTYPE/bin
3548 do test -d $PACKAGEROOT/$i || $exec mkdir $PACKAGEROOT/$i || return
3554 case $_PACKAGE_cc in
3556 '') _PACKAGE_cc=0 ;;
3562 do eval j=\$_PACKAGE_AOUT_$i
3564 '') eval _PACKAGE_AOUT_$i=1 ;;
3568 if test -f $INITROOT/$i.c
3572 if executable $EXECROOT/bin/$i
3576 : $k : compiler : source : binary :
3578 *00) view - bin/$i && continue ;;
3581 000) echo "$command: $i: not found: download the INIT package $HOSTTYPE binary to continue" >&2
3584 010) echo "$command: $i: not found: set CC=C-compiler or download the INIT package $HOSTTYPE binary to continue" >&2
3587 100) echo "$command: $i: not found: download the INIT package source or $HOSTTYPE binary to continue" >&2
3591 1) echo "$command: $i: not found: make the local $EXECTYPE binary package before $HOSTTYPE" >&2
3596 ?01) : accept binary
3599 011) : accept binary
3607 case `ls -t $INITROOT/$i.c $INSTALLROOT/bin/$i 2>/dev/null` in
3609 note update $INSTALLROOT/bin/$i
3610 if test proto != "$i" && executable $INSTALLROOT/bin/proto
3612 '') $INSTALLROOT/bin/proto -p $INITROOT/$i.c > $i.c || return ;;
3613 *) $exec "$INSTALLROOT/bin/proto -p $INITROOT/$i.c > $i.c" ;;
3615 $exec $CC $CCFLAGS -o $INSTALLROOT/bin/$i $i.c || return
3617 else if test ! -d $INSTALLROOT/bin
3618 then for j in arch arch/$HOSTTYPE arch/$HOSTTYPE/bin
3619 do test -d $PACKAGEROOT/$j || $exec mkdir $PACKAGEROOT/$j || return
3622 if test '' != "$PROTOROOT" -a -f $INITPROTO/$i.c
3623 then $exec $CC $CCFLAGS -o $INSTALLROOT/bin/$i $INITPROTO/$i.c || return
3624 else $exec $CC $CCFLAGS -o $INSTALLROOT/bin/$i $INITROOT/$i.c || return
3627 proto:) test -d $INSTALLROOT/include || mkdir $INSTALLROOT/include
3628 $INSTALLROOT/bin/proto -f /dev/null > $i.c
3629 cmp -s $i.c $INSTALLROOT/include/prototyped.h 2>/dev/null || cp $i.c $INSTALLROOT/include/prototyped.h
3634 test -f $i.o && $exec rm -f $i.o
3644 # check package requirements against received packages
3646 requirements() # source|binary [ package ]
3649 binary) r=$VIEW_BIN ;;
3650 source) r=$VIEW_SRC ;;
3660 do set "$@" $d/gen/*.ver
3662 '') set "$@" $d/gen/*.req
3665 do set "$@" $d/gen/$p.req
3677 do p=`echo $i | sed -e 's,.*/,,' -e 's,\....$,,'`
3691 *) echo "$command: $i: must read or write package" >&2
3700 test 0 != "$#" && release=`sort -r "$@" | {
3713 base) echo "$command: base package $p.$v or newer required" >&2 ;;
3714 *) echo "$command: delta package $p.$v.$r or newer required" >&2 ;;
3721 0) echo "$q" | sort | { read v r; read v r; echo $v; } ;;
3726 ERROR) case $force in
3730 ?*) eval `echo $release | sed -e 's,\(.*\)-\(.*\)-\(.*\),yy=\1 mm=\2 dd=\3,'`
3731 # slide back 4 months
3747 1) yy=`expr $yy - 1` ;;
3752 release="-f $release -r $count"
3757 # write ordered package prerequisite list to the standard output
3759 order() # [ package ]
3761 _order_t_=lib/package/tgz
3763 binary) _order_a_=.$HOSTTYPE ;;
3769 for _order_v_ in $VIEW_all
3770 do for _order_f_ in $_order_v_/lib/package/*.pkg
3771 do if test -f $_order_f_
3772 then _order_p_="$_order_p_ $_order_f_"
3780 if test ratz != "$*"
3781 then for _order_f_ in ratz INIT
3782 do if view -s - src $_order_t_/$_order_f_$_order_a_.tim
3783 then echo $_order_f_ $_order_f_
3789 do view - src $_order_f_ && break
3792 *) _order_f_=$_order_f_.pkg; view - src $_order_f_ && break ;;
3796 *) _order_f_=lib/package/$_order_f_; view - src $_order_f_ && break ;;
3798 echo "$command: $_order_f_: not a package" >&2
3802 _order_p_=`echo $_order_f_ | sed -e 's,.*/,,' -e 's,\.pkg$,,'`
3804 0) view -s - src $_order_t_/$_order_p_$_order_a_.tim || continue ;;
3806 echo $_order_p_ $_order_p_
3810 *) echo INIT $_order_p_
3832 req="$req$req_sep$1"
3840 for _order_i_ in $req
3841 do if view - src lib/package/$_order_i_.pkg
3842 then case $_order_u_ in
3843 0) view -s - src $_order_t_/$_order_i_$_order_a_.tim || continue ;;
3845 echo $_order_i_ $_order_i_; echo INIT $_order_i_; echo $_order_i_ $_order_p_
3853 # generate the package component list in _components_
3855 components() # [ package ]
3861 INIT) case " $_components_ " in
3863 *) _components_="$_components_ $p" ;;
3866 *) if view - src lib/package/$p.pkg
3886 case " $_components_ " in
3888 *) _components_="$_components_ $1" ;;
3897 elif test -d $PACKAGEROOT/src/cmd/$p -o -d $PACKAGEROOT/src/lib/$p
3898 then _components_="$_components_ $p"
3899 else echo "$command: $p: package or component not found" >&2
3907 # list main environment values
3912 ''|make)for __i__ in CC SHELL $env
3913 do eval echo $__i__='$'$__i__
3919 # capture command output
3921 capture() # file command ...
3923 case $make:$noexec in
3938 write) d=$PACKAGESRC/gen ;;
3939 *) d=$PACKAGEBIN/gen ;;
3941 test -d $d || $exec mkdir $d
3949 then mv $o.old $o.out.1
3951 then mv $o.out $o.out.2
3954 then for i in `ls -t $o.out.? 2>/dev/null`
3972 note $action output captured in $o
3973 s="$command: $action start at `date` in $INSTALLROOT"
3975 0) trap "echo \"$command: $action done at \`date\`\" in $INSTALLROOT 2>&1 | \$TEE -a $o" 0 1 2 ;;
3976 *) trap "echo \"$command: $action done at \`date\`\" in $INSTALLROOT >> $o" 0 1 2 ;;
3981 0) if executable ! $TEE
3990 } < /dev/null 2>&1 | $TEE -a $o
3998 } < /dev/null > $o 2>&1
4007 package_install() # dest sum
4012 sed -e '/ /!d' -e 's,[^ ]* ,,' -e 's, \(arch/[^/]*\)/, \1 ,' -e '/ arch\//!s,^[^ ]* [^ ]* [^ ]*,& .,' -e 's,/\([^ /]*\)$, \1,' $sum |
4013 while read mode user group arch dir file
4014 do case $flat:$arch in
4015 1:*|?:.)t=$dest/$dir ;;
4016 *) t=$dest/$arch/$dir ;;
4020 *) if test ! -d "$t"
4021 then $exec mkdir -p "$t" || exit
4029 *) f=$arch/$dir/$file ;;
4036 $exec cp -f "$f" "$t" || code=1
4037 $exec chmod $mode "$t" || code=1
4045 package_verify() # sum
4050 make_recurse() # dir
4052 for _make_recurse_j in $makefiles
4053 do if view - $1/$_make_recurse_j
4059 '') echo :MAKE: > $1/Makefile || exit ;;
4060 *) $exec "echo :MAKE: > $1/Makefile" ;;
4065 get() # host path [ file size ]
4069 for i in wget lynx curl
4075 AUTHORIZE="User-Agent: package AT&T Research\\r\\n"
4076 case $HURL:$authorize in
4077 .:?*) AUTHORIZE="${AUTHORIZE}Authorization: Basic `print -n -r -- $authorize:$password | uuencode -h -x base64`\\r\\n" ;;
4087 do eval "exec $getfd<> /dev/tcp/$host/80" || exit
4092 print "GET $path HTTP/1.0\\r\\nHost: $host\\r\\n$AUTHORIZE\\r" >&$getfd
4094 got=`sed -e 1q get.tmp`
4097 got=`sed -e '1,/^.$/d' -e '/^[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWYZ]/!d' get.tmp`
4103 got=`sed -e '/^Location: /!d' -e 's,^Location: \(.*\)://\([^/]*\)\(/.*\),prot='\''\1'\'' host='\''\2'\'' path='\''\3'\'',' get.tmp`
4106 echo "$command: $action: $url: redirect error" >&2
4113 echo "$command: $action: $url: $got" >&2
4114 echo '' "$got" > get.err
4121 curl) case $authorize in
4122 '') curl -s -L -o get.tmp http://$1/$2 2> get.err; code=$? ;;
4123 *) curl -s -L -o get.tmp -u "$authorize":"$password" http://$1/$2 2> get.err; code=$? ;;
4125 got=`grep '^[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWYZ]' get.tmp 2>/dev/null`
4127 0) if grep '^<H1>Authorization Required</H1>' get.tmp > get.err
4133 hurl) case $authorize in
4134 '') hurl http://$1/$2 > get.tmp 2> get.err; code=$? ;;
4135 *) hurl -a "$authorize":"$password" http://$1/$2 > get.tmp 2> get.err; code=$? ;;
4137 got=`grep '^[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWYZ]' get.tmp`
4139 lynx) case $authorize in
4140 '') lynx -source http://$1/$2 > get.tmp 2> get.err; code=$? ;;
4141 *) lynx -source -auth "$authorize":"$password" http://$1/$2 > get.tmp 2> get.err; code=$? ;;
4143 got=`grep '^[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWYZ]' get.tmp`
4145 wget) wget -nv -O get.tmp ${authorize:+--http-user="$authorize"} ${password:+--http-passwd="$password"} http://$1/$2 2> get.err
4147 got=`grep '^[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWYZ]' get.tmp 2>/dev/null`
4149 *) echo $command: $action: $HURL: url get command not found >&2
4153 if test 0 != "$code"
4154 then case `cat get.err get.tmp 2>/dev/null` in
4155 *[Aa][Uu][Tt][Hh][Oo][Rr][Ii][SsZz]*|*[Dd][Ee][Nn][Ii][Ee][Dd]*)
4156 echo $command: $action: authorization required -- see $url for license acceptance authorization name and password >&2
4161 rm -f get.tmp get.err
4162 echo $command: $action: $2: download failed >&2
4165 rm -f get.tmp get.err
4168 '') echo "$3 ($4 bytes):" >&2
4170 .) eval "exec $getfd<> /dev/tcp/$1/80" || exit
4176 print "GET $path HTTP/1.0\\r\\nHost: $host\\r\\n$AUTHORIZE\\r" >&$getfd
4183 *) echo '' "$got" > get.err
4187 while read got <&$getfd
4192 cat <&$getfd > get.tmp
4194 curl) case $authorize in
4195 '') curl -s -L -o get.tmp http://$1/$2/$3 2> get.err; code=$? ;;
4196 *) curl -s -L -o get.tmp -u "$authorize":"$password" http://$1/$2/$3 2> get.err; code=$?
4199 0) if grep '^<H1>Authorization Required</H1>' get.tmp > get.err
4205 hurl) case $authorize in
4206 '') ksh -x hurl http://$1/$2/$3 > get.tmp 2> get.err; code=$? ;;
4207 *) ksh -x hurl -a "$authorize":"$password" http://$1/$2/$3 > get.tmp 2> get.err; code=$? ;;
4210 lynx) case $authorize in
4211 '') lynx -source http://$1/$2/$3 > get.tmp 2> get.err; code=$? ;;
4212 *) lynx -source -auth "$authorize":"$password" http://$1/$2/$3 > get.tmp 2> get.err; code=$? ;;
4215 wget) wget -nv -O get.tmp ${authorize:+--http-user="$authorize"} ${password:+--http-passwd="$password"} http://$1/$2/$3 2> get.err
4218 *) echo $command: $action: $HURL: url get command not found >&2
4222 if test 0 != "$code"
4223 then case `cat get.err get.tmp` in
4224 *[Aa][Uu][Tt][Hh][Oo][Rr][Ii][SsZz]*|*[Dd][Ee][Nn][Ii][Ee][Dd]*)
4225 echo $command: $action: authorization required -- see $url for license acceptance authorization name and password >&2
4231 echo $command: $action: $3: download failed >&2
4235 case $checksum:$5 in
4236 :*|*:-) z=`wc -c < get.tmp`
4241 echo $command: $3: download error: expected $4 bytes, got $z >&2
4246 *) z=`$checksum < get.tmp | sed -e 's,^[ ][ ]*,,' -e 's,[ ].*,,'`
4251 echo $command: $3: download $checksum error: expected $5, got $z >&2
4257 mv get.tmp $3 || exit
4259 *) echo "$3 ($4 bytes)" >&2
4265 # generate copyright notice
4270 then echo $1 package general copyright notice
4272 proto -c'#' -p -s -l $1.lic -o type=verbose,author='*' /dev/null
4276 *-*) eval `echo '' $1 | sed 's/\([^-]*\)-\(.*\)/__j__="\1" __i__="\2"/'`
4277 if copyright $__i__ || copyright $__j__
4285 # run remote make on host
4287 remote() # host no-exec-background
4291 eval name=\$${host}_name user=\$${host}_user snarf=\$${host}_snarf type=\$${host}_type rsh=\$${host}_rsh root=\$${host}_root keep=\$${host}_keep log=\$${host}_log
4299 '') exec > $admin_log/$log 2>&1 ;;
4300 *) echo "exec > $admin_log/$log 2>&1" ;;
4304 if $admin_ping $name >/dev/null 2>&1 || $admin_ping $name >/dev/null 2>&1
4305 then cmd=". ./.profile"
4309 *) cmd="$cmd && cd $root"
4313 cmd="$cmd && { test -f lib/package/admin/$admin_env && . ./lib/package/admin/$admin_env || true ;} && PATH=\${PWD:-\`pwd\`}/bin:\$PATH \${SHELL:-/bin/sh} -c 'package $admin_args PACKAGEROOT=\${PWD:-\`pwd\`} HOSTTYPE=$type VPATH='"
4314 case $admin_binary in
4318 '') $exec $rsh $user$name "$cmd" $background
4320 *?) rcp=`echo $rsh | sed 's/\(.\).*/\1/'`cp
4324 $exec $rsh $user$name "$cmd"
4325 eval lst=$admin_list
4328 *) filter="egrep lib/package/tgz/($admin_pkgs)\\." ;;
4330 if $exec $rcp $user$name:${root}lib/package/tgz/$lst $PACKAGESRC/tgz
4331 then $exec $rcp `$filter $PACKAGESRC/tgz/$lst | sed "s,^,$user$name:,"` $PACKAGESRC/tgz
4332 else echo "$command: $user$name:${root}lib/package/tgz/$lst: not found" >&2
4335 ?*) $exec "} $background" ;;
4339 else echo "$command: $name: down" >&2
4343 # update package_src
4347 case $package_src in
4348 '') package_src=$src
4349 for _i_ in `cd $PACKAGESRC; ls *.def *.lic *.pkg 2>/dev/null | sed 's/[-.].*//'`
4350 do case " $package_src " in
4353 *) package_src="$package_src $_i_"
4361 # check for native ascii 0:yes 1:no
4367 case $__isascii__ in
4368 '') case `echo A | od -o | sed -e 's/[ ]*$//' -e '/[ ]/!d' -e 's/.*[ ]//'` in
4369 005101|040412) __isascii__=0 ;;
4378 admin) while test ! -f $admin_db
4379 do case $admin_db in
4380 /*) echo $command: $action: $admin_db: data file not found >&2
4384 view file src lib/package/admin/$admin_db || exit 1
4388 case $admin_action in
4392 test) set $admin_args
4400 *) admin_components=-$1
4407 : all work done in $PACKAGESRC/admin
4408 cd $PACKAGESRC/admin || exit
4411 admin_log=${admin_action}${admin_components}.log
4412 exec < $admin_db || exit
4413 test -d $admin_log || $exec mkdir $admin_log || exit
4425 admin_host=_admin_host_
4427 case " $admin_args " in
4428 *" write binary "*|*" write "*" binary "*)
4435 1) admin_args="only $admin_args" ;;
4437 trap 'kill $pids >/dev/null 2>&1' 1 2 3 15
4439 while read type host root date time make test write owner attributes
4442 *=*) eval "$type $host $root $date $time $make $test $write $owner $attributes"
4444 *) case $admin_action in
4446 eval f='$'$admin_action
4448 *[!0123456789]*) continue ;;
4463 : type=$type host=$host root=$root date=$date time=$time make=$make test=$test write=$write :
4465 hash=`echo $name | sed 's,[^abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789],__,g'`
4466 eval x='$'${hash}_index
4467 eval ${hash}_index=1
4477 eval h='$'${admin_host}${i}_hash
4479 $hash) host=${admin_host}${i}
4480 eval user='$'${host}_user root='$'${host}_rsh:$host:'$'${host}_root
4488 *:$name:*)root=`echo '' $root | sed 's,:.*,:,'` ;;
4491 *:*:*) index=`expr $index + 1`
4492 host=${admin_host}$index
4494 *:*) case " $sync_hosts " in
4495 *" $name ${admin_host}"*)
4496 set '' '' $sync_hosts
4507 *) index=`expr $index + 1`
4508 host=${admin_host}$index
4509 sync_hosts="$sync_hosts $name $host"
4513 *) index=`expr $index + 1`
4514 host=${admin_host}$index
4520 *:*) case $admin_all in
4524 *:) root=${root}. ;;
4532 hostname=$_hostinfo_
4542 *) rsh=$1 sync=$2 root=$3
4546 ?*) case " $sync_hosts " in
4547 *" $sync ${admin_host}"*)
4548 set '' '' $sync_hosts
4559 *) index=`expr $index + 1`
4560 x=${admin_host}$index
4561 sync_hosts="$sync_hosts $sync $x"
4577 *) case " $admin_on " in
4578 *" $name "*) keep=1 ;;
4583 case " $admin_out " in
4587 *) admin_out="$admin_out $name"
4592 '') local_types="$local_types $type" ;;
4595 $host) remote_hosts="$remote_hosts $host"
4597 ?*) eval ${sync}_share=\"\$${sync}_share $host\"
4599 '') local_hosts="$local_hosts $host"
4602 eval ${host}_name='$'name ${host}_hash='$'hash ${host}_type='$'type ${host}_user='$'user ${host}_sync='$'sync ${host}_snarf='$'sync ${host}_rsh='$'rsh ${host}_root='$'root ${host}_keep='$'keep ${host}_log='$'log
4607 for i in $admin_args
4612 do if view - src "lib/package/$i.pkg"
4613 then case $admin_pkgs in
4614 '') admin_pkgs="$i" ;;
4615 *) admin_pkgs="$admin_pkgs|$i" ;;
4619 : "admin_binary :" $admin_binary
4620 : "admin_args :" $admin_args
4621 : "admin_pkgs :" $admin_pkgs
4622 : "admin_on :" "$admin_on"
4623 : "local_hosts :" $local_hosts
4624 : "local_types :" $local_types
4625 : "remote_hosts :" $remote_hosts
4626 : "sync_hosts :" $sync_hosts
4627 : "sync_share :" $sync_share
4628 case $admin_binary in
4631 for main in $local_hosts $remote_hosts
4632 do eval share=\$${main}_share keep=\$${main}_keep
4636 for host in $main $share
4637 do case " $admin_bin_hosts " in
4642 eval type=\$${host}_type
4643 case " $admin_bin_types " in
4655 admin_bin_hosts="$admin_bin_hosts $host"
4656 admin_bin_types="$admin_bin_types $type"
4657 case " $admin_bin_hosts " in
4660 *) case " $admin_bin_main " in
4663 *) admin_bin_main="$admin_bin_main $main"
4672 for host in $admin_bin_main $admin_bin_hosts
4673 do case " $local_hosts " in
4675 local="$local $host"
4677 *) case " $remote_hosts " in
4679 remote="$remote $host"
4686 remote_hosts=$remote
4689 for host in $remote_hosts $local_hosts
4690 do eval share=\$${host}_share
4695 do eval r='$'${s}_share
4697 ?*) case " $share " in
4699 *) share="$share $r" ;;
4705 $oshare) eval ${host}_share="'$share'"
4713 for host in $remote_hosts
4714 do eval type=\$${host}_type
4715 case " $local_types " in
4720 eval name=\$${host}_name keep=\$${host}_keep share=\$${host}_share
4722 do eval type=\$${share}_type keep=\$keep\$${share}_keep
4723 case " $local_types " in
4725 eval ${share}_snarf=
4730 0*1*) keep=2$keep ;;
4734 eval ${host}_keep=$keep
4736 for host in $remote_hosts $local_hosts
4737 do eval name=\$${host}_name user=\$${host}_user type=\$${host}_type sync=\$${host}_sync snarf=\$${host}_snarf share=\$${host}_share rsh=\$${host}_rsh root=\$${host}_root keep=\$${host}_keep
4742 '') case $admin_action in
4745 case $admin_binary in
4754 eval main_log='$'${host}_log
4757 for i in $host $share
4758 do eval n='$'${i}_name t='$'${i}_type q='$'${i}_sync s='$'${i}_snarf l='$'${i}_log k='$'${i}_keep
4763 case $admin_binary in
4767 case " $admin_bin_hosts " in
4777 *) share_keep="$share_keep $i" ;;
4779 echo package "$admin_args" "[ $n $t ]"
4781 '') : > $admin_log/$l ;;
4782 *) $exec ": > $admin_log/$l" ;;
4788 0) admin_ditto_update=--update ;;
4789 *) admin_ditto_update= ;;
4793 case $admin_binary:$sync in
4794 :?*) eval syncname='$'${sync}_name
4795 test -x $PACKAGEROOT/bin/package && $admin_ditto $admin_ditto_update --remote=$rsh --expr="name=='package'" $PACKAGEROOT/bin $user$syncname:$root/bin
4796 test -d $PACKAGESRC && $admin_ditto $admin_ditto_update --remote=$rsh --expr="if(level>1&&path!='LICENSES/*')status=SKIP;path=='LICENSES*|*.(pkg|lic|def)'" $PACKAGESRC $user$syncname:$root/lib/package
4797 for dir in $package_src
4798 do case $MAKESKIP in
4799 '') expr="--expr=if(name=='$admin_ditto_skip')status=SKIP" ;;
4800 *) expr="--expr=if(name=='$admin_ditto_skip'||level==1&&name=='$MAKESKIP')status=SKIP" ;;
4802 test -d $PACKAGEROOT/src/$dir && $admin_ditto $admin_ditto_update --remote=$rsh "$expr" $PACKAGEROOT/src/$dir $user$syncname:$root/src/$dir
4806 case $admin_action in
4827 } < /dev/null > $admin_log/$main_log 2>&1 &
4831 case $admin_binary:$sync in
4832 :?*) eval syncname='$'${sync}_name
4833 test -d $PACKAGESRC && echo $admin_ditto $admin_ditto_update --remote=$rsh --expr="if(level>1)status=SKIP;name=='*.(pkg|lic|def)'" $PACKAGESRC $user$syncname:$root/lib/package
4834 for dir in $package_src
4835 do case $MAKESKIP in
4836 '') expr="--expr=if(name=='$admin_ditto_skip')status=SKIP" ;;
4837 *) expr="--expr=if(name=='$admin_ditto_skip'||level==1&&name=='$MAKESKIP')status=SKIP" ;;
4839 test -d $PACKAGEROOT/src/$dir && echo $admin_ditto $admin_ditto_update --remote=$rsh "$expr" $PACKAGEROOT/src/$dir $user$syncname:$root/src/$dir
4843 case $admin_action in
4864 echo "} < /dev/null > $admin_log/$main_log 2>&1 &"
4867 eval name='$'${main}_name
4868 hosts="$hosts $name"
4869 logs="$logs $main_log"
4871 do eval keep=\$${share}_keep
4873 1) eval name='$'${share}_name log='$'${share}_log
4874 hosts="$hosts $name"
4881 '') # track the progress
4884 tail -t $PACKAGE_admin_tail_timeout -f $logs
4888 # wait for the remote actions to complete
4892 exec < $admin_db || exit
4900 *) case " $hosts " in
4902 : ast date command assumed :
4907 E=`eval date -E \`egrep '[ ](start|done)[ ][ ]*at[ ]' $log | sed -e 's/.*[ ][ ]*at[ ][ ]*//' -e 's/[ ][ ]*in[ ].*$//' -e 's/.*/"&"/'\``
4909 case $admin_action in
4911 M=`egrep -c ']:.* (\*\*\*.* code|don'\''t know) | \*\*\* termination code ' $log` ;;
4912 test) T=`grep -ci 'fail[es]' $log` ;;
4913 *) W=`grep '^[abcdefghijklmnopqrstuvwxyz][abcdefghijklmnopqrstuvwxyz]*:.' $log | egrep -cv 'start at|done at|output captured|warning:|: package not found|whence: command not found'` ;;
4916 ?|??|???|????|?????|??????|???????)
4919 ????????|?????????|??????????|???????????|????????????|?????????????|??????????????|???????????????)
4926 ?|??|???|????|?????|??????|???????)
4933 ?|??|???|????|?????|??????|???????)
4975 ''|?|??|???) K=" $K" ;;
4983 echo "$A $H $R $D $E $M $T $W $O $K"
4984 echo "$A $H $R $D $E $M $T $W $O $K" >&9
4991 done > $admin_db.new
4992 mv $admin_db $admin_db.old
4993 mv $admin_db.new $admin_db
5000 $exec rm -rf $INSTALLROOT
5005 # all work in $PACKAGESRC
5009 # generate the package list
5011 set '' $target $package
5018 echo $command: $action: no packages >&2
5022 set '' `echo $* | sed 's,\.pkg,,g'`
5027 echo packages in $PACKAGEROOT
5030 echo "NAME${nl}VERSION${nl}RELEASE${nl}TYPE${nl}STATUS${nl}REQUIRES${nl}----${nl}-------${nl}-------${nl}----${nl}------${nl}--------" | pr -6 -a -o4 -t
5036 do if test ! -f $pkg.pkg
5037 then echo $command: $action: $pkg: not a package >&2
5038 else if test -f gen/$pkg.ver
5039 then set '' `cat gen/$pkg.ver`
5044 if test -s tgz/$pkg.tim
5077 cmp="$cmp$cmp_sep$1"
5081 req="$req$req_sep$1"
5091 ?*) txt="$nl$txt" ;;
5097 '') case `ls -t "tgz/$pkg.$ver.base" "tgz/$pkg.tim" 2>/dev/null` in
5106 echo "$pkg${nl}$ver${nl}base${nl}$typ${nl}$sts${nl}$req"
5108 '') omit=$omit$pkg.$ver.base: ;;
5115 echo $pkg $ver $req "$txt"
5117 ?*) echo "${sep}Components in this package:$nl"
5118 echo "$cmp" | pr -4 -o4 -t ;;
5126 case $argc:$action in
5127 0:list) if test -d tgz
5129 # f:file p:package v:version r:release t:type u:update
5130 for f in `find . -name '*?[_.][0123456789][0123456789][0123456789][0123456789]-[0123456789][0123456789]-[0123456789][0123456789][_.]*' -print | sed 's,^\./,,' | sort -r`
5131 do eval `echo "$f" | sed -e 's,\.c$,,' -e 's,\.gz$,,' -e 's,\.exe$,,' -e 's,\.tgz$,,' -e 's,\([^_.]*\)[_.]\([0123456789][0123456789][0123456789][0123456789]-[0123456789][0123456789]-[0123456789][0123456789]\)[_.]\([0123456789][0123456789][0123456789][0123456789][^_.]*\)[_.]*\(.*\),p=\1 v=\2 r=\3 t=\4,' -e 's,\([^_.]*\)[_.]\([0123456789][0123456789][0123456789][0123456789]-[0123456789][0123456789]-[0123456789][0123456789]\)[_.]*\(.*\),p=\1 v=\2 r=base t=\3,'`
5134 *:$p.$v.$r:*) continue ;;
5144 then case `ls -t "$f" "$u" 2>/dev/null` in
5150 echo "$p$nl$v$nl$r$nl$t$nl$s$nl"
5157 list) pr -6 -a -o4 -t | sort -u ;;
5161 0) if test -d $PACKAGEROOT/arch
5163 echo architectures in $PACKAGEROOT
5165 for i in `ls $PACKAGEROOT/arch`
5166 do if test -f $PACKAGEROOT/arch/$i/lib/package/gen/host
5167 then h=`cat $PACKAGEROOT/arch/$i/lib/package/gen/host`
5174 done | pr -4 -a -o4 -t
5181 # all work in $PACKAGESRC
5185 # generate the package list
5187 set '' $target $package
5191 0) set '' `echo *.lic | sed 's,\.lic,,g'`
5194 '*') echo $command: $action: no packages >&2
5200 checkaout proto || exit
5206 export) case $INSTALLROOT in
5208 INSTALLROOT=$INSTALLROOT/arch/$HOSTTYPE
5215 set '' $target $package
5225 eval echo ${v}'$'${i}
5229 install)cd $PACKAGEROOT
5233 0) set '' `order "$@"`
5238 0) echo "$command: at least one package name expected" >&2
5243 requirements - $package
5247 flat) flat=1 # backwards compatibility -- documentation dropped
5252 0) echo "$command: $action: target directory argument expected" >&2
5266 if test ! -d $directory
5267 then echo "$command: $action: $directory: target directory not found" >&2
5285 1:*|?:.)dest=$directory
5287 *) dest=$directory/arch/$a
5288 if test "" = "$exec" -a ! -d $dest
5289 then mkdir -p $dest || {
5290 echo "$command: $dest: destination directory must exist" >&2
5297 do if test "ratz" = "$i"
5299 elif test -f arch/$a/lib/package/gen/$i.sum
5300 then package_install $directory arch/$a/lib/package/gen/$i.sum || code=1
5301 elif test ! -d arch/$a/bin
5302 then echo "$command: $a: invalid architecture" >&2
5303 elif test ! -d $dest
5304 then echo "$command: $dest: destination directory must exist" >&2
5305 else if test "" != "$makecheck"
5306 then if onpath $MAKE
5308 else echo "$command: $MAKE: not found" >&2
5313 if test "" != "$exec"
5316 echo "=== $i installation manifest ==="
5320 INSTALLROOT=$PACKAGEROOT/arch/$a
5321 VPATH=$INSTALLROOT:$PACKAGEROOT:$VPATH
5322 export INSTALLROOT VPATH
5323 $MAKE -s $makeflags -f $i.pkg $qualifier list.installed $assign
5331 INSTALLROOT=$PACKAGEROOT/arch/$a
5332 VPATH=$INSTALLROOT:$PACKAGEROOT:$VPATH
5333 export INSTALLROOT VPATH
5335 $MAKE -s $makeflags -f $i.pkg $qualifier list.installed $assign
5336 ) | sort -u | pax -drw -ps $dest
5345 license)# all work in $PACKAGESRC/LICENSES
5347 cd $PACKAGESRC/LICENSES || exit
5349 # generate the package list
5351 set '' $target $package
5358 '*') echo $command: $action: no licenses >&2
5363 *) checkaout proto || exit
5367 do if test -f ../$i.lic
5368 then j=`proto -df -l ../$i.lic -o query=type /dev/null 2>/dev/null`
5381 *-*) i=`echo $i | sed 's/-[^-]*$//'`
5383 *) echo "$command: $i: package license not found" >&2
5396 echo " --- $i source license ---"
5400 *) echo $PACKAGESRC/LICENSES/$i
5409 '') lic="lib/package/*.lic"
5411 *) for i in $package
5412 do lic="$lic lib/package/$i.lic"
5414 *-*) lic="$lic lib/package/"`echo $i | sed 's,-.*,,'`".lic" ;;
5420 requirements source $package
5422 package=$_components_
5424 # check for some required commands
5427 warn="$NM yacc bison"
5436 then have="$have $t"
5441 do case " $have " in
5444 *) if executable $d/$t
5445 then have="$have $t"
5453 *" yacc "*) have="$have bison" ;;
5457 *" bison "*) have="$have yacc" ;;
5460 do case " $have " in
5463 *) case " $must " in
5465 echo "$command: $t: not found -- must be on PATH to $action" >&2
5468 *) echo "$command: warning: $t: not found -- some $action actions may fail" >&2
5475 # verify the top view
5477 if test ! -d $PACKAGEROOT/src
5478 then note no source packages to make
5480 elif test ! -d $INSTALLROOT/src
5481 then note initialize the $INSTALLROOT view
5483 for i in arch arch/$HOSTTYPE
5484 do test -d $PACKAGEROOT/$i || $exec mkdir $PACKAGEROOT/$i || exit
5486 for i in bin fun include lib lib/package lib/package/gen src man man/man1 man/man3 man/man8 $OK $OK/bin $OK/lib
5487 do test -d $INSTALLROOT/$i || $exec mkdir $INSTALLROOT/$i || exit
5493 ?*) o="$o -o" k="$k|" ;;
5499 for d in $package_src
5502 then test -d $INSTALLROOT/$i || $exec mkdir $INSTALLROOT/$i || exit
5504 for j in `cd $i; find . $o 2>/dev/null | sed -e 's,^\./,,' -e '/\//!d' -e 's,/[^/]*$,,' | sort -u`
5506 $k|$MAKESKIP) continue ;;
5508 test -d $INSTALLROOT/$i/$j ||
5509 $exec mkdir -p $INSTALLROOT/$i/$j || exit
5515 do test -f $i || continue
5516 cmp -s $i $INSTALLROOT/$i 2>/dev/null ||
5517 $exec cp $PACKAGEROOT/$i $INSTALLROOT/$i
5518 for j in `grep '^. .*\.def$' $i`
5531 test -f $i || continue
5532 cmp -s $i $INSTALLROOT/$i 2>/dev/null ||
5533 $exec cp $PACKAGEROOT/$i $INSTALLROOT/$i
5536 # check $CC and { ar cc ld ldd } intercepts
5538 h="${HOSTTYPE} ${HOSTTYPE}.*"
5540 *.*) t=`echo $HOSTTYPE | sed 's/[.][^.]*//'`
5548 t=`echo $t | sed 's/[0123456789]*$//'`
5554 b=$INSTALLROOT/bin/$c
5555 t=$INSTALLROOT/lib/package/gen/$c.tim
5558 do for s in $INITROOT/$c.$k
5559 do test -x "$s" || continue
5560 if cmp -s "$s" "$b" >/dev/null 2>&1
5564 case `ls -t "$t" "$b" "$s" 2>/dev/null` in
5568 $s*) cd $INSTALLROOT/lib/package/gen
5570 eval '$'exec echo "'int main(){return 0;}' > $tmp.c"
5571 if $exec $s -o $tmp.exe $tmp.c >/dev/null 2>&1 &&
5573 then case $HOSTTYPE in
5574 *.mips*)$s -version >/dev/null 2>&1 || s= ;;
5577 ?*) $exec sed "s/^HOSTTYPE=.*/HOSTTYPE=$HOSTTYPE/" < "$s" > "$b" || exit
5578 $exec chmod +x "$b" || exit
5595 b=$INSTALLROOT/bin/$c
5597 do for s in $INITROOT/$c.$k
5598 do test -x "$s" || continue
5599 case `ls -t "$b" "$s" 2>/dev/null` in
5601 $s*) $exec cp "$s" "$b"
5612 b=$INSTALLROOT/bin/$c
5614 do s=$INITROOT/$c.$t
5615 test -x "$s" || continue
5617 case `ls -t "$b" "$s" 2>/dev/null` in
5619 $s*) $exec cp "$s" "$b"
5624 # following code stubbed out just in case ar.ibm.risc is needed
5626 # b=$INSTALLROOT/bin/$c
5628 # do s=$INITROOT/$c.$t
5629 # test -x "$s" || continue
5631 # case `ls -t "$b" "$s" 2>/dev/null` in
5633 # $s*) x=`$s -tv /foo/bar.a 2>&1 | egrep -i 'option|usage'`
5635 # '') $exec cp "$s" "$b"
5644 *) echo "$command: $CC: not found -- set CC=C-compiler" >&2
5649 '') cd $INSTALLROOT/lib/package/gen
5651 echo 'int main(){return 0;}' > $tmp.c
5652 if $CC -o $tmp.exe $tmp.c > /dev/null 2> $tmp.err &&
5655 else echo "$command: $CC: failed to compile this program:" >&2
5658 then cat $tmp.err >&2
5659 else echo "$command: $CC: not a C compiler" >&2
5669 # remember the default $CC
5673 *) if test -x $INSTALLROOT/bin/cc
5674 then case `sed 1q $INSTALLROOT/bin/cc` in
5679 *) assign="$assign CC=\"\$CC\""
5683 1) assign="$assign CC=\"\$CC\""
5689 } > $INSTALLROOT/bin/cc
5690 chmod +x $INSTALLROOT/bin/cc
5692 *) note generate a $INSTALLROOT/bin/cc wrapper for $CC
5703 # no $INITROOT means INIT already installed elsewhere
5705 if test -d $INITROOT
5707 # update probe scripts
5709 for i in lib/probe lib/probe/C lib/probe/C/make
5710 do test -d $INSTALLROOT/$i || $exec mkdir $INSTALLROOT/$i || exit
5712 i=$INSTALLROOT/lib/probe/C/make/probe
5714 k=$INITROOT/make.probe
5715 case `ls -t $i $j $k 2>/dev/null` in
5717 *) if test -f $j -a -f $k
5723 ?*) echo "$SHELLMAGIC" ;;
5734 $exec chmod +x $i || exit
5740 # initialize a few mamake related commands
5742 checkaout mamake proto ratz release || exit
5744 # execrate if necessary
5746 if (execrate) >/dev/null 2>&1
5747 then execrate=execrate
5748 $make cd $INSTALLROOT/$OK/bin
5749 for i in chmod chgrp cmp cp ln mv rm
5750 do if test ! -x $i -a -x /bin/$i.exe
5753 '') echo "$SHELLMAGIC"'execrate /bin/'$i' "$@"' > $i
5756 *) $exec echo \'"$SHELLMAGIC"'execrate /bin/'$i' "$@"'\'' >' $i
5762 PATH=$INSTALLROOT/$OK/bin:$PATH
5770 # all work under $INSTALLROOT/src
5772 $make cd $INSTALLROOT/src
5774 # record the build host name
5778 echo "$_hostinfo_" | sed 's,\..*,,' > $PACKAGEBIN/gen/host
5782 # make in parallel if possible
5788 *) NPROC=$_hostinfo_
5797 # separate flags from target list
5803 -[eiknFKNV]*|--*-symbols)
5804 makeflags="$makeflags $t"
5806 -*) nmakeflags="$nmakeflags $t"
5816 # generate nmake first if possible
5818 if executable ! $NMAKE && test -d $PACKAGEROOT/src/cmd/nmake
5819 then if nonmake $MAKE
5820 then note make $NMAKE with mamake
5825 CC="$CC -D_BLD_STATIC"
5829 *) assign="$assign CC=\"\$CC\"" ;;
5835 eval capture mamake \$makeflags \$nmakeflags \$noexec install nmake $assign
5838 case $make$noexec in
5839 '') if executable ! $NMAKE
5840 then echo "$command: $action: errors making $NMAKE" >&2
5847 if test '' != "$PROTOROOT"
5848 then if (vpath $INSTALLROOT - $PROTOROOT - $INSTALLROOT $PACKAGEROOT) >/dev/null 2>&1 &&
5849 vpath $INSTALLROOT - $PROTOROOT - $INSTALLROOT $PACKAGEROOT
5850 then $show vpath $INSTALLROOT $PACKAGEROOT $USER_VPATH_CHAIN
5851 else VPATH=$INSTALLROOT:$PACKAGEROOT$USER_VPATH
5856 note believe generated files for $accept
5857 eval capture \$NMAKE \$makeflags \$nmakeflags \$noexec recurse believe \$nmakesep $accept $assign
5858 $exec touch $INSTALLROOT/bin/.paths
5859 note make the remaining targets with $NMAKE
5860 else eval capture $MAKE \$makeflags \$nmakeflags \$noexec install nmake $assign
5861 case $make$noexec in
5862 '') if executable ! $NMAKE
5863 then echo "$command: $action: errors making $NMAKE" >&2
5873 # generate ksh next if possible
5876 then : no need to generate ksh next -- it could be the only package
5877 elif test "$KEEP_SHELL" != 1 -a -d $PACKAGEROOT/src/cmd/ksh93 && executable ! $KSH
5878 then eval capture nmake $nmakeflags \$makeflags \$noexec install ksh93 $assign
5879 case $make$noexec in
5880 '') if executable ! $KSH
5881 then echo "$command: $action: warning: errors making $KSH" >&2
5889 # mamprobe data should have been generated by this point
5892 '') if test ! -f $INSTALLROOT/bin/.paths -o -w $INSTALLROOT/bin/.paths
5895 a= b= f= h= n= p= u= B= L=
5896 if test -f $INSTALLROOT/bin/.paths
5897 then exec < $INSTALLROOT/bin/.paths
5906 *BUILTIN_LIB=*) b=$x
5938 [Nn][Oo]*) p=no$p ;;
5944 '') f="FPATH=../fun"
5949 '') h='# use { no NO } prefix to permanently disable #' ;;
5952 '') p="PLUGIN_LIB=cmd"
5953 if grep '^setv mam_cc_DIALECT .* EXPORT=[AD]LL' $INSTALLROOT/lib/probe/C/mam/* >/dev/null 2>&1
5963 echo "$h$N$a$N$p$N$f$N$u" > $INSTALLROOT/bin/.paths
5970 # run from separate copies since nmake and ksh may be rebuilt
5974 $make cd $INSTALLROOT/bin
5975 if executable /bin/cp
5979 if executable /bin/mv
5983 if executable /bin/rm
5988 ksh nmake tee cp ln mv rm \
5989 *ast*.dll *cmd*.dll *dll*.dll *shell*.dll
5990 do executable $i && {
5991 cmp -s $i ../$OK/bin$i 2>/dev/null || {
5992 test -f ../$OK/bin/$i &&
5993 $exec $execrate $rm ../$OK/bin/$i </dev/null
5994 test -f ../$OK/bin/$i &&
5995 $exec $execrate $mv ../$OK/bin/$i ../$OK/bin/$i.old </dev/null
5996 test -f ../$OK/bin/$i &&
5999 echo "$command: ../$OK/bin/$i: cannot update [may be in use by a running process] remove manually and try again" >&2
6003 $exec $execrate $cp $i ../$OK/bin/$i
6007 if executable ../$OK/bin/nmake
6008 then MAKE="$INSTALLROOT/$OK/bin/nmake LOCALRULESPATH=$INSTALLROOT/$OK/lib/make"
6010 if executable ../$OK/bin/tee
6011 then TEE=$INSTALLROOT/$OK/bin/tee
6013 $make cd $INSTALLROOT/lib
6014 for i in *ast.* *cmd.* *dll.* *shell.*
6017 *) cmp -s $i ../$OK/lib/$i || $exec $cp -f $i ../$OK/lib ;;
6020 if test "$KEEP_SHELL" != 1 && executable $INSTALLROOT/$OK/bin/ksh
6021 then SHELL=$INSTALLROOT/$OK/bin/ksh
6027 *:$INSTALLROOT/$OK:*)
6029 *) PATH=$INSTALLROOT/$OK/bin:$PATH
6033 $make cd $INSTALLROOT/src
6037 # fall back to mamake if nmake not found or too old
6040 then note make with mamake
6042 '') target="install" ;;
6044 eval capture mamake \$makeflags \$noexec \$target $assign
6045 else case $target in
6046 '') target="install cc-" ;;
6048 eval capture \$MAKE \$makeflags \$nmakeflags \$noexec recurse \$target \$nmakesep \$package $assign
6052 read) case ${PWD:-`pwd`} in
6055 *) echo "$command: must be in package root directory" >&2
6061 then case `$_onpath_ -rw --?meter 2>&1` in
6062 *--meter*) PAX=pax ;;
6079 set '' $package $target
6082 set '' `ls lib/package/$tgz/*?[_.][0123456789][0123456789][0123456789][0123456789]-[0123456789][0123456789]-[0123456789][0123456789][_.]* 2>/dev/null`
6092 elif test -f "lib/package/$tgz/$f"
6093 then f=lib/package/$tgz/$f
6094 else set '' `ls -r ${f}[_.][0123456789][0123456789][0123456789][0123456789]-[0123456789][0123456789]-[0123456789][0123456789][_.]* 2>/dev/null`
6095 if test '' != "$2" -a -f "$2"
6097 else set '' `ls -r lib/package/$tgz/${f}[_.][0123456789][0123456789][0123456789][0123456789]-[0123456789][0123456789]-[0123456789][0123456789][_.]* 2>/dev/null`
6098 if test '' != "$2" -a -f "$2"
6100 else echo "$command: $f: package archive not found" >&2
6108 '') echo "$command: lib/package/$tgz: no package archives" >&2
6112 set '' `ls -r $files 2>/dev/null`
6131 set '' $f1 $f2 $f3 $f4
6139 *.gz) : standalone packages unbundled manually
6142 *.md5) : tarball checksum
6145 *?[_.][0123456789][0123456789][0123456789][0123456789]-[0123456789][0123456789]-[0123456789][0123456789][_.]*)
6147 *) echo "$command: $f: not a package archive" >&2
6153 */*) eval `echo "$f" | sed -e 's,\(.*/\)\(.*\),d=\1 a=\2,'` ;;
6156 # f:file d:dir a:base p:package v:version r:release t:type
6157 eval `echo "$a" | sed -e 's,\.c$,,' -e 's,\.gz$,,' -e 's,\.exe$,,' -e 's,\.tgz$,,' -e 's,\([^_.]*\)[_.]\([0123456789][0123456789][0123456789][0123456789]-[0123456789][0123456789]-[0123456789][0123456789]\)[_.]\([0123456789][0123456789][0123456789][0123456789][^_.]*\)[_.]*\(.*\),p=\1 v=\2 r=\3 t=\4,' -e 's,\([^_.]*\)[_.]\([0123456789][0123456789][0123456789][0123456789]-[0123456789][0123456789]-[0123456789][0123456789]\)[_.]*\(.*\),p=\1 v=\2 r=base t=\3,'`
6173 *) w=$PACKAGEROOT/arch/$t/lib/package
6183 0) case `ls -t "$f" "$u" 2>/dev/null` in
6184 "$u"*) case $verbose in
6185 1) note $p already read ;;
6194 INIT) if test -f $PACKAGEROOT/bin/package
6195 then $exec mv $PACKAGEROOT/bin/package $PACKAGEROOT/bin/package.old
6201 base) # base archive
6203 then # ratz packages are not archives
6205 '') for i in src src/cmd src/cmd/INIT
6206 do test -d $PACKAGEROOT/$i || $exec mkdir $PACKAGEROOT/$i || exit
6208 $exec cp $f $PACKAGEROOT/src/cmd/INIT/$p.c
6210 *) for i in arch arch/$t arch/$t/bin
6211 do test -d $PACKAGEROOT/$i || $exec mkdir $PACKAGEROOT/$i || exit
6213 $exec cp $f $PACKAGEROOT/arch/$t/bin/$p &&
6214 $exec chmod +x $PACKAGEROOT/arch/$t/bin/$p
6217 elif test "" != "$PAX"
6218 then $exec pax -L --from=ascii --local -m -ps -rvf "$f" || {
6222 else if onpath gunzip && onpath $TAR && isascii
6223 then case $TARPROBE in
6224 ?*) for i in $TARPROBE
6225 do if $TAR ${i}f - /dev/null > /dev/null 2>&1
6226 then TARFLAGS=$TARFLAGS$i
6232 if gunzip -l < "$f" > /dev/null 2>&1
6234 '') $exec gunzip < "$f" | $TAR ${TARFLAGS}f - ;;
6235 *) $exec "gunzip < $f | $TAR ${TARFLAGS}f -" ;;
6240 else $exec $TAR ${TARFLAGS}f "$f" || {
6245 else checkaout ratz && onpath ratz || {
6252 $exec $RATZ -lm < "$f"
6254 *) $exec "$RATZ -lm < $f"
6261 if test -f $PACKAGEBIN/gen/$p.sum
6262 then while read md5 mode usr grp file
6267 [01234567][01234567][01234567][01234567])
6270 *) $exec chgrp $grp "$file" ;;
6274 *) $exec chown $usr "$file" ;;
6276 $exec chmod $mode "$file"
6279 done < $PACKAGEBIN/gen/$p.sum
6284 test "" != "$PAX" || {
6285 echo "$command: $f: pax required to read delta archive" >&2
6292 b=${d}${p}_${r}${Q}.tgz
6293 test -f "$b" || b=${d}${p}.${r}${q}.tgz
6299 1) echo "$command: $f: base archive $b required to read delta" >&2
6311 # -m with delta bug fixed 2005-02-08
6312 $exec pax -L --from=ascii --local -ps -rvf "$f" -z "$b" || {
6316 note $f: generate new base $d$p.$v$q.tgz
6317 $exec pax -rf "$f" -z "$b" -wf $d$p.$v$q.tgz -x tgz || {
6322 '') echo $p $v $v 1 > $w/gen/$p.ver
6324 *) z=$d${p}[_.]$v$q.tgz
6325 $exec "echo $p $v $v 1 > $w/gen/$p.ver"
6326 gen="$gen $d$p.$v$q.tgz"
6331 *) remove="$remove $f" ;;
6334 *) b=${d}${p}_${v}${Q}.tgz
6335 test -f "$b" || b=${d}${p}.${v}${q}.tgz
6341 1) echo "$command: $f: base archive $b required to read delta" >&2
6353 # -m with delta bug fixed 2005-02-08
6354 $exec pax -L --from=ascii --local -ps -rvf "$f" -z "$b" || {
6361 *) echo "$command: $f: unknown archive type" >&2
6367 # check for ini files
6369 if executable $w/$p.ini
6370 then $exec $w/$p.ini read || {
6376 # add to the obsolete list
6379 for i in `ls $d$p[_.][0123456789][0123456789][0123456789][0123456789]-[0123456789][0123456789]-[0123456789][0123456789][_.]????$m* $z 2>/dev/null`
6383 $d${p}[_.][0123456789][0123456789][0123456789][0123456789]-[0123456789][0123456789]-[0123456789][0123456789][_.][0123456789][0123456789][0123456789][0123456789]-[0123456789][0123456789]-[0123456789][0123456789]$m*)
6385 $d${p}[_.][0123456789][0123456789][0123456789][0123456789]-[0123456789][0123456789]-[0123456789][0123456789]$m*)
6390 ?*) case " $remove " in
6392 *) remove="$remove $k" ;;
6401 *) touch="$touch $u" ;;
6404 if test ! -f $PACKAGEROOT/bin/package -a -f $PACKAGEROOT/bin/package.old
6405 then $exec cp $PACKAGEROOT/bin/package.old $PACKAGEROOT/bin/package
6408 # drop obsolete archives
6411 ?*) $exec rm -f $remove ;;
6414 # mark the updated archives
6417 ?*) sleep 1; $exec touch $touch ;;
6420 # check the requirements
6423 0) requirements - $x ;;
6428 regress)if test ! -d $PACKAGEBIN/gen
6429 then echo "$command: 'package make' and 'package test' required for regression" >&2
6435 do case `ls -t regress.$s test.$s 2>/dev/null` in
6438 test*) if test -f regress.$s
6439 then $exec mv regress.$s regress.old
6442 '') egrep -i '\*\*\*|FAIL|^TEST.* [123456789][0123456789]* error|core.*dump' test.$s |
6443 sed -e '/\*\*\* [0123456789]/d' \
6444 -e '/^TEST.\//s,/[^ ]*/,,' \
6446 -e 's/[0123456789][0123456789]*:* \([abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789 ]*([abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789 ]*[Cc][Oo][Rr][Ee][abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789 ]*)\)/\1/' \
6447 -e 's/\.sh failed at .* with /.sh failed /' \
6450 *) $exec filter test failures from $dir/test.$s to $dir/regress.$s
6456 if test -f regress.out -a -f regress.old
6457 then $exec diff -b regress.out regress.old
6458 else echo "$command: at least 2 test runs required for regression" >&2
6463 release)count= lo= hi=
6465 checkaout release || exit
6466 requirements source $package
6468 package=$_components_
6474 -|[0123456789][0123456789]-[0123456789][0123456789]-[0123456789][0123456789]|[0123456789][0123456789][0123456789][0123456789]-[0123456789][0123456789]-[0123456789][0123456789])
6477 *) lo=$1 release="-f $1" ;;
6481 -|[0123456789][0123456789]-[0123456789][0123456789]-[0123456789][0123456789]|[0123456789][0123456789][0123456789][0123456789]-[0123456789][0123456789]-[0123456789][0123456789])
6484 *) hi=$1 release="$release -t $1" ;;
6490 [0123456789]|[0123456789][0123456789]|[0123456789][0123456789][0123456789]|[0123456789][0123456789][0123456789][0123456789]|[0123456789][0123456789][0123456789][0123456789][0123456789]*)
6506 *) echo $command: $*: lo-date hi-date arguments expected >&2
6513 case $count:$lo:$hi in
6514 ::) echo "All recorded changes follow." ;;
6515 1::) echo "Changes since the last release follow." ;;
6516 ?*::) echo "Changes since the last $count releases follow." ;;
6517 1:?*:) echo "Changes since $lo or the last release follow." ;;
6518 *:?*:*) echo "Changes since $lo follow." ;;
6519 *::?*) echo "Changes before $hi follow." ;;
6520 *) echo "Changes between $lo and $hi follow." ;;
6523 for r in $INSTALLROOT $PACKAGEROOT
6524 do for s in $package_src
6529 do if test -h $i 2>/dev/null
6533 *" $i "*) continue ;;
6535 for f in RELEASE CHANGES ChangeLog
6537 then $exec release $release $i/$f
6541 then $exec release $release $f
6553 remove) echo "$command: $action: not implemented yet" >&2
6557 results)set '' $target
6576 admin) dir=$PACKAGESRC/admin
6581 make|test|view|write)
6583 case $filter:$1:$SHELL in
6585 *:test:*/ksh*) filter=rt ;;
6591 1) echo $command: $action: $1: host pattern argument expected >&2
6626 eval set '""' $i - $i.$suf - $dir/$i - $dir/$i.$suf -
6637 */test.*) t="$t $j" ;;
6644 echo "$command: $i action output not found" >&2
6651 do echo "$sep==> $j <=="
6656 errors) $exec egrep -i '\*\*\*|FAIL[ES]|^TEST.* [123456789][0123456789]* error|core.*dump' $j | sed -e '/^TEST.\//s,/[^ ]*/,,'
6658 rt) $exec $KSH rt - $j
6660 *) $exec egrep -i '^TEST|FAIL' $j
6675 *) if test -f $HOME/.pkgresults
6676 then i="`cat $HOME/.pkgresults`"
6684 do echo "$sep==> $j <=="
6687 errors) $exeg egrep '^pax:|\*\*\*' $j
6689 *) $exec egrep -iv '^($|
\e|[\+\[]|cc[^-:]|kill |make.*(file system time|has been replaced)|so|[0123456789]+ error|uncrate |[0123456789]+ block|ar: creat|iffe: test: |conf: (check|generate|test)|[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_][abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789]*=|gsf@research|ar:.*warning|cpio:|ld:.*(duplicate symbol|to obtain more information)|[0123456789]*$|(checking|creating|touch) [/abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789])| obsolete predefined symbol | is (almost always misused|dangerous|deprecated|not implemented)| trigraph| assigned to | cast .* different size| integer overflow .*<<| optimization may be attained | passed as |::__builtin|pragma.*prototyped|^creating.*\.a$|warning.*not optimized|exceeds size thresh|ld:.*preempts|is unchanged|with value >=|(-l|lib)\*|/(ast|sys)/(dir|limits|param|stropts)\.h.*redefined|usage|base registers|`\.\.\.` obsolete'"$i" $j |
6703 test) requirements source $package
6705 package=$_components_
6708 1) only=--recurse=only ;;
6714 then echo $command: $action: must have $MAKE to test >&2
6718 # all work under $INSTALLROOT/src
6720 $make cd $INSTALLROOT/src
6722 # disable core dumps (could be disasterous over nfs)
6724 (ulimit -c 0) > /dev/null 2>&1 && ulimit -c 0
6728 eval capture \$MAKE \$makeflags \$noexec \$only recurse test \$target \$nmakesep \$package $assign
6731 update) # download the latest release.version for selected packages
6733 # all work in $PACKAGEROOT/lib/package/tgz
6735 if test ! -d $PACKAGEROOT/lib/package/tgz
6736 then $exec mkdir -p $PACKAGEROOT/lib/package/tgz || exit
6737 $exec cd $PACKAGEROOT/lib/package/tgz
6738 else cd $PACKAGEROOT/lib/package/tgz
6741 # get the architectures, update query url, and packages
6751 urlfile=$default_url
6775 if test ! -s $urlfile
6776 then echo $command: $urlfile: not found >&2; exit 1
6788 case $source:$binary in
6789 :) source=1 binary=1
6792 '') types=$HOSTTYPE ;;
6797 '') case $urlfile in
6799 if test ! -s $urlfile
6800 then echo $command: url argument expected >&2; exit 1
6807 if grep '^url=' $urlfile >/dev/null
6812 *) urlfile=./$urlfile ;;
6816 $authorize:$password)
6827 else url=`cat $urlfile`
6835 # get the update list
6837 eval `echo $url | sed 's,\(.*\)://\([^/]*\)/\(.*\),prot=\"\1\" host=\"\2\" dir=\"\3\",'`
6838 get $host $dir/$op.html
6840 # get/check the package names
6843 *" - "*)case $source in
6844 1) source_packages=$* ;;
6845 *) source_packages= ;;
6848 1) binary_packages=$* ;;
6849 *) binary_packages= ;;
6857 for f in `ls *.????-??-??.* 2>/dev/null`
6859 *.????-??-??.????-??-??.*.*)
6861 *.????-??-??.????-??-??.*)
6871 set '' `echo "$p" | sed 's,\..*,,' | sort -u`
6880 for f in `ls *.????-??-??.* 2>/dev/null`
6882 *.????-??-??.????-??-??.*.*)
6885 *.????-??-??.????-??-??.*)
6894 set '' `echo "$p" | sed 's,\..*,,' | sort -u`
6901 package_hit="$source_packages $binary_packages"
6904 1) source_packages=$* ;;
6905 *) source_packages= ;;
6908 1) binary_packages=$* ;;
6909 *) binary_packages= ;;
6915 # get the latest updates
6920 case $default_url in
6921 ?*) echo "url='$url' authorize='$authorize' password='$password'" > $default_url
6923 ?*) chmod go-rwx $default_url ;;
6927 echo "$got" > got.tmp
6931 while read name suffix type base base_size delta delta_size sync sync_size requires covers base_sum delta_sum sync_sum comment
6932 do case $requires in
6939 -) case " $source_packages " in
6940 *" $name "*|*" - "*)
6942 do case " $source_packages " in
6945 *) source_packages="$source_packages $name"
6946 covered=$covered:$covers
6953 *) case " $binary_packages " in
6954 *" $name "*|*" - "*)
6956 do case " $binary_packages " in
6959 *) binary_packages="$binary_packages $name"
6960 covered=$covered:$covers
6970 ?*) x=$source_packages
6973 do case :$covered: in
6975 *) source_packages="$source_packages $name" ;;
6981 do case :$covered: in
6983 *) binary_packages="$binary_packages $name" ;;
6991 for i in $checksum_commands
6992 do case `( $i ) < /dev/null 2> /dev/null` in
6993 ${checksum_empty}|${checksum_empty}[\ \ ]*)
7000 '') echo $command: warning: '{' $checksum_commands '}' command not found -- only download sizes will be checked >&2 ;;
7003 while read name suffix type base base_size delta delta_size sync sync_size requires covers base_sum delta_sum sync_sum comment
7009 j="$name.$base$i.$suffix"
7012 *) j="$j $name.$base.$delta$i.$suffix" ;;
7016 *) j="$j $name.$base.$sync$i.$suffix" ;;
7018 echo $command: $j $base_size:$base_sum $delta_size:$delta_sum $sync_size:$sync_sum $requires >&2
7020 case " $package_hit " in
7021 *" $name "*|*" - "*)
7023 *) package_hit="$package_hit $name"
7027 -) case " $source_packages " in
7028 *" $name "*|*" - "*)
7029 if test -s $name.tim
7032 lcl=$name.$base.$suffix
7034 then case $checksum:$base_sum in
7035 :*|*:-) size=`wc -c < $lcl | sed 's, ,,g'` sum=$base_sum ;;
7036 *) size=$base_size sum=`$checksum < $lcl | sed -e 's,^[ ][ ]*,,' -e 's,[ ].*,,'` ;;
7040 if test "0" != "$force" -a "X-" = "X$delta" -o "$base_size" != "$size" -o "$base_sum" != "$sum"
7042 case $sync:$sync_size in
7045 *) lcl=$name.$base.$sync.$suffix
7048 get $host $dir $lcl $sync_size $sync_sum
7052 case $base:$base_size in
7056 '') lcl=$name.$base.$suffix
7057 get $host $dir $lcl $base_size $base_sum
7063 case $delta:$delta_size in
7066 *) lcl=$name.$delta.$base.$suffix
7068 then case $checksum:$delta_sum in
7069 :*|*:-) size=`wc -c < $lcl | sed 's, ,,g'` sum=$delta_sum ;;
7070 *) size=$base_size sum=`$checksum < $lcl | sed -e 's,^[ ][ ]*,,' -e 's,[ ].*,,'` ;;
7074 if test "0" != "$force" -o "$delta_size" != "$size" -o "$delta_sum" != "$sum"
7075 then get $host $dir $lcl $delta_size $delta_sum
7082 *) case " $binary_packages " in
7083 *" $name "*|*" - "*)
7084 if test -s $name.$type.tim
7089 " ") case " $types_test " in
7092 *) types_test="$types_test $type"
7093 for i in *.????-??-??.$type.* *.????-??-??.????-??-??.$type.*
7095 then types_local="$types_local $type"
7101 case " $types_local " in
7108 *) case " $types " in
7116 lcl=$name.$base.$type.$suffix
7118 then case $checksum:$base_sum in
7119 :*|*:-) size=`wc -c < $lcl | sed 's, ,,g'` sum=$base_sum ;;
7120 *) size=$base_size sum=`$checksum < $lcl | sed -e 's,^[ ][ ]*,,' -e 's,[ ].*,,'` ;;
7124 if test "0" != "$force" -a "X-" = "X$delta" -o "$base_size" != "$size" -o "$base_sum" != "$sum"
7126 case $sync:$sync_size in
7129 *) lcl=$name.$base.$sync.$type.$suffix
7132 get $host $dir $lcl $sync_size $sync_sum
7136 case $base:$base_size in
7140 '') lcl=$name.$base.$type.$suffix
7141 get $host $dir $lcl $base_size $base_sum
7147 case $delta:$delta_size in
7150 *) lcl=$name.$delta.$base.$type.$suffix
7152 then sum=`$checksum < $lcl | sed -e 's,^[ ][ ]*,,' -e 's,[ ].*,,'`
7156 then case $checksum:$delta_sum in
7157 :*|*:-) size=`wc -c < $lcl | sed 's, ,,g'` sum=$delta_sum ;;
7158 *) size=$base_size sum=`$checksum < $lcl | sed -e 's,^[ ][ ]*,,' -e 's,[ ].*,,'` ;;
7162 if test "0" != "$force" -o "$delta_size" != "$size" -o "$delta_sum" != "$sum"
7163 then get $host $dir $lcl $delta_size $delta_sum
7173 for name in $source_packages $binary_packages
7176 *) case " $package_hit " in
7179 1) case " $closure " in
7182 *) closure="$closure $name"
7188 *) echo $command: $name: unknown package >&2
7197 ?*) echo $closure ;;
7201 use) # finalize the environment
7204 for d in `( cd $PACKAGEROOT; ls src/*/Makefile src/*/Nmakefile 2>/dev/null | sed 's,/[^/]*$,,' | sort -u )`
7205 do x=$x:$INSTALLROOT/$d
7210 *) CDPATH=$x:$CDPATH
7211 $show CDPATH=$CDPATH
7228 *) NPROC=$_hostinfo_
7236 eval PACKAGE_USE=$package_use
7243 ':') $exec exec $SHELL ;;
7246 *) $exec exec $SHELL -c "$run"
7251 verify) cd $PACKAGEROOT
7252 requirements binary $package
7253 if executable ! $SUM
7254 then echo "$command: $action: $SUM command required" >&2
7268 '') set '' arch/$a/lib/package/gen/*.sum
7272 do package_verify $i || code=1
7274 else echo "$command: warning: $a: no binary packages" >&2
7277 *) for i in $package
7278 do if test -f arch/$a/lib/package/gen/$i.sum
7279 then package_verify arch/$a/lib/package/gen/$i.sum || code=1
7280 else echo "$command: warning: $a: no binary package for $i" >&2
7289 write) set '' $target
7296 base|closure|delta|exp|lcl|pkg|rpm|tgz)
7297 qualifier="$qualifier $1"
7301 eval list=$PACKAGESRC/tgz/$admin_list
7303 cyg) qualifier="$qualifier $1"
7304 assign="$assign closure=1"
7310 tst) qualifier="$qualifier tgz"
7311 assign="$assign copyright=0 'PACKAGEDIR=\$(PACKAGESRC)/tst'"
7314 assign="$assign copyright=0"
7322 '') echo "$command: binary or source operand expected" >&2
7326 set '' "$@" $package
7329 0) set '' `order "$@"`
7334 0) echo "$command: at least one package name expected" >&2
7339 then echo "$command: must have $MAKE to generate archives" >&2
7343 # all work under $PACKAGEBIN
7345 $make cd $PACKAGEBIN
7347 ?*) $exec rm -f $list ;;
7353 do if view - all $package.pkg || view - all lib/package/$package.pkg
7354 then eval capture \$MAKE \$makeflags -X ignore \$noexec -f \$package.pkg \$qualifier \$action $assign
7355 else echo "$command: $package: not a package" >&2
7360 TEST) set '' $target $package
7371 *) echo "$command: $action: internal error" >&2