website: manual: refresh qi.html to be reflected on the website
[dragora.git] / website / manual / en / pkgmanagement.html
blob7181f442597de4036b3e7351d695ad73787f15af
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2 <HTML>
3 <HEAD>
4 <META NAME="generator" CONTENT="http://txt2tags.org">
5 </HEAD><BODY BGCOLOR="white" TEXT="black">
6 <CENTER>
7 </CENTER>
10 <H1>Part IV - Package management</H1>
12 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
13 <html>
14 <!-- This user guide is for Qi (version 1.1,
15 19 May 2019), which is a simple but well-integrated package manager.
17 Copyright (C) 2019 Matias Andres Fonzo, Santiago del Estero,
18 Argentina.
20 Permission is granted to copy, distribute and/or modify this document
21 under the terms of the GNU Free Documentation License, Version 1.3 or
22 any later version published by the Free Software Foundation; with no
23 Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
24 Texts. A copy of the license is included in the section entitled
25 "GNU Free Documentation License". -->
26 <!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ -->
27 <head>
28 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
29 <title>Qi user guide</title>
31 <meta name="description" content="Qi user guide">
32 <meta name="keywords" content="Qi user guide">
33 <meta name="resource-type" content="document">
34 <meta name="distribution" content="global">
35 <meta name="Generator" content="makeinfo">
36 <link href="#Top" rel="start" title="Top">
37 <link href="#Index" rel="index" title="Index">
38 <link href="#SEC_Contents" rel="contents" title="Table of Contents">
39 <link href="dir.html#Top" rel="up" title="(dir)">
40 <style type="text/css">
41 <!--
42 a.summary-letter {text-decoration: none}
43 blockquote.indentedblock {margin-right: 0em}
44 blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
45 blockquote.smallquotation {font-size: smaller}
46 div.display {margin-left: 3.2em}
47 div.example {margin-left: 3.2em}
48 div.lisp {margin-left: 3.2em}
49 div.smalldisplay {margin-left: 3.2em}
50 div.smallexample {margin-left: 3.2em}
51 div.smalllisp {margin-left: 3.2em}
52 kbd {font-style: oblique}
53 pre.display {font-family: inherit}
54 pre.format {font-family: inherit}
55 pre.menu-comment {font-family: serif}
56 pre.menu-preformatted {font-family: serif}
57 pre.smalldisplay {font-family: inherit; font-size: smaller}
58 pre.smallexample {font-size: smaller}
59 pre.smallformat {font-family: inherit; font-size: smaller}
60 pre.smalllisp {font-size: smaller}
61 span.nolinebreak {white-space: nowrap}
62 span.roman {font-family: initial; font-weight: normal}
63 span.sansserif {font-family: sans-serif; font-weight: normal}
64 ul.no-bullet {list-style: none}
65 -->
66 </style>
69 </head>
71 <body lang="en">
72 <h1 class="settitle" align="center">Qi user guide</h1>
78 <a name="SEC_Contents"></a>
79 <h2 class="contents-heading">Table of Contents</h2>
81 <div class="contents">
83 <ul class="no-bullet">
84 <li><a name="toc-Introduction-1" href="#Introduction">1 Introduction</a></li>
85 <li><a name="toc-Invoking-qi-1" href="#Invoking-qi">2 Invoking qi</a></li>
86 <li><a name="toc-The-qirc-file-1" href="#The-qirc-file">3 The qirc file</a></li>
87 <li><a name="toc-Packages-1" href="#Packages">4 Packages</a>
88 <ul class="no-bullet">
89 <li><a name="toc-Package-conflicts" href="#Package-conflicts">4.1 Package conflicts</a></li>
90 <li><a name="toc-Installing-packages" href="#Installing-packages">4.2 Installing packages</a></li>
91 <li><a name="toc-Removing-packages" href="#Removing-packages">4.3 Removing packages</a></li>
92 <li><a name="toc-Upgrading-packages" href="#Upgrading-packages">4.4 Upgrading packages</a>
93 <ul class="no-bullet">
94 <li><a name="toc-Package-blacklist" href="#Package-blacklist">4.4.1 Package blacklist</a></li>
95 </ul></li>
96 </ul></li>
97 <li><a name="toc-Recipes-1" href="#Recipes">5 Recipes</a>
98 <ul class="no-bullet">
99 <li><a name="toc-Variables" href="#Variables">5.1 Variables</a></li>
100 <li><a name="toc-Special-variables" href="#Special-variables">5.2 Special variables</a></li>
101 <li><a name="toc-Writing-recipes" href="#Writing-recipes">5.3 Writing recipes</a></li>
102 <li><a name="toc-Building-packages" href="#Building-packages">5.4 Building packages</a></li>
103 <li><a name="toc-Variables-from-the-environment" href="#Variables-from-the-environment">5.5 Variables from the environment</a></li>
104 <li><a name="toc-The-meta-file" href="#The-meta-file">5.6 The meta file</a></li>
105 </ul></li>
106 <li><a name="toc-Order-files-1" href="#Order-files">6 Order files</a></li>
107 <li><a name="toc-Creating-packages-1" href="#Creating-packages">7 Creating packages</a></li>
108 <li><a name="toc-Examining-packages-1" href="#Examining-packages">8 Examining packages</a></li>
109 <li><a name="toc-Exit-status-1" href="#Exit-status">9 Exit status</a></li>
110 <li><a name="toc-Index-1" href="#Index">Index</a></li>
111 </ul>
112 </div>
115 <a name="Top"></a>
116 <div class="header">
118 Next: <a href="#Introduction" accesskey="n" rel="next">Introduction</a>, Up: <a href="dir.html#Top" accesskey="u" rel="up">(dir)</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Index" title="Index" rel="index">Index</a>]</p>
119 </div>
120 <a name="SEC_Top"></a>
122 <p>This user guide is for Qi (version 1.1,
123 19 May 2019).
124 </p>
125 <table class="menu" border="0" cellspacing="0">
126 <tr><td align="left" valign="top">&bull; <a href="#Introduction" accesskey="1">Introduction</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Description and features of qi
127 </td></tr>
128 <tr><td align="left" valign="top">&bull; <a href="#Invoking-qi" accesskey="2">Invoking qi</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Command-line options
129 </td></tr>
130 <tr><td align="left" valign="top">&bull; <a href="#The-qirc-file" accesskey="3">The qirc file</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Configuration file
131 </td></tr>
132 <tr><td align="left" valign="top">&bull; <a href="#Packages" accesskey="4">Packages</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Managing packages
133 </td></tr>
134 <tr><td align="left" valign="top">&bull; <a href="#Recipes" accesskey="5">Recipes</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Building packages
135 </td></tr>
136 <tr><td align="left" valign="top">&bull; <a href="#Order-files" accesskey="6">Order files</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Handling build order
137 </td></tr>
138 <tr><td align="left" valign="top">&bull; <a href="#Creating-packages" accesskey="7">Creating packages</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Making Qi packages
139 </td></tr>
140 <tr><td align="left" valign="top">&bull; <a href="#Examining-packages" accesskey="8">Examining packages</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Debugging purposes
141 </td></tr>
142 <tr><td align="left" valign="top">&bull; <a href="#Exit-status" accesskey="9">Exit status</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Exit codes
143 </td></tr>
144 <tr><td align="left" valign="top">&bull; <a href="#Index">Index</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
145 </td></tr>
146 </table>
148 <br>
149 <p>Copyright (C) 2019 Matias Fonzo.
150 </p>
151 <p>Qi&rsquo;s home page can be found at <a href="http://www.dragora.org">http://www.dragora.org</a>.
152 Send&nbsp;bug&nbsp;reports&nbsp;or&nbsp;suggestions&nbsp;to&nbsp;<a href="mailto:dragora-users@nongnu.org"><span class="nolinebreak">dragora-users</span>@nongnu.org</a>.<!-- /@w -->
153 </p>
154 <hr>
155 <a name="Introduction"></a>
156 <div class="header">
158 Next: <a href="#Invoking-qi" accesskey="n" rel="next">Invoking qi</a>, Previous: <a href="#Top" accesskey="p" rel="prev">Top</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Index" title="Index" rel="index">Index</a>]</p>
159 </div>
160 <a name="Introduction-1"></a>
161 <h2 class="chapter">1 Introduction</h2>
162 <a name="index-introduction"></a>
164 <p>Qi is a simple but well-integrated package manager. It can create,
165 install, remove, and upgrade software packages. Qi produces binary
166 packages using recipes, which are files containing specific instructions
167 to build each package from source. Qi can manage multiple packages
168 under a single directory hierarchy. This method allows to maintain a set
169 of packages and multiple versions of them. This means that Qi could be
170 used as the main package manager or complement the existing one.
171 </p>
172 <p>Qi offers a friendly command line interface, a global configuration
173 file, a simple recipe layout to deploy software packages; also works
174 with binary packages in parallel, speeding up installations and packages
175 in production. The format used for packages is a simplified but safe
176 POSIX pax archive compressed with lzip.
177 </p>
178 <p>Qi is a modern (POSIX-compliant) shell script released under the
179 terms of the GNU General Public License. There are only two major
180 dependencies for the magic: graft(1) and tarlz(1), the rest is expected
181 to be found in any Unix-like system.
182 </p>
183 <hr>
184 <a name="Invoking-qi"></a>
185 <div class="header">
187 Next: <a href="#The-qirc-file" accesskey="n" rel="next">The qirc file</a>, Previous: <a href="#Introduction" accesskey="p" rel="prev">Introduction</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Index" title="Index" rel="index">Index</a>]</p>
188 </div>
189 <a name="Invoking-qi-1"></a>
190 <h2 class="chapter">2 Invoking qi</h2>
191 <a name="index-invocation"></a>
193 <p>This chapter describes the synopsis and command line options for
194 invoke Qi.
195 </p>
196 <div class="example">
197 <pre class="example">Usage: qi [<var>OPTION</var>]... [<var>FILE</var>]...
198 </pre></div>
200 <p>One mandatory option specifies the operation that &lsquo;<samp>qi</samp>&rsquo; should
201 perform, other options are meant to detail how this operation should be
202 performed.
203 </p>
204 <p>qi supports the following options to operate:
205 </p>
206 <dl compact="compact">
207 <dt><code>-b</code></dt>
208 <dd><p>Build package using recipe names.
209 </p>
210 </dd>
211 <dt><code>-c</code></dt>
212 <dd><p>Create .tlz package from directory.
213 </p>
214 </dd>
215 <dt><code>-d</code></dt>
216 <dd><p>Delete packages.
217 </p>
218 </dd>
219 <dt><code>-i</code></dt>
220 <dd><p>Install packages.
221 </p>
222 </dd>
223 <dt><code>-o</code></dt>
224 <dd><p>Resolve build order through .order files.
225 </p>
226 </dd>
227 <dt><code>-u</code></dt>
228 <dd><p>Update packages (implies -i, -d and -p options).
229 </p>
230 </dd>
231 <dt><code>-w</code></dt>
232 <dd><p>Warn about files that will be linked.
233 </p>
234 </dd>
235 <dt><code>-x</code></dt>
236 <dd><p>Extract a package for debugging purposes.
237 </p></dd>
238 </dl>
240 <p>There are common options between modes:
241 </p>
242 <dl compact="compact">
243 <dt><code>-N</code></dt>
244 <dd><p>Do not read the configuration file.
245 </p>
246 <p>This will ignore any value in the qirc file.
247 </p>
248 </dd>
249 <dt><code>-P &lt;DIR&gt;</code></dt>
250 <dd><p>Package directory for installations.
251 </p>
252 <p>This option sets &lsquo;<samp>${packagedir}</samp>&rsquo;.
253 </p>
254 <p>Only valid for -i, -d, or -u options.
255 </p>
256 </dd>
257 <dt><code>-f</code></dt>
258 <dd><p>Force option.
259 </p>
260 <p>This option can force the build of a recipe, or force the update of a
261 pre-existing package.
262 </p>
263 <p>Only valid for -b, -u options.
264 </p>
265 </dd>
266 <dt><code>-t &lt;DIR&gt;</code></dt>
267 <dd><p>Target directory for symbolic links.
268 </p>
269 <p>This option sets &lsquo;<samp>${targetdir}</samp>&rsquo;.
270 </p>
271 <p>Only valid for -i, -d, or -u options.
272 </p>
273 </dd>
274 <dt><code>-k</code></dt>
275 <dd><p>Keep (don&rsquo;t delete) &lsquo;<samp>${srcdir}</samp>&rsquo; or &lsquo;<samp>${destdir}</samp>&rsquo; in build
276 mode, keep (don&rsquo;t delete) package directory in delete mode.
277 </p>
278 <p>Only valid for -b, -d or -u options.
279 </p>
280 </dd>
281 <dt><code>-p</code></dt>
282 <dd><p>Prune conflicts on package installations.
283 </p>
284 <p>This option may proceed with the package installation if one or more
285 conflicts occur.
286 </p>
287 </dd>
288 <dt><code>-r /rootdir</code></dt>
289 <dd><p>Use the fully qualified named directory as the root directory for all qi
290 operations. The target directory and package directory will be relative
291 to the specified directory, including the log file for graft.
292 </p>
293 </dd>
294 <dt><code>-v</code></dt>
295 <dd><p>Be verbose (a 2nd -v gives more).
296 </p></dd>
297 </dl>
299 <p>Options for build mode (-b):
300 </p>
301 <dl compact="compact">
302 <dt><code>-O &lt;DIR&gt;</code></dt>
303 <dd><p>Where the packages produced are written.
304 </p>
305 <p>This option sets &lsquo;<samp>${outdir}</samp>&rsquo;.
306 </p>
307 </dd>
308 <dt><code>-W &lt;DIR&gt;</code></dt>
309 <dd><p>Where archives, patches, and recipes are expected.
310 </p>
311 <p>This option sets &lsquo;<samp>${worktree}</samp>&rsquo;.
312 </p>
313 </dd>
314 <dt><code>-Z &lt;DIR&gt;</code></dt>
315 <dd><p>Where (compressed) sources will be found.
316 </p>
317 <p>This option sets &lsquo;<samp>${tardir}</samp>&rsquo;.
318 </p>
319 </dd>
320 <dt><code>-a</code></dt>
321 <dd><p>Architecture to use.
322 </p>
323 <p>Default value is obtained via uname(1) as &lsquo;<samp>uname -m</samp>&rsquo;.
324 </p>
325 </dd>
326 <dt><code>-j</code></dt>
327 <dd><p>Parallel jobs for the compiler.
328 </p>
329 <p>If not specified, default sets to 1.
330 </p>
331 </dd>
332 <dt><code>-1</code></dt>
333 <dd><p>Increment release number (&lsquo;<samp>${release}</samp>&rsquo; + 1).
334 </p>
335 <p>It will be omitted if the -n option is being used.
336 </p>
337 </dd>
338 <dt><code>-n</code></dt>
339 <dd><p>Don&rsquo;t create a .tlz package.
340 </p>
341 </dd>
342 <dt><code>-S</code></dt>
343 <dd><p>Selects the option to skip completed recipes.
344 </p>
345 <p>This means, in interactive mode, when the dialog
346 to summarize recipes is shown.
347 </p></dd>
348 </dl>
350 <p>Informative options:
351 </p>
352 <dl compact="compact">
353 <dt><code>-L</code></dt>
354 <dd><p>Print default directory locations.
355 </p>
356 <p>This will print the target directory, package directory, working tree,
357 the directory for tarballs, and the output directory for the packages
358 produced.
359 </p>
360 </dd>
361 <dt><code>-h</code></dt>
362 <dd><p>Display the help describing the options and then exit.
363 </p>
364 </dd>
365 <dt><code>-V</code></dt>
366 <dd><p>Print the version number and license information.
367 The version number should be included in all bug reports.
368 </p></dd>
369 </dl>
371 <p>Expected non-option arguments are package directories and regular files:
372 recipes or files ending in .tlz, .order. When FILE is -, qi can read from
373 the standard input. See examples in <a href="#Packages">Packages</a>.
374 </p>
376 <hr>
377 <a name="The-qirc-file"></a>
378 <div class="header">
380 Next: <a href="#Packages" accesskey="n" rel="next">Packages</a>, Previous: <a href="#Invoking-qi" accesskey="p" rel="prev">Invoking qi</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Index" title="Index" rel="index">Index</a>]</p>
381 </div>
382 <a name="The-qirc-file-1"></a>
383 <h2 class="chapter">3 The qirc file</h2>
384 <a name="index-configuration-file"></a>
386 <p>The global <samp>qirc</samp> file offers a way to define variables and tools
387 (such as a download manager) for default use. This file is used by qi
388 at runtime, e.g., to build, install, remove or upgrade packages.
389 </p>
390 <p>It has the following rules:
391 </p>
392 <ul>
393 <li> Variables must be declared as &lsquo;<samp>name=value</samp>&rsquo;.
395 </li><li> Declaration of values should only take one line, no line break.
397 </li><li> For security reasons, assignments like &lsquo;<samp>name=$var</samp>&rsquo; are only
398 interpreted as literal.
399 </li></ul>
401 <p>The command line options related to the package directory and target
402 directory plus some of the options used for the build mode can override
403 some values in <samp>qirc</samp>. See <a href="#Invoking-qi">Invoking qi</a>.
404 </p>
405 <p>The order in which qi looks for this file is:
406 </p>
407 <ol>
408 <li> <code>${HOME}/.qirc</code>
409 Effective user.
411 </li><li> &lsquo;<samp>${sysconfdir}/qirc</samp>&rsquo;
412 System-wide.
413 </li></ol>
415 <p>If you intend to run qi as effective user, the file
416 &lsquo;<samp>${sysconfdir}/qirc</samp>&rsquo; could be copied to <code>${HOME}/.qirc</code>
417 setting the paths for &lsquo;<samp>${packagedir}</samp>&rsquo; and &lsquo;<samp>${targetdir}</samp>&rsquo;
418 according to the <code>$HOME</code>.
419 </p>
421 <hr>
422 <a name="Packages"></a>
423 <div class="header">
425 Next: <a href="#Recipes" accesskey="n" rel="next">Recipes</a>, Previous: <a href="#The-qirc-file" accesskey="p" rel="prev">The qirc file</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Index" title="Index" rel="index">Index</a>]</p>
426 </div>
427 <a name="Packages-1"></a>
428 <h2 class="chapter">4 Packages</h2>
429 <a name="index-managing-packages"></a>
431 <p>A package is a suite of programs usually distributed in binary form
432 which may also contain manual pages, documentation, or any other file
433 associated to a specific software.
434 </p>
435 <p>The package format used by qi is a simplified POSIX pax archive
436 compressed with lzip. The file extension for packages is &lsquo;<samp>.tlz</samp>&rsquo;.
437 </p>
438 <p>Both package installation and package de-installation are managed using
439 two important (internal) variables: &lsquo;<samp>${packagedir}</samp>&rsquo; and
440 &lsquo;<samp>${targetdir}</samp>&rsquo;, these values can be changed in the
441 configuration file or via options.
442 </p>
443 <p>&lsquo;<samp>${packagedir}</samp>&rsquo; is a common directory tree where the package
444 contents will be decompressed (will reside).
445 </p>
446 <p>&lsquo;<samp>${targetdir}</samp>&rsquo; is a target directory where the links will be
447 made by graft(1) taking &lsquo;<samp>${packagedir}/package_name</samp>&rsquo; into account.
448 </p>
449 <p>Packages are installed in self-contained directory trees and symbolic
450 links from a common area are made to the package files. This allows
451 multiple versions of the same package to coexist on the same system.
452 </p>
453 <a name="Package-conflicts"></a>
454 <h3 class="section">4.1 Package conflicts</h3>
455 <a name="index-package-conflicts"></a>
457 <p>All the links to install or remove a package are handled by graft(1).
458 Since multiple packages can be installed or removed at the same time,
459 certain conflicts may arise between the packages.
460 </p>
461 <p>graft<a name="DOCF1" href="#FOOT1"><sup>1</sup></a>
462 defines a CONFLICT as one of the following conditions:
463 </p>
464 <ul>
465 <li> If the package object is a directory and the target object exists but is
466 not a directory.
468 </li><li> If the package object is not a directory and the target object exists
469 and is not a symbolic link.
471 </li><li> If the package object is not a directory and the target object exists
472 and is a symbolic link to something other than the package object.
473 </li></ul>
475 <p>The default behavior of qi for an incoming package is to ABORT if a
476 conflict arises. When a package is going to be deleted, qi tells to
477 graft(1) to remove those parts that are not in conflict, leaving the
478 links to the belonging package. This behavior can be forced if the
479 -p option is given.
480 </p>
481 <a name="Installing-packages"></a>
482 <h3 class="section">4.2 Installing packages</h3>
483 <a name="index-package-installation"></a>
485 <p>To install a single package, simply type:
486 </p>
487 <div class="example">
488 <pre class="example">qi -i coreutils-8.30-i586+1.tlz
489 </pre></div>
491 <p>To install multiple packages at once, type:
492 </p>
493 <div class="example">
494 <pre class="example">qi -i gcc-8.3.0-i586+1.tlz rafaela-2.2-i586+1.tlz ...
495 </pre></div>
497 <p>Warn about the files that will be linked:
498 </p>
499 <div class="example">
500 <pre class="example">qi -w bash-5.0-i586+1.tlz
501 </pre></div>
503 <p>This is to verify the content of a package before installing it.
504 </p>
505 <p>See the process of an installation (very verbose):
506 </p>
507 <div class="example">
508 <pre class="example">qi -i -v mariana-3.0-i586+1.tlz
509 </pre></div>
511 <p>A second -v gives more.
512 </p>
513 <p>Installing package in a different location:
514 </p>
515 <div class="example">
516 <pre class="example">qi -r /media/floppy -i lzip-1.21-i586+1.tlz
517 </pre></div>
519 <p>The -r option assumes &lsquo;<samp>${targetdir}</samp>&rsquo; and &lsquo;<samp>${packagedir}</samp>&rsquo;.
520 See:
521 </p>
522 <div class="example">
523 <pre class="example">qi -r /home/selk -P /pkgs -t / -i lzip-1.21-i586+1.tlz
524 </pre></div>
526 <p>In this case the content of &quot;lzip-1.21-i586+1.tlz&quot; will be decompressed
527 into &lsquo;<samp>/home/selk/pkgs/lzip-1.21-i586+1</samp>&rsquo;. Assuming that the main
528 binary for lzip is under &lsquo;<samp>/home/selk/pkgs/lzip-1.21-i586+1/usr/bin/</samp>&rsquo;
529 the target for &quot;usr/bin&quot; will be created at &lsquo;<samp>/home/selk</samp>&rsquo;. Considering
530 that you have exported the <code>PATH</code> as &lsquo;<samp>${HOME}/usr/bin</samp>&rsquo;, now the
531 system is able to see the recent lzip.
532 </p>
533 <p>Installing from a list of packages using standard input:
534 </p>
535 <div class="example">
536 <pre class="example">cat FILELIST.txt | qi -i -
537 </pre></div>
539 <p>The list of packages must contain full path names to be passed in the
540 installation, e.g.:
541 /var/cache/qi/packages/x86_64/devel/tcl-8.6.9-x86_64+1.tlz
542 /var/cache/qi/packages/x86_64/devel/tk-8.6.9.1-x86_64+1.tlz
543 /var/cache/qi/packages/x86_64/devel/vala-0.42.3-x86_64+1.tlz
544 </p>
545 <a name="Removing-packages"></a>
546 <h3 class="section">4.3 Removing packages</h3>
547 <a name="index-package-de_002dinstallation"></a>
549 <p>To remove a package, simply type:
550 </p>
551 <div class="example">
552 <pre class="example">qi -d xz-5.2.4-i586+1.tlz
553 </pre></div>
555 <p>Delete mode will match the package name using &lsquo;<samp>${packagedir}</samp>&rsquo; as
556 prefix. For example, if the value of &lsquo;<samp>${packagedir}</samp>&rsquo; is set to
557 /usr/local/pkgs, this will be equal to:
558 </p>
559 <div class="example">
560 <pre class="example">qi -d /usr/local/pkgs/xz-5.2.4-i586+1
561 </pre></div>
563 <p>Detailed output (very verbose):
564 </p>
565 <div class="example">
566 <pre class="example">qi -d -v /usr/local/pkgs/xz-5.2.4-i586+1
567 </pre></div>
569 <p>A second -v gives more.
570 </p>
571 <p>By default the delete mode does not preserve a package directory after
572 removing its links from &lsquo;<samp>${targetdir}</samp>&rsquo;, but this behavior can be
573 changed if the -k option is passed:
574 </p>
575 <div class="example">
576 <pre class="example">qi -d -k /usr/local/pkgs/lzip-1.21-i586+1
577 </pre></div>
579 <p>This means that the links to the package can be reactivated, later:
580 </p>
581 <div class="example">
582 <pre class="example">cd /usr/local/pkgs &amp;&amp; graft -i lzip-1.21-i586+1
583 </pre></div>
585 <p>Removing package from a different location:
586 </p>
587 <div class="example">
588 <pre class="example">qi -r /home/cthulhu -P /pkgs -t / -d xz-5.2.4-i586+1
589 </pre></div>
591 <p>Removing a package using standard input:
592 </p>
593 <div class="example">
594 <pre class="example">echo &quot;vala-0.42.3-x86_64+1&quot; | qi -d -
595 </pre></div>
597 <p>This will match with the package directory.
598 </p>
599 <a name="Upgrading-packages"></a>
600 <h3 class="section">4.4 Upgrading packages</h3>
601 <a name="index-package-upgrade"></a>
603 <p>The upgrade mode inherits the properties of the installation and removal
604 process. To make sure that a package is updated, the package is installed
605 in a temporary directory taking &lsquo;<samp>${packagedir}</samp>&rsquo; into account. Once
606 the incoming package is pre-installed, qi can proceed to search and delete
607 packages that have the same name (considered as previous ones). Finally,
608 the package is re-installed at its final location and the temporary
609 directory is removed.
610 </p>
611 <p>To upgrade a package, just type:
612 </p>
613 <div class="example">
614 <pre class="example">qi -u gcc-9.0.1-i586+1.tlz
615 </pre></div>
617 <p>This will proceed to update &quot;gcc-9.0.1-i586+1&quot; removing other versions
618 of &quot;gcc&quot; (if any).
619 </p>
620 <p>If you want to keep the package directories of versions found during the
621 upgrade process, just pass:
622 </p>
623 <div class="example">
624 <pre class="example">qi -u -k gcc-9.0.1-i586+1.tlz
625 </pre></div>
627 <p>To see the upgrade process (very verbose):
628 </p>
629 <div class="example">
630 <pre class="example">qi -u -v gcc-9.0.1-i586+1.tlz
631 </pre></div>
633 <p>A second -v gives more.
634 </p>
635 <p>To force the upgrade of an existing package:
636 </p>
637 <div class="example">
638 <pre class="example">qi -u -f gcc-9.0.1-i586+1.tlz
639 </pre></div>
641 <a name="Package-blacklist"></a>
642 <h4 class="subsection">4.4.1 Package blacklist</h4>
643 <a name="index-package-blacklist"></a>
645 <p>To implement general package facilities, either to install, remove or
646 maintain the hierarchy of packages in a clean manner, qi makes use of the
647 pruning operation via graft(1):
648 </p>
649 <p>There is a risk if those are crucial packages for the proper functioning
650 of the system, because it implies the deactivation of symbolic from the
651 target directory, <em>especially</em> when transitioning an incoming package
652 into its final location during upgrade.
653 </p>
654 <p>A blacklist of package names has been devised for the case where
655 a user decides to upgrade all packages in the system, or
656 just the crucial ones, such as the C library.
657 </p>
658 <p>The blacklist is related to the upgrade mode only, consists in installing
659 a package instead of updating it or removing previous versions of it;
660 the content of the package will be updated over the existing content at
661 &lsquo;<samp>${packagedir}</samp>&rsquo;, while the existing links from
662 &lsquo;<samp>${targetdir}</samp>&rsquo; will be preserved. A pruning of links will be
663 carried out in order to re-link possible differences with the recent
664 content, this helps to avoid leaving dead links in the target directory.
665 </p>
666 <p>Since the upgrade mode is also used to install a new package, the mechanism
667 for blacklist is to install a declared package if it does not already
668 exist. If it already exists, it is verified that the binary package is
669 newer than the package directory in order to perform an update.
670 </p>
671 <p>Package names for the blacklist can be set from the configuration file.
672 </p>
674 <hr>
675 <a name="Recipes"></a>
676 <div class="header">
678 Next: <a href="#Order-files" accesskey="n" rel="next">Order files</a>, Previous: <a href="#Packages" accesskey="p" rel="prev">Packages</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Index" title="Index" rel="index">Index</a>]</p>
679 </div>
680 <a name="Recipes-1"></a>
681 <h2 class="chapter">5 Recipes</h2>
682 <a name="index-recipes"></a>
684 <p>A recipe is a file telling qi what to do. Most often, the recipe tells
685 qi how to build a binary package from a source tarball.
686 </p>
687 <p>A recipe has two parts: a list of variable definitions and a list of
688 sections. By convention, the syntax of a section is:
689 </p>
690 <div class="example">
691 <pre class="example">section_name()
693 section lines
695 </pre></div>
697 <p>The section name is followed by parentheses, one newline and an opening
698 brace. The line finishing the section contains just a closing brace.
699 The section names or the function names currently recognized are
700 &lsquo;<samp>build</samp>&rsquo;.
701 </p>
702 <p>The &lsquo;<samp>build</samp>&rsquo; section is an augmented shell script. This is the main
703 section (or <strong>shell function</strong>) which contains the instructions to
704 build and produce a package.
705 </p>
706 <a name="Variables"></a>
707 <h3 class="section">5.1 Variables</h3>
708 <a name="index-variables"></a>
710 <p>A &quot;variable&quot; is a <strong>shell variable</strong> defined either in <samp>qirc</samp>
711 or in a recipe to represent a string of text, called the variable&rsquo;s
712 &quot;value&quot;. These values are substituted by explicit request in the
713 definitions of other variables or in calls to external commands.
714 </p>
715 <p>Variables can represent lists of file names, options to pass to
716 compilers, programs to run, directories to look in for source files,
717 directories to write output to, or anything else you can imagine.
718 </p>
719 <p>Definitions of variables in qi have four levels of precedence.
720 Options which define variables from the command-line override those
721 specified in the <samp>qirc</samp> file, while variables defined in the recipe
722 override those specified in <samp>qirc</samp>, taking priority over those
723 variables set by command-line options. Finally, the variables have
724 default values if they are not defined anywhere.
725 </p>
726 <p>Options that set variables through the command-line can only reference
727 variables defined in <samp>qirc</samp> and variables with default values.
728 </p>
729 <p>Definitions of variables in <samp>qirc</samp> can only reference variables
730 previously defined in <samp>qirc</samp> and variables with default values.
731 </p>
732 <p>Definitions of variables in the recipe can only reference variables
733 set by the command-line, variables previously defined in the recipe,
734 variables defined in <samp>qirc</samp>, and variables with default values.
735 </p>
736 <a name="Special-variables"></a>
737 <h3 class="section">5.2 Special variables</h3>
738 <a name="index-special-variables"></a>
740 <p>There are variables which can only be set using the command line options or
741 via <samp>qirc</samp>, there are other special variables which can be defined or
742 redefined in a recipe. See the following definitions:
743 </p>
744 <p>&lsquo;<samp>outdir</samp>&rsquo; is the directory where the packages produced are written.
745 This variable can not be redefined in the recipe. Default sets to
746 &lsquo;<samp>/var/cache/qi/packages</samp>&rsquo;.
747 </p>
748 <p>&lsquo;<samp>worktree</samp>&rsquo; is the working tree where archives, patches, and recipes
749 are expected. This variable can not be redefined in the recipe. Default
750 sets to &lsquo;<samp>/usr/src/qi</samp>&rsquo;.
751 </p>
752 <p>&lsquo;<samp>tardir</samp>&rsquo; is defined in the recipe to the directory where the tarball
753 containing the source can be found. The full name of the tarball is
754 composed as &lsquo;<samp>${tardir}/$tarname</samp>&rsquo;. Its value is available in the
755 recipe as &lsquo;<samp>${tardir}</samp>&rsquo;; a value of . for &lsquo;<samp>tardir</samp>&rsquo; sets it to
756 the value of CWD (Current Working Directory), this is where the recipe
757 lives.
758 </p>
759 <p>&lsquo;<samp>arch</samp>&rsquo; is the architecture to compose the package name. Its value is
760 available in the recipe as &lsquo;<samp>${arch}</samp>&rsquo;. Default value is the output
761 of &lsquo;<samp>uname -m</samp>&rsquo;.
762 </p>
763 <p>&lsquo;<samp>jobs</samp>&rsquo; is the number of parallel jobs to pass to the compiler. Its
764 value is available in the recipe as &lsquo;<samp>${jobs}</samp>&rsquo;. The default value
765 is 1.
766 </p>
767 <p>The two variables &lsquo;<samp>${srcdir}</samp>&rsquo; and &lsquo;<samp>${destdir}</samp>&rsquo; can be
768 set in the recipe, as any other variable, but if they are not, qi uses
769 default values for them when building a package.
770 </p>
771 <p>&lsquo;<samp>srcdir</samp>&rsquo; contains the source code to be compiled, and defaults to
772 &lsquo;<samp>${program}-${version}</samp>&rsquo;. &lsquo;<samp>destdir</samp>&rsquo; is the place where the
773 built package will be installed, and defaults to
774 &lsquo;<samp>${TMPDIR}/package-${program}</samp>&rsquo;.
775 </p>
776 <p>If &lsquo;<samp>pkgname</samp>&rsquo; is left undefined, the special variable &lsquo;<samp>program</samp>&rsquo;
777 is assigned by default. If &lsquo;<samp>pkgversion</samp>&rsquo; is left undefined, the
778 special variable &lsquo;<samp>version</samp>&rsquo; is assigned by default.
779 </p>
780 <p>&lsquo;<samp>pkgname</samp>&rsquo; and &lsquo;<samp>pkgversion</samp>&rsquo; along with: &lsquo;<samp>version</samp>&rsquo;, &lsquo;<samp>arch</samp>&rsquo;,
781 and &lsquo;<samp>release</samp>&rsquo; are used to produce the name of the package in the form:
782 &lsquo;<samp>${pkgname}-${pkgversion}-${arch}+${release}.tlz</samp>&rsquo;
783 </p>
784 <p>A special variable called &lsquo;<samp>replace</samp>&rsquo; can be used to declare package
785 names that will be replaced at the time of installation.
786 </p>
787 <p>A typical recipe contains the following variables:
788 </p>
789 <ul>
790 <li> &lsquo;<samp>program</samp>&rsquo;: software name.
792 <p>It matches the source name. It is also used to compose the name of the
793 package if &lsquo;<samp>${pkgname}</samp>&rsquo; is not specified.
794 </p>
795 </li><li> &lsquo;<samp>version</samp>&rsquo;: software version.
797 <p>It matches the source name. It is also used to compose the version of the
798 package if &lsquo;<samp>${pkgversion}</samp>&rsquo; is not specified.
799 </p>
800 </li><li> &lsquo;<samp>arch</samp>&rsquo;: software architecture.
802 <p>It is used to compose the architecture of the package in which it is
803 build.
804 </p>
805 </li><li> &lsquo;<samp>release</samp>&rsquo;: release number.
807 <p>This is used to reflect the release number of the package. It is
808 recommended to increase this number after any significant change in
809 the recipe or post-install script.
810 </p></li></ul>
812 <p>Obtaining sources over the network must be declared in the recipe using
813 the &lsquo;<samp>fetch</samp>&rsquo; variable. Use double quotes for separated values.
814 </p>
815 <p>The variables &lsquo;<samp>netget</samp>&rsquo; and &lsquo;<samp>rsync</samp>&rsquo; can be defined in <samp>qirc</samp>
816 to establish a network downloader in order to get the sources. If they
817 are not defined, qi uses default values:
818 </p>
819 <p>&lsquo;<samp>netget</samp>&rsquo; is the general network downloader tool, defaults sets to
820 &lsquo;<samp>wget -c -w1 -t3 --no-check-certificate</samp>&rsquo;.
821 </p>
822 <p>&lsquo;<samp>rsync</samp>&rsquo; is the network tool for sources containing the prefix for
823 the RSYNC protocol, default sets to
824 &lsquo;<samp>rsync -v -a -L -z -i --progress</samp>&rsquo;.
825 </p>
826 <p>The variable &lsquo;<samp>description</samp>&rsquo; is used to print the package description
827 when a package is installed.
828 </p>
829 <p>A description has two parts: a brief description, and a long description.
830 By convention, the syntax of &lsquo;<samp>description</samp>&rsquo; is:
831 </p>
832 <div class="example">
833 <pre class="example">description=&quot;
834 Brief description.
836 Long description.
837 &quot;
838 </pre></div>
840 <p>The first line of the value represented is a brief description of the
841 software (called &quot;blurb&quot;). A blank line separates the <em>brief
842 description</em> from the <em>long description</em>, which should contain a more
843 descriptive description of the software.
844 </p>
845 <p>An example looks like:
846 </p>
847 <div class="example">
848 <pre class="example">description=&quot;
849 The GNU core utilities.
851 The GNU core utilities are the basic file, shell and text manipulation
852 utilities of the GNU operating system. These are the core utilities
853 which are expected to exist on every operating system.
854 &quot;
855 </pre></div>
857 <p>Please consider a length limit of 78 characters as maximum, because the same
858 one would be used on the meta file creation. See
859 <a href="#Recipes">The meta file</a> section.
860 </p>
861 <p>The &lsquo;<samp>homepage</samp>&rsquo; variable is used to declare the main site or home page:
862 </p>
863 <div class="example">
864 <pre class="example">homepage=http://www.gnu.org/software/gcc
865 </pre></div>
867 <p>The variable &lsquo;<samp>license</samp>&rsquo; is used for license information<a name="DOCF2" href="#FOOT2"><sup>2</sup></a>.
868 Some code in the program can be covered by license A, license B, or
869 license C. For &quot;separate licensing&quot; or &quot;heterogeneous licensing&quot;, we
870 suggest using <strong>|</strong> for a disjunction, <strong>&amp;</strong> for a conjunction
871 (if that ever happens in a significant way), and comma for heterogeneous
872 licensing. Comma would have lower precedence, plus added special terms.
873 </p>
874 <div class="example">
875 <pre class="example">license=&quot;LGPL, GPL | Artistic + added permission&quot;
876 </pre></div>
878 <a name="Writing-recipes"></a>
879 <h3 class="section">5.3 Writing recipes</h3>
880 <a name="index-writing-recipes"></a>
882 <p>Originally, qi was designed for the version 3 of Dragora GNU/Linux (this
883 does not mean that you can&rsquo;t use it in another distribution, just that
884 if you do you will need to test it for your selves). To aid this here
885 are some references to well written recipes:
886 </p>
887 <p><a href="http://git.savannah.nongnu.org/cgit/dragora.git/tree/recipes">http://git.savannah.nongnu.org/cgit/dragora.git/tree/recipes</a>.
888 <a href="http://notabug.org/dragora/dragora/src/master/recipes">http://notabug.org/dragora/dragora/src/master/recipes</a>.
889 </p>
890 <p>You can also check the &quot;doc&quot; directory in the distribution sources of qi
891 for some examples.
892 </p>
893 <a name="Building-packages"></a>
894 <h3 class="section">5.4 Building packages</h3>
895 <a name="index-package-build"></a>
897 <p>A recipe is any valid regular file. Qi sets priorities for reading a
898 recipe, the order in which qi looks for a recipe is:
899 </p>
900 <ol>
901 <li> Current working directory.
903 </li><li> If the specified path name does not contain &quot;recipe&quot; as the last
904 component. Qi will complete it by adding &quot;recipe&quot; to the path name.
906 </li><li> If the recipe is not in the current working directory, it will be
907 searched under &lsquo;<samp>${worktree}/recipes</samp>&rsquo;. The last component will be
908 completed adding &quot;recipe&quot; to the specified path name.
909 </li></ol>
911 <p>To build a single package, type:
912 </p>
913 <div class="example">
914 <pre class="example">qi -b x-apps/xterm
915 </pre></div>
917 <p>Multiple jobs can be passed to the compiler to speed up the build process:
918 </p>
919 <div class="example">
920 <pre class="example">qi -b -j3 x-apps/xterm
921 </pre></div>
923 <p>Update or install the package produced (if it is not already installed)
924 when finish:
925 </p>
926 <div class="example">
927 <pre class="example">qi -b -j3 -u x-apps/xterm
928 </pre></div>
930 <p>Only process a recipe but do not create the binary package:
931 </p>
932 <div class="example">
933 <pre class="example">qi -b -n dict/aspell
934 </pre></div>
936 <p>The options -i or -u have no effect when -n is given.
937 </p>
938 <p>This can be useful to inspect the build process of recipe:
939 </p>
940 <p>qi -b -k -n dict/aspell 2&gt;&amp;1 | tee aspell-buildlog.txt
941 </p>
942 <p>The -k option could preserve the source directory and the destination
943 directory for later inspection. A log file of the build process will be
944 created redirecting both, standard error and standard output to tee(1).
945 </p>
946 <a name="Variables-from-the-environment"></a>
947 <h3 class="section">5.5 Variables from the environment</h3>
948 <a name="index-environment-variables"></a>
950 <p>Qi has environment variables which can be used at build time:
951 </p>
952 <p>The variable <code>TMPDIR</code> sets the temporary directory for sources, which is
953 used for package extractions (see <a href="#Examining-packages">Examining packages</a>) and is
954 prepended to the value of &lsquo;<samp>${srcdir}</samp>&rsquo; and &lsquo;<samp>${destdir}</samp>&rsquo; in
955 build mode. By convention its default value is equal to
956 &lsquo;<samp>/usr/src/qi/build</samp>&rsquo;.
957 </p>
958 <p>The variables <code>QICFLAGS</code>, <code>QICXXFLAGS</code>, and <code>QILDFLAGS</code> have
959 no effect by default. The environment variables such as <code>CFLAGS</code>,
960 <code>CXXFLAGS</code>, and <code>LDFLAGS</code> are unset at compile time:
961 </p>
962 <p>Recommended practice is to set variables in the command line of
963 &lsquo;<samp>configure</samp>&rsquo; or <em>make(1)</em> instead of exporting to the
964 environment. As follows:
965 </p>
966 <blockquote>
967 <p>Variables not defined in a site shell script can be set in the environment
968 passed to configure. However, some packages may run configure again
969 during the build, and the customized values of these variables may be
970 lost. In order to avoid this problem, you should set them in the
971 configure command line, using &lsquo;<samp>VAR=value</samp>&rsquo;. For example:
972 </p>
973 <p><code>./configure CC=/usr/local2/bin/gcc</code>
974 </p>
975 <p><a href="http://gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.69/html_node/Defining-Variables.html">http://gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.69/html_node/Defining-Variables.html</a>
976 </p></blockquote>
978 <blockquote>
979 <p>Indeed, while configure can notice the definition of CC in
980 &lsquo;<samp>./configure CC=bizarre-cc</samp>&rsquo;, it is impossible to notice it in
981 &lsquo;<samp>CC=bizarre-cc ./configure</samp>&rsquo;, which, unfortunately, is what most
982 users do.
983 </p>
984 <p>[...]
985 </p>
986 <p>configure: error: changes in the environment can compromise the build.
987 </p>
988 <p><a href="http://gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.69/html_node/Setting-Output-Variables.html">http://gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.69/html_node/Setting-Output-Variables.html</a>
989 </p></blockquote>
991 <blockquote>
992 <p>It is not wise for makefiles to depend for their functioning on
993 environment variables set up outside their control, since this would cause
994 different users to get different results from the same makefile. This is
995 against the whole purpose of most makefiles.
996 </p>
997 <p><a href="http://gnu.org/software/make/manual/make.html#Environment">http://gnu.org/software/make/manual/make.html#Environment</a>
998 </p></blockquote>
1000 <a name="The-meta-file"></a>
1001 <h3 class="section">5.6 The meta file</h3>
1002 <a name="index-the-meta-file"></a>
1004 <p>The &quot;meta file&quot; is a regular file created during the build mode, it
1005 contains information about the package such as program name, program
1006 version, release, fetch address, description, and other minor data
1007 extracted from processed recipes. The name of the file is generated as
1008 &lsquo;<samp>${full_pkgname}.tlz.txt</samp>&rsquo;, and its purpose is to reflect essential
1009 information to the user without having to look inside the package content.
1010 </p>
1011 <p>The content of a meta file looks like:
1012 </p>
1013 <div class="example">
1014 <pre class="example">#
1015 # The Bourne Again SHell.
1017 # Bash is an sh-compatible shell that incorporates useful features from
1018 # the Korn shell (ksh) and C shell (csh). It is intended to conform to
1019 # the IEEE POSIX P1003.2/ISO 9945.2 shell and tools standard.
1021 # It offers functional improvements over sh for both programming and
1022 # interactive use.
1025 QICFLAGS=&quot;-g0 -Os -mtune=generic -pipe&quot;
1026 QICXXFLAGS=&quot;-g0 -Os -mtune=generic -pipe&quot;
1027 QILDFLAGS=&quot;-s&quot;
1028 program=bash
1029 version=5.0
1030 release=1
1031 blurb=&quot;The Bourne Again SHell.&quot;
1032 homepage=&quot;http://www.gnu.org/software/bash&quot;
1033 license=&quot;GPLv3+&quot;
1034 fetch=&quot;ftp://ftp.gnu.org/gnu/bash/bash-5.0.tar.gz&quot;
1035 replace=&quot;&quot;
1036 </pre></div>
1038 <p>Package descriptions are extracted from the variable &lsquo;<samp>description</samp>&rsquo;:
1039 each line is interpreted literally and pre-formatted to fit in (exactly)
1040 <strong>80 columns</strong>, plus the character &lsquo;<samp>#</samp>&rsquo; and a space is prefixed
1041 to every line.
1042 </p>
1043 <p>In addition to the Special variables, there are implicit variables such as
1044 &lsquo;<samp>blurb</samp>&rsquo;:
1045 </p>
1046 <p>The &lsquo;<samp>blurb</samp>&rsquo; variable is related to the special variable
1047 &lsquo;<samp>description</samp>&rsquo;. Its value is composed using the first (substantial)
1048 line of &lsquo;<samp>description</samp>&rsquo;, mentioned as the &quot;brief description&quot;.
1049 </p>
1051 <hr>
1052 <a name="Order-files"></a>
1053 <div class="header">
1055 Next: <a href="#Creating-packages" accesskey="n" rel="next">Creating packages</a>, Previous: <a href="#Recipes" accesskey="p" rel="prev">Recipes</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Index" title="Index" rel="index">Index</a>]</p>
1056 </div>
1057 <a name="Order-files-1"></a>
1058 <h2 class="chapter">6 Order files</h2>
1059 <a name="index-handling-build-order"></a>
1061 <p>The order mode has the purpose of resolving the build order through
1062 .order files. An order file contains a list of recipe names, by default
1063 does not perform any action other than to print a resolved list in
1064 descending order. For example, if <strong>a</strong> depends on <strong>b</strong> and
1065 <strong>c</strong>, and <strong>c</strong> depends on <strong>b</strong> as well, the file might
1066 look like:
1067 </p>
1068 <div class="example">
1069 <pre class="example">a: c b
1071 c: b
1072 </pre></div>
1074 <p>Each letter represents a recipe name, complete dependencies for
1075 the first recipe name are listed in descending order, which is
1076 printed from right to left, and removed from left to right:
1077 </p>
1078 <p><small>OUTPUT</small>
1079 </p>
1080 <div class="example">
1081 <pre class="example">b
1084 </pre></div>
1086 <p>Blank lines, colons and parentheses are simply ignored. Comment lines
1087 beginning with &lsquo;<samp>#</samp>&rsquo; are allowed.
1088 </p>
1089 <p>An order file could be used to build a series of packages, for example,
1090 if the content is:
1091 </p>
1092 <div class="example">
1093 <pre class="example"># Image handling libraries
1095 libs/libjpeg-turbo: devel/nasm
1096 x-libs/jasper: libs/libjpeg-turbo
1097 libs/tiff: libs/libjpeg-turbo
1098 </pre></div>
1100 <p>To proceed with each recipe, we can type:
1101 </p>
1102 <div class="example">
1103 <pre class="example">qi -o imglibs.order | qi -b -i -
1104 </pre></div>
1106 <p>The output of &lsquo;<samp>qi -o imglibs.order</samp>&rsquo; tells to qi in which order it
1107 should build the recipes:
1108 </p>
1109 <div class="example">
1110 <pre class="example">devel/nasm
1111 libs/libjpeg-turbo
1112 x-libs/jasper
1113 libs/tiff
1114 </pre></div>
1117 <hr>
1118 <a name="Creating-packages"></a>
1119 <div class="header">
1121 Next: <a href="#Examining-packages" accesskey="n" rel="next">Examining packages</a>, Previous: <a href="#Order-files" accesskey="p" rel="prev">Order files</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Index" title="Index" rel="index">Index</a>]</p>
1122 </div>
1123 <a name="Creating-packages-1"></a>
1124 <h2 class="chapter">7 Creating packages</h2>
1125 <a name="index-package-creation"></a>
1127 <p>The &quot;creation mode&quot; is an internal function of qi to make new Qi compatible
1128 compatible packages, the creation mode is selected by the -c option.
1129 A package is produced using the contents of the Current Directory, and
1130 the package file is written out.
1131 </p>
1132 <div class="example">
1133 <pre class="example">Usage: qi -c [<var>OUTPUT/packagename.tlz</var>]...
1134 </pre></div>
1136 <p>The argument for the file name to be written must contain a fully
1137 qualified named directory as the output directory where the package
1138 produced will be written. The file name should be composed using the
1139 full name: name-version-architecture+release.tlz
1140 </p>
1141 <p><small>EXAMPLE</small>
1142 </p>
1143 <div class="example">
1144 <pre class="example">cd /usr/local/pkgs
1145 cd claws-mail-3.17.1-x86_64+1
1146 qi -c /var/cache/qi/packages/x86_64/local/claws-mail-3.17.1-x86_64+1.tlz
1147 </pre></div>
1149 <p>In this case, the package &quot;claws-mail-3.17.1-x86_64+1.tlz&quot; will be written
1150 into &lsquo;<samp>/var/cache/qi/packages/x86_64/local/</samp>&rsquo;.
1151 </p>
1152 <p>All packages produced are complemented by a checksum file (.sha256).
1153 </p>
1155 <hr>
1156 <a name="Examining-packages"></a>
1157 <div class="header">
1159 Next: <a href="#Exit-status" accesskey="n" rel="next">Exit status</a>, Previous: <a href="#Creating-packages" accesskey="p" rel="prev">Creating packages</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Index" title="Index" rel="index">Index</a>]</p>
1160 </div>
1161 <a name="Examining-packages-1"></a>
1162 <h2 class="chapter">8 Examining packages</h2>
1163 <a name="index-package-examination"></a>
1165 <p>The &quot;extraction mode&quot; serves to examine binary packages for debugging
1166 purposes. The extraction mode is selected by the -x option. It
1167 decompresses a package into a single directory, verifying its integrity
1168 and preserving its properties.
1169 </p>
1170 <div class="example">
1171 <pre class="example">Usage: qi -x [<var>packagename.tlz</var>]...
1172 </pre></div>
1174 <p><small>EXAMPLE</small>
1175 </p>
1176 <div class="example">
1177 <pre class="example">qi -x mksh-R56c-x86_64+1.tlz
1178 </pre></div>
1180 <p>This action will put the content of &quot;mksh-R56c-x86_64+1.tlz&quot; into a
1181 single directory, this will be a private directory for the user who
1182 </p>
1183 <p>requested the action, creation mode will be equal to <strong>u=rwx,g=,o=
1184 (0700)</strong>. The package content will reside on this location, default
1185 mask to deploy the content will be equal to
1186 <strong>u=rwx,g=rwx,o=rwx (0000)</strong>.
1187 </p>
1188 <p>The creation of the custom directory is influenced by the value of the
1189 <code>TMPDIR</code> variable.
1190 </p>
1192 <hr>
1193 <a name="Exit-status"></a>
1194 <div class="header">
1196 Next: <a href="#Index" accesskey="n" rel="next">Index</a>, Previous: <a href="#Examining-packages" accesskey="p" rel="prev">Examining packages</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Index" title="Index" rel="index">Index</a>]</p>
1197 </div>
1198 <a name="Exit-status-1"></a>
1199 <h2 class="chapter">9 Exit status</h2>
1200 <a name="index-exit-codes"></a>
1202 <p>All the exit codes are described in this chapter.
1203 </p>
1204 <dl compact="compact">
1205 <dt>&lsquo;<samp>0</samp>&rsquo;</dt>
1206 <dd><p>Successful completion (no errors).
1207 </p>
1208 </dd>
1209 <dt>&lsquo;<samp>1</samp>&rsquo;</dt>
1210 <dd><p>Minor common errors:
1211 </p>
1212 <ul class="no-bullet">
1213 <li>- Help usage on illegal options or required arguments.
1215 </li><li>- Program needed by qi (prerequisite) is not available.
1216 </li></ul>
1218 </dd>
1219 <dt>&lsquo;<samp>2</samp>&rsquo;</dt>
1220 <dd><p>Command execution error:
1221 </p>
1222 <p>This code is used to return the evaluation of external commands and shell
1223 arguments in case of error.
1224 </p>
1225 </dd>
1226 <dt>&lsquo;<samp>3</samp>&rsquo;</dt>
1227 <dd><p>Integrity check error for compressed files.
1228 </p>
1229 <p>Compressed files means:
1230 </p>
1231 <ul class="no-bullet">
1232 <li>- Tarball files from tar(1).
1233 Supported extensions: .tar, .tar.gz, .tgz, .tar.Z, .tar.bz2, .tbz2, .tbz,
1234 .tar.xz, .txz
1236 </li><li>- Tarball files from tarlz(1).
1237 Supported extensions: .tar.lz, .tlz
1239 </li><li>- Zip files from unzip(1).
1240 Supported extensions: .zip, .ZIP
1242 </li><li>- Gzip files from gzip(1).
1243 Supported extensions: .gz, .Z
1245 </li><li>- Bzip2 files from bzip2(1).
1246 Supported extensions: .bz2
1248 </li><li>- Lzip files from lzip(1).
1249 Supported extensions: .lz
1251 </li><li>- Xz files from xz(1).
1252 Supported extensions: .xz
1253 </li></ul>
1255 </dd>
1256 <dt>&lsquo;<samp>4</samp>&rsquo;</dt>
1257 <dd><p>File empty, not regular, or expected.
1258 </p>
1259 <p>Commonly, it is expected:
1260 </p>
1261 <ul class="no-bullet">
1262 <li>- An argument for the mode of operation.
1264 </li><li>- A readable file or directory.
1266 </li><li>- A binary package (.tlz).
1268 </li><li>- A valid recipe.
1270 </li><li>- An order file (.order).
1272 </li><li>- A protocol supported by the network downloader tool.
1274 </li><li>- A checksum file (.sha256).
1275 </li></ul>
1277 </dd>
1278 <dt>&lsquo;<samp>5</samp>&rsquo;</dt>
1279 <dd><p>Empty or not defined variable:
1280 </p>
1281 <p>This code is used to report empty or undefined variables; usually,
1282 variables coming from a recipe or assigned arrays that are tested.
1283 </p>
1284 </dd>
1285 <dt>&lsquo;<samp>6</samp>&rsquo;</dt>
1286 <dd><p>Package already installed:
1287 </p>
1288 <p>The package directory for an incoming .tlz package already exists.
1289 </p>
1290 </dd>
1291 <dt>&lsquo;<samp>10</samp>&rsquo;</dt>
1292 <dd><p>Network manager error:
1293 </p>
1294 <p>This code is used if the network downloader tool fails for some reason.
1295 </p></dd>
1296 </dl>
1299 <hr>
1300 <a name="Index"></a>
1301 <div class="header">
1303 Previous: <a href="#Exit-status" accesskey="p" rel="prev">Exit status</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Index" title="Index" rel="index">Index</a>]</p>
1304 </div>
1305 <a name="Index-1"></a>
1306 <h2 class="unnumbered">Index</h2>
1308 <table><tr><th valign="top">Jump to: &nbsp; </th><td><a class="summary-letter" href="#Index_cp_letter-C"><b>C</b></a>
1309 &nbsp;
1310 <a class="summary-letter" href="#Index_cp_letter-E"><b>E</b></a>
1311 &nbsp;
1312 <a class="summary-letter" href="#Index_cp_letter-H"><b>H</b></a>
1313 &nbsp;
1314 <a class="summary-letter" href="#Index_cp_letter-I"><b>I</b></a>
1315 &nbsp;
1316 <a class="summary-letter" href="#Index_cp_letter-M"><b>M</b></a>
1317 &nbsp;
1318 <a class="summary-letter" href="#Index_cp_letter-P"><b>P</b></a>
1319 &nbsp;
1320 <a class="summary-letter" href="#Index_cp_letter-R"><b>R</b></a>
1321 &nbsp;
1322 <a class="summary-letter" href="#Index_cp_letter-S"><b>S</b></a>
1323 &nbsp;
1324 <a class="summary-letter" href="#Index_cp_letter-T"><b>T</b></a>
1325 &nbsp;
1326 <a class="summary-letter" href="#Index_cp_letter-V"><b>V</b></a>
1327 &nbsp;
1328 <a class="summary-letter" href="#Index_cp_letter-W"><b>W</b></a>
1329 &nbsp;
1330 </td></tr></table>
1331 <table class="index-cp" border="0">
1332 <tr><td></td><th align="left">Index Entry</th><td>&nbsp;</td><th align="left"> Section</th></tr>
1333 <tr><td colspan="4"> <hr></td></tr>
1334 <tr><th><a name="Index_cp_letter-C">C</a></th><td></td><td></td></tr>
1335 <tr><td></td><td valign="top"><a href="#index-configuration-file">configuration file</a>:</td><td>&nbsp;</td><td valign="top"><a href="#The-qirc-file">The qirc file</a></td></tr>
1336 <tr><td colspan="4"> <hr></td></tr>
1337 <tr><th><a name="Index_cp_letter-E">E</a></th><td></td><td></td></tr>
1338 <tr><td></td><td valign="top"><a href="#index-environment-variables">environment variables</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Recipes">Recipes</a></td></tr>
1339 <tr><td></td><td valign="top"><a href="#index-exit-codes">exit codes</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Exit-status">Exit status</a></td></tr>
1340 <tr><td colspan="4"> <hr></td></tr>
1341 <tr><th><a name="Index_cp_letter-H">H</a></th><td></td><td></td></tr>
1342 <tr><td></td><td valign="top"><a href="#index-handling-build-order">handling build order</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Order-files">Order files</a></td></tr>
1343 <tr><td colspan="4"> <hr></td></tr>
1344 <tr><th><a name="Index_cp_letter-I">I</a></th><td></td><td></td></tr>
1345 <tr><td></td><td valign="top"><a href="#index-introduction">introduction</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Introduction">Introduction</a></td></tr>
1346 <tr><td></td><td valign="top"><a href="#index-invocation">invocation</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Invoking-qi">Invoking qi</a></td></tr>
1347 <tr><td colspan="4"> <hr></td></tr>
1348 <tr><th><a name="Index_cp_letter-M">M</a></th><td></td><td></td></tr>
1349 <tr><td></td><td valign="top"><a href="#index-managing-packages">managing packages</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Packages">Packages</a></td></tr>
1350 <tr><td colspan="4"> <hr></td></tr>
1351 <tr><th><a name="Index_cp_letter-P">P</a></th><td></td><td></td></tr>
1352 <tr><td></td><td valign="top"><a href="#index-package-blacklist">package blacklist</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Packages">Packages</a></td></tr>
1353 <tr><td></td><td valign="top"><a href="#index-package-build">package build</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Recipes">Recipes</a></td></tr>
1354 <tr><td></td><td valign="top"><a href="#index-package-conflicts">package conflicts</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Packages">Packages</a></td></tr>
1355 <tr><td></td><td valign="top"><a href="#index-package-creation">package creation</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Creating-packages">Creating packages</a></td></tr>
1356 <tr><td></td><td valign="top"><a href="#index-package-de_002dinstallation">package de-installation</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Packages">Packages</a></td></tr>
1357 <tr><td></td><td valign="top"><a href="#index-package-examination">package examination</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Examining-packages">Examining packages</a></td></tr>
1358 <tr><td></td><td valign="top"><a href="#index-package-installation">package installation</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Packages">Packages</a></td></tr>
1359 <tr><td></td><td valign="top"><a href="#index-package-upgrade">package upgrade</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Packages">Packages</a></td></tr>
1360 <tr><td colspan="4"> <hr></td></tr>
1361 <tr><th><a name="Index_cp_letter-R">R</a></th><td></td><td></td></tr>
1362 <tr><td></td><td valign="top"><a href="#index-recipes">recipes</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Recipes">Recipes</a></td></tr>
1363 <tr><td colspan="4"> <hr></td></tr>
1364 <tr><th><a name="Index_cp_letter-S">S</a></th><td></td><td></td></tr>
1365 <tr><td></td><td valign="top"><a href="#index-special-variables">special variables</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Recipes">Recipes</a></td></tr>
1366 <tr><td colspan="4"> <hr></td></tr>
1367 <tr><th><a name="Index_cp_letter-T">T</a></th><td></td><td></td></tr>
1368 <tr><td></td><td valign="top"><a href="#index-the-meta-file">the meta file</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Recipes">Recipes</a></td></tr>
1369 <tr><td colspan="4"> <hr></td></tr>
1370 <tr><th><a name="Index_cp_letter-V">V</a></th><td></td><td></td></tr>
1371 <tr><td></td><td valign="top"><a href="#index-variables">variables</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Recipes">Recipes</a></td></tr>
1372 <tr><td colspan="4"> <hr></td></tr>
1373 <tr><th><a name="Index_cp_letter-W">W</a></th><td></td><td></td></tr>
1374 <tr><td></td><td valign="top"><a href="#index-writing-recipes">writing recipes</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Recipes">Recipes</a></td></tr>
1375 <tr><td colspan="4"> <hr></td></tr>
1376 </table>
1377 <table><tr><th valign="top">Jump to: &nbsp; </th><td><a class="summary-letter" href="#Index_cp_letter-C"><b>C</b></a>
1378 &nbsp;
1379 <a class="summary-letter" href="#Index_cp_letter-E"><b>E</b></a>
1380 &nbsp;
1381 <a class="summary-letter" href="#Index_cp_letter-H"><b>H</b></a>
1382 &nbsp;
1383 <a class="summary-letter" href="#Index_cp_letter-I"><b>I</b></a>
1384 &nbsp;
1385 <a class="summary-letter" href="#Index_cp_letter-M"><b>M</b></a>
1386 &nbsp;
1387 <a class="summary-letter" href="#Index_cp_letter-P"><b>P</b></a>
1388 &nbsp;
1389 <a class="summary-letter" href="#Index_cp_letter-R"><b>R</b></a>
1390 &nbsp;
1391 <a class="summary-letter" href="#Index_cp_letter-S"><b>S</b></a>
1392 &nbsp;
1393 <a class="summary-letter" href="#Index_cp_letter-T"><b>T</b></a>
1394 &nbsp;
1395 <a class="summary-letter" href="#Index_cp_letter-V"><b>V</b></a>
1396 &nbsp;
1397 <a class="summary-letter" href="#Index_cp_letter-W"><b>W</b></a>
1398 &nbsp;
1399 </td></tr></table>
1401 <div class="footnote">
1402 <hr>
1403 <h4 class="footnotes-heading">Footnotes</h4>
1405 <h3><a name="FOOT1" href="#DOCF1">(1)</a></h3>
1406 <p>The official guide for Graft can be found at
1407 <a href="http://peters.gormand.com.au/Home/tools/graft/graft.html">http://peters.gormand.com.au/Home/tools/graft/graft.html</a>.</p>
1408 <h3><a name="FOOT2" href="#DOCF2">(2)</a></h3>
1409 <p>The proposal for &lsquo;<samp>license</samp>&rsquo; was made by Richard M. Stallman at
1410 <a href="http://lists.gnu.org/archive/html/gnu-linux-libre/2016-05/msg00003.html">http://lists.gnu.org/archive/html/gnu-linux-libre/2016-05/msg00003.html</a>.</p>
1411 </div>
1412 <hr>
1416 </body>
1417 </html>
1418 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
1419 <html>
1420 <head>
1421 <title>Graft</title>
1422 </head>
1424 <body>
1426 <center>
1427 <h1><em>Graft</em> - a package management utility</h1>
1428 </center>
1430 <h4>Prepared by Peter Samuel
1431 <a href="mailto:peter.r.samuel@gmail.com"><tt>&lt;peter.r.samuel@gmail.com&gt;</tt></a></h4>
1433 <h4>$Revision: 2.16 $</h4>
1434 <h4>$Date: 2018/04/16 14:54:07 $</h4>
1436 <blockquote>
1437 <p> <em><strong>graft:</strong> To insert (a graft) in a branch or stem
1438 of another tree; to propagate by insertion in another stock; also, to
1439 insert a graft upon. To implant a portion of (living flesh or skin) in
1440 a lesion so as to form an organic union. To join (one thing) to another
1441 as if by grafting, so as to bring about a close union.</em> </p>
1442 </blockquote>
1444 <hr>
1446 <h2><a name="contents">Contents</a></h2>
1448 <ul>
1450 <li> <a href="#intro">Introduction</a>
1452 <li> <a href="#rationale">Rationale</a>
1454 <li> <a href="#research">Research</a>
1456 <li> <a href="#design">Design</a>
1458 <ul>
1459 <li> <a href="#precedence">Control file precedence &amp; conflict resolution</a>
1460 </ul>
1462 <li> <a href="#history">History</a>
1464 <li> <a href="#installation">Installation</a>
1466 <ul>
1467 <li> <a href="#rpm_and_deb">Creating RPM and DEB packages</a>
1469 <li> <a href="#gotchas">Grafting <em>Graft</em> and
1470 <em>Perl</em> - the bootstrap problem</a>
1471 </ul>
1473 <li> <a href="#using-graft">Using <em>Graft</em></a>
1475 <ul>
1477 <li> <a href="#compiling-packages">Compiling
1478 Packages</a>
1480 <li><a href="#usage"><em>Graft</em> command line
1481 options</a>
1483 <ol>
1484 <li><a href="#graft-i">Install</a>
1485 <li><a href="#graft-d">Delete</a>
1486 <li><a href="#graft-p">Prune</a>
1487 <li><a href="#graft-L">Information</a>
1488 </ol>
1490 <li> <a href="#testing">Testing the <em>Graft</em>
1491 Installation</a>
1493 <li> <a href="#installing-packages">Installing
1494 Packages</a>
1496 <li> <a href="#bypass">Bypassing package
1497 directories</a>
1499 <li> <a href="#include">Including specific files
1500 and/or directories</a>
1502 <li> <a href="#exclude">Excluding specific files
1503 and/or directories</a>
1505 <li> <a href="#config_dirs">Grafting configuration files</a>
1507 <li><a href="#partial-graft">Grafting part of a
1508 package</a>
1510 <li> <a href="#deleting-packages">Deleting and/or
1511 Upgrading Packages</a>
1513 <li><a href="#transitioning">Transitioning a package to
1514 <em>Graft</em> control</a>
1516 <li> <a href="#conflicts">Conflict Processing</a>
1518 <li> <a href="#exitstatus">Exit Status</a>
1520 </ul>
1522 <li> <a href="#other-pkg-tools">Using <em>Graft</em> with
1523 other package management tools</a>
1525 <li> <a href="#availability">Availability</a>
1527 <li> <a href="#license">License</a>
1529 </ul>
1531 <hr>
1533 <h2><a name="intro">Introduction</a></h2>
1535 <p> <em>Graft</em> provides a mechanism for managing multiple packages
1536 under a single directory hierarchy. It was inspired by both <em>Depot</em>
1537 (Carnegie Mellon University) and <em>Stow</em> (Bob Glickstein). </p>
1539 <p> For the purposes of this discussion a <em>package</em> is defined as
1540 a suite of programs and files that make up an individual product. For
1541 example, the <em>package</em> known as <em>gcc</em> consists of the compiler
1542 and preprocessor programs, include files, manual pages and any other
1543 associated file or program. The concept of a <em>package</em> should not be
1544 confused with some vendor's definitions that are - by this definition -
1545 actually collections of <em>packages</em>. </p>
1547 <p> Special thanks to Gordon Rowell, Charles Butcher, Charlie Brady,
1548 Robert Maldon and Matias A. Fonzo for design suggestions and contributions.
1549 </p>
1551 <hr>
1553 <h2><a name="rationale">Rationale</a></h2>
1555 <p> In any reasonably large environment, many software packages will be
1556 installed. The installation location for these packages usually follows
1557 one of three rationales - each with its own advantages and drawbacks: </p>
1559 <ol>
1561 <li> <p> Each package is isolated from all other packages by
1562 installing it into a self contained directory tree. All binaries,
1563 manual pages, library and configuration files are stored under
1564 a single directory tree. This directory tree contains NO other
1565 files which are not the exclusive domain of the package in
1566 question. </p>
1568 <p> This method makes package demarcation obvious. As each
1569 package is self contained, identification of any file within a
1570 package is immediately apparent. </p>
1572 <p> Multiple versions of packages can be installed fairly easily
1573 to accommodate acceptance testing of new versions and/or legacy
1574 systems. </p>
1576 <p> However, the use of individual package directories can
1577 lead to VERY long <strong>$PATH</strong> and <strong>$MANPATH</strong> environment
1578 variables. Some shells may not be able to handle such long
1579 variables. Whenever a new package is added, each user MUST
1580 update their <strong>$PATH</strong> and <strong>$MANPATH</strong> to make the package
1581 available. </p>
1583 <li> <p> Packages are installed under a common directory tree.
1584 Binaries for all packages are grouped in a single directory,
1585 manual pages for all packages in another directory and so on.
1586 </p>
1588 <p> This method eliminates the need for continually updating long
1589 <strong>$PATH</strong> variables for each user. As soon as a package is
1590 placed into the common '<tt>bin</tt>' directory it is immediately
1591 available to all users (after a shell rehash if necessary). </p>
1593 <p> However, when a package is to be updated it is often very
1594 difficult to isolate all the files related to a particular
1595 package if they are intermingled with unrelated files. </p>
1597 <li> <p> A combination of methods (1) and (2). </p>
1599 </ol>
1601 <p> In an effort to maximise the advantages and minimise the
1602 disadvantages, <em>Depot</em>, <em>Stow</em> and <em>Graft</em> adopt a similar
1603 philosophy: </p>
1605 <blockquote>
1606 <p> Packages are installed in self contained directory trees and
1607 symbolic links from a common area are made to the package files. </p>
1608 </blockquote>
1610 <p> This approach allows multiple versions of the same package to co-exist
1611 on the one system. One version is the commonly available version and
1612 symbolic links will be made to this version. New versions can be tested
1613 and once acceptable can replace the current commonly available version.
1614 Older versions can still be used for legacy systems by using the
1615 '<em>real</em>' path name to the package instead of the '<em>common</em>'
1616 path name. </p>
1618 <p> The size and complexity of environment variables such as <strong>$PATH</strong>
1619 and <strong>$MANPATH</strong> is minimised because only the common area is
1620 required. Any special cases can also be accommodated but these will
1621 usually be in the minority when compared with the number of commonly
1622 available packages. </p>
1624 <hr>
1626 <h2><a name="research">Research</a></h2>
1628 <p> <strong>Note:</strong> Development of <em>Graft</em> began in late 1996. The
1629 comments regarding the packages listed below reflect their functionality
1630 and behaviour at that time and may not necessarily reflect their current
1631 functionality and behaviour. </p>
1633 <p> As stated earlier, <em>Graft</em> was inspired by <em>Depot</em> and
1634 <em>Stow</em>. Both these systems were examined and finally rejected for
1635 the following reasons: </p>
1637 <dl>
1639 <dt> <em>Depot</em>
1640 <a href="ftp://ftp.andrew.cmu.edu/pub/depot/depot.tar.gz">ftp://ftp.andrew.cmu.edu/pub/depot/depot.tar.gz</a>
1642 <dd> <p> <em>Depot</em> is very flexible yet cumbersome. </p>
1644 <p> It requires a database file to be created which
1645 provides a snapshot of the current state of both the package
1646 repository and the <em>Depot</em> target. It is possible to
1647 inadvertently destroy the package repository if the database
1648 is damaged. </p>
1650 <p> <em>Depot</em> assumes &quot;<em>ownership</em>&quot; of the
1651 target area, making it almost impossible to accommodate
1652 packages that are not under the control of <em>Depot</em>.
1653 ("<em>Ownership</em>" in this case means that <em>Depot</em>
1654 assumes ALL files in the target area will be under the
1655 control of <em>Depot</em>. It does not imply that <em>Depot</em>
1656 modifies Unix file permissions). </p>
1658 <p> Because of <em>Depot</em>'s assumed <em>ownership</em> it is
1659 difficult for other packages not under the control of
1660 <em>Depot</em> to be placed in the same target area. </p>
1662 <p> <em>Depot</em> attempts to impose a fixed package repository
1663 relative to the package target. It assumes that all
1664 packages will be stored under
1665 '<tt><em>dir</em>/depot/<em>package</em></tt>' and the target
1666 will be '<tt><em>dir</em></tt>'. This can be overridden on
1667 the command line but the internals of <em>Depot</em> make
1668 this mechanism cumbersome. </p>
1670 <p> <em>Depot</em> is written in C and there are many source
1671 files in its distribution. Local modifications would be
1672 difficult to quickly implement and test. </p>
1674 <dt> <em>Stow</em>
1675 <a href="https://www.gnu.org/software/stow/">https://www.gnu.org/software/stow/</a>
1677 <dd> <p> <em>Stow</em> is a stateless system. It requires no
1678 database or configuration information. </p>
1680 <p> Like <em>Depot</em>, it assumes that the package repository
1681 will be stored under '<tt><em>dir</em>/stow/<em>package</em></tt>'
1682 and the target will be '<tt><em>dir</em></tt>'. This can be
1683 overridden on the command line and works well during the
1684 install phase. </p>
1686 <p> <em>Stow</em> assumes &quot;<em>ownership</em>&quot;
1687 of the target area, making it difficult to accommodate
1688 packages that are not under the control of <em>Stow</em>.
1689 ("<em>Ownership</em>" in this case means that <em>Stow</em>
1690 assumes ALL files in the target area will be under the
1691 control of <em>Stow</em>. It does not imply that <em>Stow</em>
1692 modifies Unix file permissions). </p>
1694 <p> Because of <em>Stow</em>'s assumed <em>ownership</em>
1695 it is difficult for other packages not under the control
1696 of <em>Stow</em> to be placed in the same target area. When
1697 deleting packages, <em>Stow</em> examines everything in the
1698 target directory - whether it is associated with the package
1699 it is trying to delete or not. This can be time consuming and
1700 potentially dangerous as empty directories are also removed
1701 - even empty directories that do not belong to the package
1702 being removed. </p>
1704 <p> <em>Stow</em> has a clever feature of <em>folding</em> and
1705 <em>unfolding</em> directories. It attempts to optimise the
1706 number of symbolic links by making links to directories if
1707 the directory is only associated with a single package. If
1708 at a later date <em>Stow</em> discovers another package that
1709 needs that directory it will <em>unfold</em> that directory
1710 into a collection of symbolic links to files rather than
1711 a single symbolic link to the directory. <em>Stow</em> will
1712 <em>fold</em> the directory when removing packages if the
1713 remainder of the directory is only concerned with a single
1714 package. While clever, this feature is probably a waste of
1715 time and effort. It means that the entire package target
1716 must be scanned to determine package ownership of links and
1717 as packages will usually be replaced by newer versions a
1718 directory <em>fold</em> will probably be short lived. </p>
1720 <p> <em>Stow</em> will sometimes miss potential conflicts when
1721 run in <em>show only</em> mode. The conflicts may occur when a
1722 directory is unfolded and will not show up in <em>show only</em>
1723 mode. </p>
1725 <p> <em>Stow</em>'s author suggests that packages be compiled
1726 such that they refer to files in the target location rather
1727 than the actual package installation directory. This approach
1728 precludes the use of multiple versions of packages with
1729 different configuration and/or library files. </p>
1731 <p> <em>Stow</em> is written in <em>Perl</em> and is only a
1732 few hundred lines of code so local modifications can be
1733 accommodated. However there are very few comments in the
1734 code which makes the process of modification difficult. </p>
1736 </dl>
1738 <p> Since the release of <em>Graft</em> 1.6, the existence of yet another
1739 packaging program has been brought to the author's attention. </p>
1741 <dl>
1743 <dt> <em>Encap</em>
1744 <a href="http://www.ks.uiuc.edu/Development/Computers/docs/sysadmin/Build/encap.html">http://www.ks.uiuc.edu/Development/Computers/docs/sysadmin/Build/encap.html</a>
1746 <dd> <p> <em>Encap</em> grew out of work begun at the University
1747 of Illinois Champaign-Urbana. It has the same underlying
1748 philosophy as <em>Depot</em>, <em>Stow</em> and <em>Graft</em> -
1749 encapsulate packages into self contained directories and use
1750 symbolic links to make them visible in a common location. </p>
1752 <p> <em>Encap</em> uses a combination of a <em>csh</em> wrapper
1753 and a <em>Perl</em> program to accomplish its work. Like both
1754 <em>Depot</em> and <em>Stow</em>, <em>Encap</em> assumes that all
1755 compiled packages will live under a single directory hierarchy
1756 - by default '<tt><em>dir</em>/encap/<em>package</em></tt>'. It
1757 then attempts to create a symbolic link tree for ALL the
1758 packages under this area. There doesn't appear to be any
1759 easy way to support the quick addition or removal of a single
1760 package. </p>
1762 <p> A new release of <em>Encap</em> incorporating many new
1763 features was expected to be available in early 1997, however
1764 no release greater than version 1.2 has been forthcoming. </p>
1766 <p> One good feature of <em>Encap</em> is the ability to exclude
1767 specific files from the package tree. This concept has been
1768 incorporated into <em>Graft</em> 1.7 and above. </p>
1770 </dl>
1772 <p> Since the release of <em>Graft</em> 2.3, the existence of
1773 several another packaging programs have been brought to the author's
1774 attention. Rather than outline their features and whether or not the
1775 author feels they are superior (or inferior) to <em>Graft</em>, a reference
1776 to each package and a brief description is given and further research
1777 is left as an exercise for the reader: </p>
1779 <dl>
1781 <dt> <em>stowES</em>
1783 <dd>
1785 <pre>
1786 <a href="https://os.inf.tu-dresden.de/~adam/stowES/">https://os.inf.tu-dresden.de/~adam/stowES/</a>
1787 </pre>
1789 <p> &quot;<em>stowES (stow Enhancement Script) is
1790 a Perl script which tries to ease the use of the "stow"
1791 packaging program and software which can be compiled and
1792 installed with autoconf. It automates the compilation and
1793 installation of software packages and provides some useful
1794 functions to maintain your stow packages (e.g., list packages,
1795 check packages for integrity, etc.).</em>&quot; </p>
1797 <dt> <em>opt_depot</em>
1799 <dd>
1801 <pre>
1802 <a href="https://github.com/jonabbey/opt_depot">https://github.com/jonabbey/opt_depot</a>
1803 </pre>
1805 <p> &quot;<em>opt_depot is a suite of Perl scripts which makes
1806 it easy to manage installed software across a wide range
1807 of client systems. opt_depot makes it possible to keep all
1808 files associated with a program together in one directory,
1809 so installation and de-installation is simple. opt_depot is
1810 easy to manage, and provides a scheme for installing software
1811 in a truly portable fashion; packages may be installed locally
1812 on client systems, or kept in a central package archive for
1813 NFS access. </em>&quot;</p>
1815 <p> This site also has links to several other package
1816 management utilities, including <em>Graft</em>. </p>
1818 <dt> <em>relink</em>
1820 <dd>
1822 <pre>
1823 <a href="http://sourceforge.net/projects/relink/">http://sourceforge.net/projects/relink/</a>
1824 </pre>
1826 <p> &quot;<em>relink is a package management tool for
1827 organization and management of software packages. It should
1828 run on any UNIX platform that runs PERL. Similar tools
1829 include: rpm(REDHAT/Mandrake), pkgadd(Slackware/SUN),
1830 stow(GNU) and depot(CMU)</em>&quot; </p>
1833 <dt> <em>univSrcPkg</em>
1835 <dd>
1837 <pre>
1838 <a href="http://freecode.com/articles/the-universal-source-package">http://freecode.com/articles/the-universal-source-package</a>
1839 </pre>
1841 <p> <a href="mailto:bud@sistema.it">Bud Bruegger</a> has written
1842 a brief paper outlining his thoughts on a &quot;<em>Universal Source
1843 Package</em>&quot; solution. </p>
1845 <p> This site also has links to other package management
1846 programs and similar items of interest. </p>
1848 </dl>
1850 <hr>
1852 <h2><a name="design">Design</a></h2>
1854 <p> This brings us to <em>Graft</em>. <em>Graft</em> has been designed to
1855 use the best features of <em>Depot</em>, <em>Stow</em> and <em>Encap</em>
1856 while maintaining as simple a mechanism as possible. The principles of
1857 <em>Graft</em> are: </p>
1859 <ul>
1861 <li> <p> <em>Graft</em> will allow packages to be <em>grafted</em>
1862 from any directory to any other directory. Default
1863 <tt>installation</tt> and <tt>target</tt> directories will be
1864 used but can easily be overridden on the command line. </p>
1866 <li> <p> <em>Graft</em> will log its actions to a log file. The
1867 log file can be specified on the command line. If not specified
1868 on the command line a default log file will be used. </p>
1870 <li> <p> <em>Graft</em> will NOT create symbolic links to
1871 directories. If a directory does not exist in the target tree
1872 it will be created (with the same ownership and permissions as
1873 the original if desired). </p>
1875 <li> <p> <em>Graft</em> will create symbolic links with full
1876 pathnames rather than relative pathnames. This allows easy
1877 identification of true package locations and facilitates block
1878 movement of a target tree without the need for <em>Graft</em>
1879 deletion and re-installation. </p>
1881 <li> <p> <em>Graft</em> will cease installation of a package if a
1882 conflict arises. A conflict is defined as one of the following
1883 conditions: </p>
1885 <ul>
1887 <li> If the package object is a directory and the
1888 target object exists but is not a directory.
1890 <li> If the package object is not a directory and the
1891 target object exists and is not a symbolic link.
1893 <li> If the package object is not a directory and the
1894 target object exists and is a symbolic link to
1895 something other than the package object.
1897 <li> If the package directory contains a
1898 <tt>.graft-config</tt> file and the target object exists
1899 but does not match the 32-bit CRC of the package object.
1901 </ul>
1903 <li> <p> Installation conflicts will always be reported. Conflicts
1904 will be reported to standard error. </p>
1906 <li> <p> <em>Graft</em> will attempt to display all possible
1907 operations when asked, even when asked not to perform the
1908 operations. </p>
1910 <li> <p> <em>Graft</em> will not delete directories when
1911 uninstalling. <em>Graft</em> will print an appropriate message if an
1912 empty directory results and leave the deletion for the operator
1913 to perform outside the scope of <em>Graft</em>'s operations. This
1914 ensures that <em>place holder</em> directories that may be
1915 used by other packages are not inadvertently removed. This
1916 feature can be permanently disabled by setting a flag in the
1917 <tt>Makefile</tt>. It can also be temporarily disabled using a
1918 command line option. </p>
1920 <li> <p> <em>Graft</em> will continue to delete the remainder of
1921 a package after a conflict arises. This maximises the amount of
1922 deletion that can be performed. </p>
1924 <li> <p> Deletion conflicts will always be reported. Conflicts
1925 will be reported to standard error. </p>
1927 <li> <p> <em>Graft</em> will only concern itself with files
1928 relating to the package at hand. This will allow other packages
1929 to be placed in the target area without fear of intervention by
1930 <em>Graft</em>. </p>
1932 <li> <p> <em>Graft</em> will only allow the superuser to install
1933 or delete packages. This feature can be permanently disabled by
1934 setting a flag in the <tt>Makefile</tt> or it may be overridden
1935 by a command line option. </p>
1937 <li> <p> If the file <tt>.nograft</tt> exists in any package
1938 directory, <em>Graft</em> will bypass that directory and any
1939 subdirectories during installation. The name of this file is
1940 specified in the <tt>Makefile</tt>. </p>
1942 <li> <p> When installing a directory tree, if the file
1943 <tt>.graft-exclude</tt> exists in any package directory,
1944 <em>Graft</em> will assume that the file contains a list of
1945 file and/or directory names - one per line - which correspond
1946 to files and/or directories in the directory containing the
1947 <tt>.graft-exclude</tt> file. These files and/or directories
1948 will NOT be <em>grafted</em>. The name of this file is specified
1949 in the <tt>Makefile</tt>. </p>
1951 <p> The <tt>.nograft</tt> file takes priority over the
1952 <tt>.graft-exclude</tt> file. </p>
1954 <li> <p> When installing a directory tree, if the file
1955 <tt>.graft-include</tt> exists in any package directory,
1956 <em>Graft</em> will assume that the file contains a list of
1957 file and/or directory names - one per line - which correspond
1958 to files and/or directories in the directory containing the
1959 <tt>.graft-include</tt> file. ONLY the files and/or directories
1960 listed in the <tt>.graft-include</tt> will be <em>grafted</em>. The
1961 name of this file is specified in the <tt>Makefile</tt>. </p>
1963 <p> The <tt>.graft-exclude</tt> file takes priority over the
1964 <tt>.graft-include</tt> file. </p>
1966 <li> <p> When installing a directory tree, if the file
1967 <tt>.graft-config</tt> exists in a package directory, the contents
1968 of the directory will be <strong>copied</strong> to the target
1969 directory. If the target files exists and is in conflict with the
1970 package file then the package file will be copied into the target
1971 directory as <tt>file<em>.new</em></tt>. </p>
1973 <p> The <tt>.graft-include</tt> file takes priority over the
1974 <tt>.graft-config</tt> file. </p>
1976 <li> <p> If the file <tt>.nograft</tt> exists in any package
1977 directory, it will be ignored and <em>Graft</em> will continue
1978 processing the directory and any subdirectories during
1979 deletion. </p>
1981 <li> <p> If the file <tt>.graft-exclude</tt> exists in any
1982 package directory, its contents will be ignored and <em>Graft</em>
1983 will continue processing the directory and any subdirectories
1984 during deletion. </p>
1986 <li> <p> If the file <tt>.graft-include</tt> exists in any
1987 package directory, its contents will be ignored and <em>Graft</em>
1988 will continue processing the directory and any subdirectories
1989 during deletion. </p>
1991 <li> <p> If the file <tt>.graft-config</tt> exists in any
1992 package directory, during deletion matching files in the target
1993 directory will not be deleted however any
1994 <tt>file<em>.new</em></tt> files will be deleted. </p>
1996 <li> <p> As an aid to transitioning systems to <em>Graft</em>,
1997 <em>Graft</em> will allow conflicting files to be pruned. This
1998 pruning can take the form of a file rename or a file removal
1999 depending on either a <tt>Makefile</tt> flag or a command line
2000 option. If file removal is selected and the file is a non-empty
2001 directory, it will be renamed instead. </p>
2003 <li> <p> If the file <tt>.nograft</tt> exists in any package
2004 directory, it will be ignored and <em>Graft</em> will continue
2005 processing the directory and any subdirectories during
2006 pruning. </p>
2008 <li> <p> If the file <tt>.graft-exclude</tt> exists in any
2009 package directory, its contents will be ignored and <em>Graft</em>
2010 will continue processing the directory and any subdirectories
2011 during pruning. </p>
2013 <li> <p> If the file <tt>.graft-include</tt> exists in any
2014 package directory, its contents will be ignored and <em>Graft</em>
2015 will continue processing the directory and any subdirectories
2016 during pruning. </p>
2018 <li> <p> If the file <tt>.graft-config</tt> exists in any
2019 package directory, the files in the directory will be ignored
2020 during pruning. Sub-directories will continue to be processed
2021 appropriately. </p>
2023 </ul>
2025 <h3><a name="precedence">Control file precedence &amp; conflict resolution</a></h3>
2027 <p> As stated above, the various <em>Graft</em> control files have the
2028 following precedence, from highest to lowest: </p>
2030 <pre>
2031 .nograft &gt; .graft-exclude &gt; .graft-include &gt; .graft-config
2032 </pre>
2034 <p> The following table summarises the activities of <em>Graft</em> when
2035 various control files are present: </p>
2037 <center>
2038 <table summary="Control File Precedence" border=2 cellpadding=3>
2039 <tr>
2040 <th colspan=5>
2041 Install
2042 </th>
2043 </tr>
2045 <tr>
2046 <th>
2047 <em>Target</em>
2048 </th>
2050 <th>
2051 <em>.nograft</em>
2052 </th>
2054 <th>
2055 <em>.graft-exclude</em>
2056 </th>
2058 <th>
2059 <em>.graft-include</em>
2060 </th>
2062 <th>
2063 <em>.graft-config</em>
2064 </th>
2065 </tr>
2067 <tr>
2068 <td>
2069 does not exist
2070 </td>
2072 <td>
2073 IGNORE
2074 </td>
2076 <td>
2077 IGNORE
2078 </td>
2080 <td>
2081 SYMLINK
2082 </td>
2084 <td>
2085 COPY
2086 </td>
2087 </tr>
2089 <tr>
2090 <td>
2091 symlink to source
2092 </td>
2094 <td>
2095 IGNORE
2096 </td>
2098 <td>
2099 IGNORE
2100 </td>
2102 <td>
2104 </td>
2106 <td>
2107 DELETE &amp; COPY
2108 </td>
2109 </tr>
2111 <tr>
2112 <td>
2113 symlink to other
2114 </td>
2116 <td>
2117 IGNORE
2118 </td>
2120 <td>
2121 IGNORE
2122 </td>
2124 <td>
2125 CONFLICT
2126 </td>
2128 <td>
2130 </td>
2131 </tr>
2133 <tr>
2134 <td>
2135 symlink to other (crc match)
2136 </td>
2138 <td>
2140 </td>
2142 <td>
2144 </td>
2146 <td>
2148 </td>
2150 <td>
2152 </td>
2153 </tr>
2155 <tr>
2156 <td>
2157 symlink to other (crc diff)
2158 </td>
2160 <td>
2162 </td>
2164 <td>
2166 </td>
2168 <td>
2170 </td>
2172 <td>
2173 COPY.new
2174 </td>
2175 </tr>
2177 <tr>
2178 <td>
2179 file
2180 </td>
2182 <td>
2183 IGNORE
2184 </td>
2186 <td>
2187 IGNORE
2188 </td>
2190 <td>
2191 CONFLICT
2192 </td>
2194 <td>
2196 </td>
2197 </tr>
2199 <tr>
2200 <td>
2201 file (crc match)
2202 </td>
2204 <td>
2206 </td>
2208 <td>
2210 </td>
2212 <td>
2214 </td>
2216 <td>
2218 </td>
2219 </tr>
2221 <tr>
2222 <td>
2223 file (crc diff)
2224 </td>
2226 <td>
2228 </td>
2230 <td>
2232 </td>
2234 <td>
2236 </td>
2238 <td>
2239 COPY.new
2240 </td>
2241 </tr>
2243 <tr>
2244 <td>
2245 not a file
2246 </td>
2248 <td>
2249 IGNORE
2250 </td>
2252 <td>
2253 IGNORE
2254 </td>
2256 <td>
2257 CONFLICT
2258 </td>
2260 <td>
2261 CONFLICT
2262 </td>
2263 </tr>
2265 <tr>
2266 <th colspan=5>
2267 Delete
2268 </th>
2269 </tr>
2271 <tr>
2272 <th>
2273 <em>Target</em>
2274 </th>
2276 <th>
2277 <em>.nograft</em>
2278 </th>
2280 <th>
2281 <em>.graft-exclude</em>
2282 </th>
2284 <th>
2285 <em>.graft-include</em>
2286 </th>
2288 <th>
2289 <em>.graft-config</em>
2290 </th>
2291 </tr>
2293 <tr>
2294 <td>
2295 does not exist
2296 </td>
2298 <td>
2300 </td>
2302 <td>
2304 </td>
2306 <td>
2308 </td>
2310 <td>
2312 </td>
2313 </tr>
2315 <tr>
2316 <td>
2317 symlink to source
2318 </td>
2320 <td>
2321 DELETE
2322 </td>
2324 <td>
2325 DELETE
2326 </td>
2328 <td>
2329 DELETE
2330 </td>
2332 <td>
2333 DELETE &amp; DELETE.new
2334 </td>
2335 </tr>
2337 <tr>
2338 <td>
2339 symlink to other
2340 </td>
2342 <td>
2343 CONFLICT
2344 </td>
2346 <td>
2347 CONFLICT
2348 </td>
2350 <td>
2351 CONFLICT
2352 </td>
2354 <td>
2356 </td>
2357 </tr>
2359 <tr>
2360 <td>
2361 symlink to other (crc match)
2362 </td>
2364 <td>
2366 </td>
2368 <td>
2370 </td>
2372 <td>
2374 </td>
2376 <td>
2377 DELETE.new
2378 </td>
2379 </tr>
2381 <tr>
2382 <td>
2383 symlink to other (crc diff)
2384 </td>
2386 <td>
2388 </td>
2390 <td>
2392 </td>
2394 <td>
2396 </td>
2398 <td>
2400 </td>
2401 </tr>
2403 <tr>
2404 <td>
2405 file
2406 </td>
2408 <td>
2409 NOTE
2410 </td>
2412 <td>
2413 NOTE
2414 </td>
2416 <td>
2417 CONFLICT
2418 </td>
2420 <td>
2422 </td>
2423 </tr>
2425 <tr>
2426 <td>
2427 file (crc match)
2428 </td>
2430 <td>
2432 </td>
2434 <td>
2436 </td>
2438 <td>
2440 </td>
2442 <td>
2443 DELETE.new
2444 </td>
2445 </tr>
2447 <tr>
2448 <td>
2449 file (crc diff)
2450 </td>
2452 <td>
2454 </td>
2456 <td>
2458 </td>
2460 <td>
2462 </td>
2464 <td>
2466 </td>
2467 </tr>
2469 <tr>
2470 <td>
2471 not a file
2472 </td>
2474 <td>
2475 CONFLICT
2476 </td>
2478 <td>
2479 CONFLICT
2480 </td>
2482 <td>
2483 CONFLICT
2484 </td>
2486 <td>
2487 CONFLICT
2488 </td>
2489 </tr>
2491 <tr>
2492 <th colspan=5>
2493 Prune
2494 </th>
2495 </tr>
2497 <tr>
2498 <th>
2499 <em>Target</em>
2500 </th>
2502 <th>
2503 <em>.nograft</em>
2504 </th>
2506 <th>
2507 <em>.graft-exclude</em>
2508 </th>
2510 <th>
2511 <em>.graft-include</em>
2512 </th>
2514 <th>
2515 <em>.graft-config</em>
2516 </th>
2517 </tr>
2519 <tr>
2520 <td>
2521 does not exist
2522 </td>
2524 <td>
2526 </td>
2528 <td>
2530 </td>
2532 <td>
2534 </td>
2536 <td>
2538 </td>
2539 </tr>
2541 <tr>
2542 <td>
2543 symlink to source
2544 </td>
2546 <td>
2548 </td>
2550 <td>
2552 </td>
2554 <td>
2556 </td>
2558 <td>
2560 </td>
2561 </tr>
2563 <tr>
2564 <td>
2565 symlink to other
2566 </td>
2568 <td>
2569 PRUNE
2570 </td>
2572 <td>
2573 PRUNE
2574 </td>
2576 <td>
2577 PRUNE
2578 </td>
2580 <td>
2582 </td>
2583 </tr>
2585 <tr>
2586 <td>
2587 file
2588 </td>
2590 <td>
2591 PRUNE
2592 </td>
2594 <td>
2595 PRUNE
2596 </td>
2598 <td>
2599 PRUNE
2600 </td>
2602 <td>
2604 </td>
2605 </tr>
2607 <tr>
2608 <td>
2609 not a file
2610 </td>
2612 <td>
2613 PRUNE
2614 </td>
2616 <td>
2617 PRUNE
2618 </td>
2620 <td>
2621 PRUNE
2622 </td>
2624 <td>
2626 </td>
2627 </tr>
2628 </table>
2629 </center>
2631 <hr>
2633 <h2><a name="history">History</a></h2>
2635 <p> Development on <em>Graft</em> began in October 1996. The initial design
2636 used a configuration file to map the installed location of each package to
2637 its target directory (that is the directory in which the symbolic links
2638 would be created). Work proceeded at a regular pace and by November 1997
2639 <em>Graft</em> version <em>2.1</em> was released. In this, and all
2640 subsequent versions, the configuration file had been removed in favour of
2641 using default source and target directories. </p>
2643 <p> No further work was performed until September 2000 when the concept of
2644 bypassing or including files and directories using <tt>.nograft</tt> or
2645 <tt>.graft-include</tt> files was introduced in <em>Graft</em> version
2646 <em>2.3</em>. </p>
2648 <p> Again nothing changed until February 2002 when Rod Whitby identified a
2649 bug in the handling of <tt>.graft-include</tt> files. Several other users
2650 (Peter Bray, Robert Maldon and others) also reported some deprecation
2651 warnings when using <em>Graft</em> with <em>Perl</em> version
2652 <em>5.6.0</em>. <em>Graft</em> version <em>2.4</em> was the end of
2653 <em>Graft</em> development for over a decade. </p>
2655 <p> In May 2015 Matias A. Fonzo contacted the author wishing to use
2656 <em>Graft</em> in the
2657 <a href="http://www.dragora.org/">Dragora GNU/Linux</a>
2658 distribution. Matias' usage of <em>Graft</em> lead to <em>Graft</em>
2659 version <em>2.5</em> in June 2015 whereby the <tt>-P</tt> command line
2660 option was silently ignored if the effective user was not root. </p>
2662 <p> Since the release of <em>Graft</em> version <em>2.4</em> the author's
2663 <em>Perl</em> code had improved somewhat so <em>Graft</em> version
2664 <em>2.6</em> released in July 2015 represented a major clean up of coding
2665 style and internals. No new behaviours or features were added to the
2666 <em>2.6</em> release. </p>
2668 <p> Matias made some more suggestions and improvements up to and including
2669 <em>Graft</em> version <em>2.16</em> in April 2018. These changes added
2670 the <tt>.graft-config</tt> control file, the <tt>-r /rootdir</tt> option for
2671 specifying a new root directory, the <tt>-L</tt> option for displaying
2672 default locations as well as introducing some tighter controls on the
2673 messages and exit status of <em>Graft</em> under various conditions. </p>
2675 <hr>
2677 <h2><a name="installation">Installation</a></h2>
2679 <p> Before installing <em>Graft</em> you'll need <em>Perl</em>
2680 5.<em>x</em>. <em>Graft</em> version 2.<em>x</em> requires features only
2681 available with <em>Perl</em> 5.<em>x</em> and will not run with
2682 <em>Perl</em> 4.<em>x</em>. </p>
2684 <p> Your operating system and its file system(s) should also support
2685 symbolic links. If you can't make symbolic links then you can't use
2686 <em>Graft</em>! <em>Graft</em> will exit gracefully if your version of
2687 <em>Perl</em> does not support symbolic links. It will also exit gracefully
2688 if you attempt to <em>graft</em> a package into a file system that does not
2689 support symbolic links - from a Linux <tt>ext4</tt> file system into an
2690 <tt>vfat</tt> file system for example. </p>
2692 <p> <em>Graft</em> has been written to ensure it uses <em>Perl</em> modules
2693 that are considered part of the core <em>Perl</em> distribution. However it
2694 may be possible that you're using a home grown installation of
2695 <em>Perl</em> or some distribution that doesn't have the same <em>Perl</em>
2696 modules as the author's development environment. </p>
2698 <p> If this is the case you'll see compile failures for the following modules
2699 if they are unavailable: </p>
2701 <pre>
2702 File::Basename
2703 Getopt::Long
2704 </pre>
2706 <p> You will not be able to install <em>Graft</em> until these modules are
2707 available. </p>
2709 <p> You may also see run-time failures when using <em>Graft</em> with
2710 <tt>.graft-config</tt> files if the following modules are unavailable: </p>
2712 <pre>
2713 Compress::Raw::Zlib (<em>used in install and delete modes</em>)
2714 File::Copy (<em>only used in install mode</em>)
2715 </pre>
2717 <p> If you don't have these modules and you do not intend to use
2718 <tt>.graft-config</tt> files then you can continue to use <em>Graft</em>
2719 without issue. </p>
2721 <p> Follow these instructions to install <em>Graft</em>: </p>
2723 <ol>
2725 <li> <p> Unpack the gzipped <em>Graft</em> distribution: </p>
2727 <pre>
2728 gunzip -c graft-2.16.tar.gz | tar xvf -
2729 </pre>
2731 <li> <p> change directories to the <em>Graft</em> distribution
2732 directory: </p>
2734 <pre>
2735 cd graft-2.16
2736 </pre>
2738 <li> <p> Create an writable version of the <tt>Makefile</tt> by
2739 running the command </p>
2741 <pre>
2742 make -f Makefile.dist
2743 </pre>
2745 <p> You'll see output similar to </p>
2747 <pre>
2748 cp Makefile.dist Makefile
2749 chmod 644 Makefile
2751 ######################################################
2753 # You'll now need to modify the Makefile #
2754 # variables to suit your local conditions. #
2756 ######################################################
2758 make: *** [Makefile] Error 1
2759 </pre>
2761 <p> You can ignore the error message. That is just there to
2762 prevent the creation of the <em>graft</em> executable before you've
2763 made your site specific configurations to the <tt>Makefile</tt>.
2764 </p>
2766 <li> <p> Edit the <tt>Makefile</tt>. The following variables should be
2767 modified to suit your local requirements: </p>
2769 <dl>
2771 <dt>
2772 <pre>
2773 <strong>PACKAGEDIR</strong> = /usr/local/pkgs
2774 <strong>TARGETDIR</strong> = /usr/local
2775 </pre>
2777 <dd> <p> These two variables control your default
2778 package <tt>installation</tt> and <tt>target</tt>
2779 directories. Most sites will probably choose to
2780 install packages under a common <tt>installation</tt>
2781 directory and then <em>graft</em> them into a common
2782 <tt>target</tt> directory. </p>
2784 <p> If no specific <tt>target</tt> directory is
2785 given on the command line, <em>Graft</em> will use
2786 the default value specified by <strong>TARGETDIR</strong>. If
2787 a <tt>target</tt> directory is given on the command
2788 line but is not fully qualified, the value specified
2789 by <strong>TARGETDIR</strong> will be prepended to the command
2790 line argument. </p>
2792 <p> Package names provided to <em>Graft</em> that are
2793 not fully qualified will have the value specified
2794 by <strong>PACKAGEDIR</strong> prepended to the command line
2795 arguments. </p>
2796 <dt>
2797 <pre>
2798 <strong>TOP</strong> = $(PACKAGEDIR)/graft-$(VERSION)
2799 <strong>BIN</strong> = $(TOP)/bin
2800 <strong>MAN</strong> = $(TOP)/man
2801 <strong>DOC</strong> = $(TOP)/doc
2802 </pre>
2804 <dd> <p> There should be no need to modify these
2805 values unless you wish to install <em>Graft</em> into
2806 a directory that is different from your default
2807 package installation directory. If you do modify
2808 <strong>TOP</strong> you should not change the values of
2809 <strong>BIN</strong>, <strong>MAN</strong> and <strong>DOC</strong>. If you feel
2810 you must change these values then perhaps you've
2811 misunderstood the concept behind <em>Graft</em> so a
2812 re-read of this document may be in order. </p>
2814 <dt>
2815 <pre>
2816 <strong>PERL</strong> = /usr/bin/perl
2817 </pre>
2819 <dd> <p> This variable refers to the location
2820 of the <em>Perl</em> 5.<em>x</em> that will be used by
2821 the <em>Graft</em> executable. If you plan on
2822 <em>grafting</em> <em>Perl</em> then this value should
2823 be the <em>grafted</em> location of <em>Perl</em>
2824 rather than the installation location of <em>Perl</em>.
2825 If you are using an operating system that comes with
2826 <em>Perl</em> 5.<em>x</em> - such as RedHat or Ubuntu
2827 Linux - then you don't need to worry about
2828 <em>grafting</em> <em>Perl</em> so the value of
2829 <strong>PERL</strong> should reflect its installed
2830 location. </p>
2832 <p> Most Unix, Linux and other Unix like operating
2833 systems ship with <em>Perl</em> these days so
2834 modifying this value is probably unnecessary. </p>
2836 <dt>
2837 <pre>
2838 <strong>BUILDPERL</strong> = $(PERL)
2839 </pre>
2841 <dd> <p> <em>Perl</em> is required during the
2842 <tt>make</tt>. You'll only need to change this if
2843 the current installed location of <em>Perl</em> is
2844 different to the future <em>grafted</em> location of
2845 <em>Perl</em>. </p>
2847 <dt>
2848 <pre>
2849 <strong>LOGFILE</strong> = /var/log/graft
2850 </pre>
2852 <dd> <p> <em>Graft</em> logs all of its actions to a log
2853 file. Modify the value of <strong>LOGFILE</strong> to suit
2854 your local needs. An alternative name can be
2855 specified on the command line. </p>
2857 <p> If you want logging disabled by default, set the
2858 value of <strong>LOGFILE</strong> to <tt>/dev/null</tt>. </p>
2860 <dt>
2861 <pre>
2862 <strong>GRAFT-IGNORE</strong> = .nograft
2863 <strong>GRAFT-EXCLUDE</strong> = .graft-exclude
2864 <strong>GRAFT-INCLUDE</strong> = .graft-include
2865 <strong>GRAFT-CONFIG</strong> = .graft-config
2866 </pre>
2868 <dd> <p> These variables hold the names of the
2869 special <em>Graft</em> files that control whether or
2870 not subdirectories or files are <em>grafted</em>. If
2871 you change these values, try to choose obvious names.
2872 If you want the files to appear in a simple directory
2873 listing, do not use file names that begin with a
2874 dot &quot;.&quot; character. </p>
2876 <dt>
2877 <pre>
2878 <strong>GRAFT-NEVER</strong> =
2879 </pre>
2881 <dd> <p> This variable holds the names of the
2882 files and/or directories that should never be
2883 <em>grafted</em>. Typically these may be source code
2884 repositories as used by systems such as
2885 <em>CVS</em>, or perhaps lockfiles. The default
2886 value is empty but if you wish to specify values,
2887 simply add them to the variable using only
2888 whitespace as a separator. For example: </p>
2890 <pre>
2891 GRAFT-NEVER = CVS RCS SCCS .lock
2892 </pre>
2894 <dt>
2895 <pre>
2896 <strong>NEVERGRAFT</strong> = 0
2897 </pre>
2899 <dd> <p> If this variable is set to <strong>1</strong>,
2900 the files and/or directories specified by
2901 <strong>GRAFT-NEVER</strong> will be automatically excluded
2902 from the <em>grafted</em> directory. </p>
2904 <p> If this variable is set to <strong>0</strong>, the files
2905 and/or directories specified by <strong>GRAFT-NEVER</strong>
2906 will be not be excluded from the <em>grafted</em>
2907 directory. </p>
2909 <p> The sense of this value is reversed by use of
2910 the <strong>-C</strong> command line option.
2912 <p> The automatic exclusion is bypassed completely
2913 if the <em>grafted</em> directory contains either
2914 a <tt>.nograft</tt> or <tt>.graft-include</tt>
2915 file. </p>
2917 <dt>
2918 <pre>
2919 <strong>PRUNED-SUFFIX</strong> = .pruned
2920 </pre>
2922 <dd> <p> This variable sets the suffix name of
2923 <em>pruned</em> files. <em>Pruned</em> files will be
2924 renamed <em>filename</em><tt>.pruned</tt>. </p>
2926 <dt>
2927 <pre>
2928 <strong>CONFIG-SUFFIX</strong> = .new
2929 </pre>
2931 <dd> <p> This variable sets the suffix name of configuration
2932 files that will be copied to the target directory when
2933 the target object is in conflict with the package
2934 object. The files will be copied as
2935 <em>filename</em><tt>.new</tt>. </p>
2937 <dt>
2938 <pre>
2939 <strong>SUPERUSER</strong> = 1
2940 </pre>
2942 <dd> <p> If this variable is set to <strong>1</strong> only
2943 the superuser can <em>install</em>, <em>delete</em>
2944 or <em>prune</em> packages. This can be overridden
2945 by the use of the <strong>-u</strong> command line
2946 option. If this variable is set to <strong>0</strong>,
2947 superuser privileges are not required and the
2948 <strong>-u</strong> override command line option is
2949 disabled. </p>
2951 <p> If you are installing a private copy of
2952 <em>Graft</em> to manage packages in your home
2953 directory you should set <strong>SUPERUSER</strong> to
2954 <strong>0</strong>. </p>
2956 <p> If you're using <em>Graft</em> to manage a global
2957 set of packages you should set <strong>SUPERUSER</strong>
2958 to <strong>1</strong>. </p>
2960 <dt>
2961 <pre>
2962 <strong>PRESERVEPERMS</strong> = 0
2963 </pre>
2965 <dd> <p> When <em>grafting</em> packages, <em>Graft</em>
2966 will create new directories as required. By setting
2967 <strong>PRESERVEPERMS</strong> to <strong>1</strong>,
2968 the original user id, group id and file modes will be
2969 carried over to the new directory. This variable is
2970 used only if <strong>SUPERUSER</strong> is set to
2971 <strong>1</strong>. The sense of this variable can be
2972 reversed using the <strong>-P</strong> command line
2973 option. </p>
2975 <dt>
2976 <pre>
2977 <strong>DELETEOBJECTS</strong> = 0
2978 </pre>
2980 <dd> <p> When deleting <em>grafted</em> packages,
2981 <em>Graft</em> may leave empty directories. Setting
2982 <strong>DELETEOBJECTS</strong> to <strong>1</strong>
2983 will allow <em>Graft</em> to delete these directories.
2984 If <strong>DELETEOBJECTS</strong> is <strong>0</strong>
2985 then <em>Graft</em> will display an appropriate message
2986 reminding the user that a directory has been emptied.
2987 The sense of this variable can be reversed using the
2988 <strong>-D</strong> command line option. </p>
2990 <p> It's probably not good practise to set this value
2991 to <strong>1</strong> as some directories may be used
2992 as place holders by a number of different packages. If
2993 the value is set to <strong>0</strong> deletion of
2994 directories can be forced via the <strong>-D</strong>
2995 command line option. </p>
2997 <p> When pruning packages, <em>graft</em> can either
2998 remove conflicting files or rename them. If
2999 <strong>DELETEOBJECTS</strong> is set to
3000 <strong>1</strong> the default prune action will be to
3001 delete conflicting objects. If
3002 <strong>DELETEOBJECTS</strong> is set to
3003 <strong>0</strong> the default prune action will be to
3004 rename conflicting objects. The sense of this variable
3005 can be reversed using the <strong>-D</strong> command
3006 line option. </p>
3008 </dl>
3010 <p> Save your changes and exit from the editor. </p>
3012 <li> <p> Remove any existing executables by running: </p>
3014 <pre>
3015 make clean
3016 </pre>
3018 <p> You should see output similar to: </p>
3020 <pre>
3021 rm -f graft
3022 </pre>
3024 <li> <p> Create the <em>Graft</em> executable by running: </p>
3026 <pre>
3027 make
3028 </pre>
3030 <p> You should see output similar to: </p>
3032 <pre>
3033 /usr/bin/perl -wc graft.pl
3034 graft.pl syntax OK
3035 sed \
3036 -e 's#xCONFIG-SUFFIXx#.new#g' \
3037 -e 's#xDELETEOBJECTSx#0#g' \
3038 -e 's#xGRAFT-CONFIGx#.graft-config#g' \
3039 -e 's#xGRAFT-EXCLUDEx#.graft-exclude#g' \
3040 -e 's#xGRAFT-IGNOREx#.nograft#g' \
3041 -e 's#xGRAFT-INCLUDEx#.graft-include#g' \
3042 -e 's#xGRAFT-NEVERx##g' \
3043 -e 's#xLOGFILEx#/var/log/graft#g' \
3044 -e 's#xNEVERGRAFTx#0#g' \
3045 -e 's#xPACKAGEDIRx#/usr/local/pkgs#g' \
3046 -e 's#xPERLx#/usr/bin/perl#g' \
3047 -e 's#xPRESERVEPERMSx#0#g' \
3048 -e 's#xPRUNED-SUFFIXx#.pruned#g' \
3049 -e 's#xSUPERUSERx#1#g' \
3050 -e 's#xTARGETDIRx#/usr/local#g' \
3051 &lt; graft.pl &gt; graft
3052 chmod +x graft
3053 /usr/bin/perl -wc graft
3054 graft syntax OK
3055 if [ -n &quot;&quot; ]; \
3056 then \
3057 AUTOIGNORE=1; \
3058 else \
3059 AUTOIGNORE=0; \
3060 fi; \
3061 sed \
3062 -e &quot;s#xAUTOIGNOREx#$AUTOIGNORE#g&quot; \
3063 -e 's#xCONFIG-SUFFIXx#.new#g' \
3064 -e 's#xDELETEOBJECTSx#0#g' \
3065 -e 's#xDOCx#/usr/local/pkgs/graft-2.16/doc#g' \
3066 -e 's#xGRAFT-CONFIGx#.graft-config#g' \
3067 -e 's#xGRAFT-EXCLUDEx#.graft-exclude#g' \
3068 -e 's#xGRAFT-IGNOREx#.nograft#g' \
3069 -e 's#xGRAFT-INCLUDEx#.graft-include#g' \
3070 -e 's#xGRAFT-NEVERx##g' \
3071 -e 's#xLOGFILEx#/var/log/graft#g' \
3072 -e 's#xNEVERGRAFTx#0#g' \
3073 -e 's#xPACKAGEDIRx#/usr/local/pkgs#g' \
3074 -e 's#xPERLx#/usr/bin/perl#g' \
3075 -e 's#xPRESERVEPERMSx#0#g' \
3076 -e 's#xPRUNED-SUFFIXx#.pruned#g' \
3077 -e 's#xSUPERUSERx#1#g' \
3078 -e 's#xTARGETDIRx#/usr/local#g' \
3079 -e 's#xVERSIONx#2.16#g' \
3080 &lt; graft.man &gt; graft.1
3081 </pre>
3083 <li> <p> If you're using the <em>automounter</em> under Solaris
3084 2.<em>x</em>, the installation process may not be able to directly
3085 create the directory specified by <strong>TOP</strong>. If this is the case
3086 then manually create this directory using whatever procedures
3087 are appropriate for your operating system. </p>
3089 <p> For example, if the <tt>/usr/local</tt> mount point is under the
3090 control of the <em>automounter</em> via an entry in the
3091 <tt>auto_pkgs</tt> map: </p>
3093 <pre>
3094 * nfshost:/export/sparc-SunOS-5.5.1/usr/local/&amp;
3095 </pre>
3097 <p> you'll need to create the <em>Graft</em> installation directory
3098 by executing the following command on the machine <em>nfshost</em>:
3099 </p>
3101 <pre>
3102 mkdir /export/sparc-SunOS-5.5.1/usr/local/pkgs/graft-2.16
3103 </pre>
3105 <li> <p> Install the <em>Graft</em> executable, manual page and
3106 documentation by executing: </p>
3108 <pre>
3109 make install
3110 </pre>
3112 <p> You should see output similar to: </p>
3114 <pre>
3115 mkdir -p /usr/local/pkgs/graft-2.16/bin
3116 cp graft /usr/local/pkgs/graft-2.16/bin
3118 for i in graft.1; \
3119 do \
3120 manpage=`basename $i`; \
3121 man=`expr $i : '.*\.\(.\)'`; \
3122 mkdir -p /usr/local/pkgs/graft-2.16/man/man$man; \
3123 cp $i /usr/local/pkgs/graft-2.16/man/man$man/$manpage; \
3124 chmod 644 /usr/local/pkgs/graft-2.16/man/man$man/$manpage; \
3125 done
3127 for i in graft.html graft.pdf graft.ps graft.txt; \
3128 do \
3129 mkdir -p /usr/local/pkgs/graft-2.16/doc; \
3130 cp doc/$i /usr/local/pkgs/graft-2.16/doc; \
3131 chmod 644 /usr/local/pkgs/graft-2.16/doc/$i; \
3132 touch /usr/local/pkgs/graft-2.16/doc/.nograft; \
3133 done
3134 </pre>
3136 </ol>
3138 <p> <em>Graft</em> is now installed and ready to be used. </p>
3140 <p> <strong>NOTE:</strong> If you make changes to your <em>Graft</em> installation at a
3141 later date, please run the following commands: </p>
3143 <pre>
3144 make clean
3145 make install
3146 </pre>
3148 <p> Failure to do this may result in a <em>Graft</em> manual page that does
3149 NOT reflect your current configuration. </p>
3151 <h3><a name="rpm_and_deb">Creating RPM and DEB packages</a></h3>
3153 <p> Beginning with <em>Graft</em> 2.11 there is now the ability to create
3154 RPM and Debian installation packages. Obviously you'll need one or more of
3155 the <em>rpmbuild</em> and <em>dpkg-deb</em> packages installed on your
3156 system. </p>
3158 <p> After editing the <tt>Makefile</tt> to suit your environment simply run
3159 the appropriate <tt>make</tt> command to create the binary installation
3160 package in the current directory: </p>
3162 <pre>
3163 make rpm
3164 </pre>
3166 <p> or </p>
3168 <pre>
3169 make deb
3170 </pre>
3172 <p> The creation of these packages is somewhat experimental. Please let the
3173 author know if you have issues. </p>
3175 <hr>
3177 <h3><a name="gotchas">Grafting <em>Graft</em> and <em>Perl</em> - the
3178 bootstrap problem</a></h3>
3180 <p> <strong>If you are using an operating system that comes with <em>Perl</em>
3181 5.<em>x</em> - such as RedHat or Ubuntu Linux - then you don't need to worry
3182 about <em>grafting</em> <em>Perl</em>, so this section can be ignored.</strong> </p>
3184 <p> <strong>However if you are a creator of an operating system
3185 distribution then this section may be relevant.</strong> </p>
3187 <p> Embedded into the <em>Graft</em> executable is the location of the
3188 <em>Perl</em> executable. If you've understood the concept behind
3189 <em>Graft</em> then this location may be the <em>grafted</em> location of
3190 <em>Perl</em> rather than the true location of <em>Perl</em>. </p>
3192 <p> This presents a dilemma when you come to <em>graft</em> both <em>Graft</em>
3193 and <em>Perl</em>. You can't run the <em>grafted</em> location of the
3194 <em>Graft</em> executable because it doesn't exist yet, and you can't run
3195 the real location of the <em>Graft</em> executable because <em>Perl</em>
3196 hasn't been <em>grafted</em> yet. </p>
3198 <p> Assuming that <em>Graft</em> and <em>Perl</em> are installed in </p>
3200 <pre>
3201 /usr/local/pkgs/graft-2.16
3202 /usr/local/pkgs/perl-5.18.2
3203 </pre>
3205 <p> you can resolve this dilemma by executing the following commands:
3206 </p>
3208 <pre>
3209 /usr/local/pkgs/perl-5.18.2/bin/perl /usr/local/pkgs/graft-2.16/bin/graft -i graft-2.16
3210 /usr/local/pkgs/perl-5.18.2/bin/perl /usr/local/pkgs/graft-2.16/bin/graft -i perl-5.18.2
3211 </pre>
3213 <p> This will <em>graft</em> both <em>Graft</em> and <em>Perl</em> from the
3214 default package installation directory (as specified by
3215 <strong>PACKAGEDIR</strong> in the <tt>Makefile</tt>) into your default target
3216 directory (as specified by <strong>TARGETDIR</strong> in the <tt>Makefile</tt>).
3217 </p>
3219 <p> If you don't wish to use the default directories you can use the
3220 following commands to <em>graft</em> the packages into <tt>/pkgs</tt>
3221 instead of <tt>/usr/local</tt> for example: </p>
3223 <pre>
3224 /usr/local/pkgs/perl-5.18.2/bin/perl /usr/local/pkgs/graft-2.16/bin/graft -i -t /pkgs /usr/local/pkgs/graft-2.16
3225 /usr/local/pkgs/perl-5.18.2/bin/perl /usr/local/pkgs/graft-2.16/bin/graft -i -t /pkgs /usr/local/pkgs/perl-5.18.2
3226 </pre>
3228 <p> Now both <em>Graft</em> and <em>Perl</em> have been <em>grafted</em> and any
3229 other package can be <em>grafted</em> by executing the simpler command:
3230 </p>
3232 <pre>
3233 graft -i <em>package</em>
3234 </pre>
3236 <p> The <em>Graft</em> distribution includes a program called
3237 <tt>graftBootStrap.sh</tt> which allows you to easily <em>graft</em> both
3238 <em>Graft</em> and <em>Perl</em>. It can be found in the <em>contrib</em>
3239 directory of the distribution. Thanks to Gordon Rowell for providing it.</p>
3241 <p> You may also find the <tt>-L</tt> command line option to be useful to
3242 programmatically determine where <em>Graft</em> expects to find
3243 <em>Perl</em> along with the default locations of its log file, target and
3244 package directories. See the <a href="#graft-L">Information</a> section
3245 below for details. </p>
3247 <hr>
3249 <h2><a name="using-graft">Using <em>Graft</em></a></h2>
3251 <h3><a name="compiling-packages">Compiling Packages</a></h3>
3253 <p> Any packages you wish to place under the control of <em>Graft</em> should
3254 be compiled and installed in such a way that any package dependent
3255 files are referenced with the ACTUAL package installation directory
3256 rather than the common area in which <em>Graft</em> will be creating
3257 symbolic links. For example, ensure that <em>Perl</em> version
3258 <em>5.18.2</em> is looking for its library files in
3259 <tt>/usr/local/pkgs/perl-5.18.2/lib/perl5</tt> instead of
3260 <tt>/usr/local/lib/perl5</tt>. This approach will allow you to easily
3261 separate multiple versions of the same package without any problems. </p>
3263 <hr width="25%">
3265 <h3><a name="usage"><em>Graft</em> command line options</a></h3>
3267 <p> All of the details concerning actions, package locations and target
3268 directories are passed to <em>Graft</em> on the command line.
3269 (<em>Graft</em> 1.<em>x</em> used a configuration file. This has now been
3270 deprecated in favour of a log file). </p>
3272 <p> <em>Graft</em>'s command line options can be summarised as: </p>
3274 <pre>
3275 graft -i [-P|u] [-l log] [-n] [-v|V] [-r /rootdir] [-s|-t target] package(s)
3276 graft -d [-D] [-u] [-l log] [-n] [-v|V] [-r /rootdir] [-s|-t target] package(s)
3277 graft -p [-D] [-u] [-l log] [-n] [-v|V] [-r /rootdir] [-s|-t target] package(s)
3278 graft -L
3279 </pre>
3281 <p> <em>Graft</em> has four basic actions: </p>
3283 <ol>
3285 <li> <p> <a name="graft-i"><strong>Install</strong></a> </p>
3287 <pre>
3288 graft -i [-C] [-P|u] [-l log] [-n] [-v|V] [-r /rootdir] [-s|-t target] package(s)
3289 </pre>
3291 <dl>
3293 <dt> <strong>-i</strong>
3294 <dd>
3295 <p> Install symbolic links from the package
3296 installation directory to the target directory.
3297 Requires superuser privileges if
3298 <strong>SUPERUSER</strong> was set to <strong>1</strong> in the
3299 <tt>Makefile</tt>. </p>
3301 <dt> <strong>-C</strong>
3302 <dd>
3303 <p> If <strong>NEVERGRAFT</strong> was set to <strong>1</strong>
3304 in the <tt>Makefile</tt>, disable the automatic
3305 exclusion of files and/or directories whose
3306 names exactly match the values specified by
3307 <strong>GRAFT-NEVER</strong> in the <tt>Makefile</tt>. </p>
3309 <p> If <strong>NEVERGRAFT</strong> was set to <strong>0</strong>
3310 in the <tt>Makefile</tt>, force the automatic
3311 exclusion of files and/or directories whose
3312 names exactly match the values specified by
3313 <strong>GRAFT-NEVER</strong> in the <tt>Makefile</tt>. </p>
3315 <p> Can only be used with the -i option. </p>
3317 <p> This option is ignored for each <em>grafted</em>
3318 directory, if the directory contains a
3319 <tt>.nograft</tt> or <tt>.graft-include</tt>
3320 file. </p>
3322 <p> The <em>Graft</em> manual page will correctly
3323 reflect the behaviour of this option based on the
3324 values specified in the <tt>Makefile</tt>. If there
3325 are no objects specified for
3326 <strong>GRAFT-NEVER</strong> then this option will
3327 be silently ignored and will not appear in the help
3328 message nor in the manual page. </p>
3330 <dt> <strong>-P</strong>
3331 <dd>
3332 <p> Preserve modes and ownerships when creating new
3333 directories or copying files if
3334 <strong>PRESERVEPERMS</strong> was set to
3335 <strong>0</strong> in the <tt>Makefile</tt>. Do not
3336 preserve modes and ownerships if the option is not
3337 provided on the command line. </p>
3339 <p> Do not preserve modes and ownerships when
3340 creating new directories or copying files if
3341 <strong>PRESERVEPERMS</strong> was set to
3342 <strong>1</strong> in the <tt>Makefile</tt>.
3343 Preserve modes and ownerships if the option is not
3344 provided on the command line. </p>
3346 <p> Cannot be used with the <strong>-u</strong> option. </p>
3348 <p> This option will be silently ignored if the
3349 effective user of <em>Graft</em> is not root. </p>
3351 <p> The <em>Graft</em> manual page will correctly
3352 reflect the behaviour of this option based on the
3353 values specified in the <tt>Makefile</tt>. This
3354 option will be silently ignored and will not appear
3355 in the help message nor in the manual page if
3356 <strong>SUPERUSER</strong> was set to
3357 <strong>0</strong> in the <tt>Makefile</tt>. </p>
3359 <dt> <strong>-u</strong>
3360 <dd>
3361 <p> Superuser privileges are not required when
3362 installing packages. </p>
3364 <p> Cannot be used with the <strong>-P</strong> option. </p>
3366 <p> This option is only available if
3367 <strong>SUPERUSER</strong> was set to
3368 <strong>1</strong> in the <tt>Makefile</tt>. </p>
3370 <p> The <em>Graft</em> manual page will correctly
3371 reflect the behaviour of this option based on the
3372 values specified in the <tt>Makefile</tt>. This
3373 option will be silently ignored and will not appear
3374 in the help message nor in the manual page if
3375 <strong>SUPERUSER</strong> was set to
3376 <strong>0</strong> in the <tt>Makefile</tt>. </p>
3378 <dt> <strong>-l <em>log</em></strong>
3379 <dd>
3380 <p> Specify an alternate log file instead of the
3381 default specified by <strong>LOGFILE</strong> in the
3382 <tt>Makefile</tt>. No logging is performed if
3383 the <strong>-n</strong> option is used. </p>
3385 <p> Log entries have the form: </p>
3387 <pre>
3388 878790215 1.10+ I /usr/local/pkgs/cpio-2.4.2 /usr/local
3389 878888916 2.1 I /usr/local/pkgs/gzip-1.2.4 /usr/local
3390 878888916 2.1 IC /usr/local/pkgs/gzip-1.2.4/bin/gzip invalid symlink
3391 </pre>
3393 <p> This shows that a development version of
3394 <em>graft</em> (1.10+) was used to install
3395 symbolic links from <tt>/usr/local/pkgs/cpio-2.4.2</tt>
3396 to <tt>/usr/local</tt>. A new version of
3397 <em>graft</em> (2.1) was used to install symbolic
3398 links from <tt>/usr/local/pkgs/gzip-1.2.4</tt> to
3399 <tt>/usr/local</tt>. The <tt>IC</tt> entry indicates
3400 that a conflict occurred during this
3401 installation - the file <tt>/usr/local/pkgs/bin/gzip</tt>
3402 was a symbolic link to something other than
3403 <tt>/usr/local/pkgs/gzip-1.2.4/bin/gzip</tt>. </p>
3405 <dt> <strong>-n</strong>
3406 <dd>
3407 <p> List actions but do not perform them. Implies
3408 the very verbose option. Does not require
3409 superuser privileges regardless of the value of
3410 <strong>SUPERUSER</strong> in the <tt>Makefile</tt>. </p>
3412 <dt> <strong>-v</strong>
3413 <dd>
3414 <p> Be verbose. </p>
3416 <dt> <strong>-V</strong>
3417 <dd>
3418 <p> Be very verbose. </p>
3420 <dt> <strong>-r <em>/rootdir</em></strong>
3421 <dd>
3422 <p> Use the fully qualified named directory as the
3423 root directory for all graft operations. The source
3424 directory, target directory and log file will all
3425 be relative to this specific directory. </p>
3427 <p> Can only be used by the superuser. </p>
3429 <dt> <strong>-s</strong>
3430 <dd>
3431 <p> <em>Stow</em>/<em>Depot</em> compatibility mode.
3432 Infer the <em>Graft</em> target directory from
3433 each package installation directory in the
3434 manner of <em>Stow</em> and <em>Depot</em>. </p>
3436 <p> Target directory is the <tt>dirname</tt> of the
3437 <tt>dirname</tt> of the package installation
3438 directory. (Yes that really is two
3439 <tt>dirname</tt>s). So if the package
3440 installation directory is </p>
3442 <pre>
3443 /usr/local/depot/gzip-1.2.4
3444 </pre>
3446 <p> the package will be <em>grafted</em> into
3447 </p>
3449 <pre>
3450 /usr/local
3451 </pre>
3453 <p> Cannot be used with the <strong>-t</strong> option. </p>
3455 <dt> <strong>-t <em>target</em></strong>
3456 <dd>
3457 <p> Override the default <em>graft</em> target
3458 directory with <strong><em>target</em></strong>. The value
3459 of <strong><em>target</em></strong> must be a fully
3460 qualified directory and it must exist. </p>
3462 <p> Cannot be used with the <strong>-s</strong> option. </p>
3464 <dt> <strong>package</strong>
3465 <dd>
3466 <p> Install the named package. If <strong>package</strong> is
3467 a fully qualified directory, use it as the
3468 package installation directory. If
3469 <strong>package</strong> is not a fully qualified
3470 directory, prepend it with the value of
3471 <strong>PACKAGEDIR</strong> as specified in the
3472 <tt>Makefile</tt>. </p>
3474 </dl>
3476 <hr width="10%">
3478 <li> <p> <a name="graft-d"><strong>Delete</strong></a> </p>
3480 <pre>
3481 graft -d [-D] [-u] [-l log] [-n] [-v|V] [-r /rootdir] [-s|-t target] package(s)
3482 </pre>
3484 <dl>
3486 <dt> <strong>-d</strong>
3487 <dd>
3488 <p> Delete symbolic links from the package target
3489 directory to the package installation
3490 directory. Requires superuser privileges if
3491 <strong>SUPERUSER</strong> was set to <strong>1</strong> in the
3492 <tt>Makefile</tt>. </p>
3494 <dt> <strong>-D</strong>
3495 <dd>
3496 <p> Delete empty directories if
3497 <strong>DELETEOBJECTS</strong> was set to <strong>0</strong> in the
3498 <tt>Makefile</tt>. If the option is not
3499 provided on the command line, notify the user
3500 that a directory has been emptied. </p>
3502 <p> Do not delete empty directories if
3503 <strong>DELETEOBJECTS</strong> was set to <strong>1</strong> in the
3504 <tt>Makefile</tt>. Notify the user that a
3505 directory has been emptied. If the option is
3506 not provided on the command line, delete empty
3507 directories. </p>
3509 <p> The <em>Graft</em> manual page will correctly
3510 reflect the behaviour of this option based on the
3511 values specified in the <tt>Makefile</tt>. </p>
3513 <dt> <strong>-u</strong>
3514 <dd>
3515 <p> Superuser privileges are not required when
3516 deleting packages. </p>
3518 <p> This option is only available if
3519 <strong>SUPERUSER</strong> was set to
3520 <strong>1</strong> in the <tt>Makefile</tt>. </p>
3522 <p> The <em>Graft</em> manual page will correctly
3523 reflect the behaviour of this option based on the
3524 values specified in the <tt>Makefile</tt>. This
3525 option will be silently ignored and will not appear
3526 in the help message nor in the manual page if
3527 <strong>SUPERUSER</strong> was set to
3528 <strong>0</strong> in the <tt>Makefile</tt>. </p>
3530 <dt> <strong>-l <em>log</em></strong>
3531 <dd>
3532 <p> Specify an alternate log file instead of the
3533 default specified by <strong>LOGFILE</strong> in the
3534 <tt>Makefile</tt>. No logging is performed if
3535 the <strong>-n</strong> option is used. </p>
3537 <p> Log entries have the form: </p>
3539 <pre>
3540 879126278 1.10+ D /usr/local/pkgs/weblint-1.017 /usr/local
3541 879126278 1.10+ DC /usr/local/pkgs/weblint-1.017/bin/weblint file exists
3542 879126278 1.10+ DC /usr/local/pkgs/weblint-1.017/man/man1/weblint.1 file exists
3543 </pre>
3545 <p> This shows that a development version of
3546 <em>graft</em> (1.10+) was used to delete
3547 symbolic links from <tt>/usr/local</tt> to
3548 <tt>/usr/local/pkgs/weblint-1.017</tt>. The <tt>DC</tt>
3549 entries indicate that conflicts occurred during
3550 this action - the files
3551 <tt>/usr/local/bin/weblint</tt> and
3552 <tt>/usr/local/man/man1/weblint.1</tt> already
3553 exist. </p>
3555 <dt> <strong>-n</strong>
3556 <dd>
3557 <p> List actions but do not perform them. Implies
3558 the very verbose option. Does not require
3559 superuser privileges regardless of the value of
3560 <strong>SUPERUSER</strong> in the <tt>Makefile</tt>. </p>
3562 <dt> <strong>-v</strong>
3563 <dd>
3564 <p> Be verbose. </p>
3566 <dt> <strong>-V</strong>
3567 <dd>
3568 <p> Be very verbose. </p>
3570 <dt> <strong>-r <em>/rootdir</em></strong>
3571 <dd>
3572 <p> Use the fully qualified named directory as the
3573 root directory for all graft operations. The source
3574 directory, target directory and log file will all
3575 be relative to this specific directory. </p>
3577 <p> Can only be used by the superuser. </p>
3579 <dt> <strong>-s</strong>
3580 <dd>
3581 <p> <em>Stow</em>/<em>Depot</em> compatibility mode.
3582 Infer the <em>Graft</em> target directory from
3583 each package installation directory in the
3584 manner of <em>Stow</em> and <em>Depot</em>. </p>
3586 <p> Target directory is the <tt>dirname</tt> of the
3587 <tt>dirname</tt> of the package installation
3588 directory. (Yes that really is two
3589 <tt>dirname</tt>s). So if the package
3590 installation directory is </p>
3592 <pre>
3593 /usr/local/depot/gzip-1.2.4
3594 </pre>
3596 <p> the package will be <em>grafted</em> into
3597 </p>
3599 <pre>
3600 /usr/local
3601 </pre>
3603 <p> Cannot be used with the <strong>-t</strong> option. </p>
3605 <dt> <strong>-t <em>target</em></strong>
3606 <dd>
3607 <p> Override the default <em>graft</em> target
3608 directory with <strong><em>target</em></strong>. The value
3609 of <strong><em>target</em></strong> must be a fully
3610 qualified directory and it must exist. </p>
3612 <p> Cannot be used with the <strong>-s</strong> option. </p>
3614 <dt> <strong>package</strong>
3615 <dd>
3616 <p> Delete the named package. If <strong>package</strong> is
3617 a fully qualified directory, use it as the
3618 package installation directory. If
3619 <strong>package</strong> is not a fully qualified
3620 directory, prepend it with the value of
3621 <strong>PACKAGEDIR</strong> as specified in the
3622 <tt>Makefile</tt>. </p>
3624 </dl>
3626 <hr width="10%">
3628 <li> <p> <a name="graft-p"><strong>Prune</strong></a> </p>
3630 <pre>
3631 graft -p [-D] [-u] [-l log] [-n] [-v|V] [-r /rootdir] [-s|-t target] package(s)
3632 </pre>
3634 <dl>
3636 <dt> <strong>-p</strong>
3637 <dd>
3638 <p> Prune objects (files, links or directories)
3639 from the package target directory that are in
3640 conflict with the package installation
3641 directory. Requires superuser privileges if
3642 <strong>SUPERUSER</strong> was set to <strong>1</strong> in the
3643 <tt>Makefile</tt>. </p>
3645 <dt> <strong>-D</strong>
3646 <dd>
3647 <p> Remove conflicting objects if
3648 <strong>DELETEOBJECTS</strong> was set to <strong>0</strong> in the
3649 <tt>Makefile</tt>. Rename conflicting objects
3650 as <tt><em>object</em>.pruned</tt> if the option
3651 is not provided on the command line. </p>
3653 <p> Rename conflicting objects to
3654 <tt><em>object</em>.pruned</tt> if
3655 <strong>DELETEOBJECTS</strong> was set to <strong>1</strong> in the
3656 <tt>Makefile</tt>. Remove conflicting objects
3657 if the option is not provided in the command
3658 line. </p>
3660 <p> If a directory is to be removed and it is not
3661 empty, it will be renamed as
3662 <tt><em>dir</em>.pruned</tt> and a suitable
3663 warning message will be given regardless of the
3664 sense of this flag. </p>
3666 <p> The <em>Graft</em> manual page will correctly
3667 reflect the behaviour of this option based on the
3668 values specified in the <tt>Makefile</tt>. </p>
3670 <dt> <strong>-u</strong>
3671 <dd>
3672 <p> Superuser privileges are not required when
3673 pruning packages. </p>
3675 <p> This option is only available if
3676 <strong>SUPERUSER</strong> was set to
3677 <strong>1</strong> in the <tt>Makefile</tt>. </p>
3679 <p> The <em>Graft</em> manual page will correctly
3680 reflect the behaviour of this option based on the
3681 values specified in the <tt>Makefile</tt>. This
3682 option will be silently ignored and will not appear
3683 in the help message nor in the manual page if
3684 <strong>SUPERUSER</strong> was set to
3685 <strong>0</strong> in the <tt>Makefile</tt>. </p>
3687 <dt> <strong>-l <em>log</em></strong>
3688 <dd>
3689 <p> Specify an alternate log file instead of the
3690 default specified by <strong>LOGFILE</strong> in the
3691 <tt>Makefile</tt>. No logging is performed if
3692 the <strong>-n</strong> option is used. </p>
3694 <p> Log entries have the form: </p>
3696 <pre>
3697 879126283 1.10+ P /usr/local/pkgs/weblint-1.017 /usr/local
3698 </pre>
3700 <p> This shows that a development version of
3701 <em>graft</em> (1.10+) was used to delete objects
3702 from <tt>/usr/local</tt> that were in conflict with
3703 <tt>/usr/local/pkgs/weblint-1.017</tt>. </p>
3705 <dt> <strong>-n</strong>
3706 <dd>
3707 <p> List actions but do not perform them. Implies
3708 the very verbose option. Does not require
3709 superuser privileges regardless of the value of
3710 <strong>SUPERUSER</strong> in the <tt>Makefile</tt>. </p>
3712 <dt> <strong>-v</strong>
3713 <dd>
3714 <p> Be verbose. </p>
3716 <dt> <strong>-V</strong>
3717 <dd>
3718 <p> Be very verbose. </p>
3720 <dt> <strong>-r <em>/rootdir</em></strong>
3721 <dd>
3722 <p> Use the fully qualified named directory as the
3723 root directory for all graft operations. The source
3724 directory, target directory and log file will all
3725 be relative to this specific directory. </p>
3727 <p> Can only be used by the superuser. </p>
3729 <dt> <strong>-s</strong>
3730 <dd>
3731 <p> <em>Stow</em>/<em>Depot</em> compatibility mode.
3732 Infer the <em>Graft</em> target directory from
3733 each package installation directory in the
3734 manner of <em>Stow</em> and <em>Depot</em>. </p>
3736 <p> Target directory is the <tt>dirname</tt> of the
3737 <tt>dirname</tt> of the package installation
3738 directory. (Yes that really is two
3739 <tt>dirname</tt>s). So if the package
3740 installation directory is </p>
3742 <pre>
3743 /usr/local/depot/gzip-1.2.4
3744 </pre>
3746 <p> the package will be <em>grafted</em> into
3747 </p>
3749 <pre>
3750 /usr/local
3751 </pre>
3753 <p> Cannot be used with the <strong>-t</strong> option. </p>
3755 <dt> <strong>-t <em>target</em></strong>
3756 <dd>
3757 <p> Override the default <em>graft</em> target
3758 directory with <strong><em>target</em></strong>. The value
3759 of <strong><em>target</em></strong> must be a fully
3760 qualified directory and it must exist. </p>
3762 <p> Cannot be used with the <strong>-s</strong> option. </p>
3764 <dt> <strong>package</strong>
3765 <dd>
3766 <p> Prune the named package. If <strong>package</strong> is
3767 a fully qualified directory, use it as the
3768 package installation directory. If
3769 <strong>package</strong> is not a fully qualified
3770 directory, prepend it with the value of
3771 <strong>PACKAGEDIR</strong> as specified in the
3772 <tt>Makefile</tt>. </p>
3774 </dl>
3776 <li> <p> <a name="graft-L"><strong>Information</strong></a> </p>
3778 <pre>
3779 graft -L
3780 </pre>
3782 <dl>
3784 <dt> <strong>-L</strong>
3785 <dd>
3786 <p> This is a special mode and it overrides all
3787 other command line arguments. When present
3788 <strong>graft</strong> will display the
3789 <strong>default</strong> locations for Perl, the
3790 graft log file, the target directory, and the
3791 package directory in a form suitable for creating
3792 environment variables for Bourne like shells. The
3793 output will appear on <strong>STDOUT</strong> as
3794 follows: </p>
3796 <pre>
3797 GRAFT_PERL=/usr/bin/perl
3798 GRAFT_LOGFILE=/var/log/graft
3799 GRAFT_TARGETDIR=/usr/local
3800 GRAFT_PACKAGEDIR=/usr/local/pkgs
3801 </pre>
3803 <p> You can set these environment variables using
3804 one of the following methods. </p>
3806 <pre>
3807 eval "$(graft -L)" # modern shells such as bash, zsh etc
3808 eval "`graft -L`" # older shells such as sh etc
3809 </pre>
3811 </dl>
3813 </ol>
3815 <hr width="25%">
3817 <h3><a name="testing">Testing the <em>Graft</em> Installation</a></h3>
3819 <p> Before creating the symbolic links from the target directory to
3820 the package directory, you may wish to see what actions <em>Graft</em>
3821 will perform. Execute the following command: </p>
3823 <pre>
3824 graft -i -n <em>package-name</em>
3825 </pre>
3827 <p> The <tt>-i</tt> option tells <em>Graft</em> to install the package and
3828 the <tt>-n</tt> option tells <em>Graft</em> to report on its actions
3829 without actually performing them. The default <em>Graft</em> target
3830 directory will be used and the package installation directory will be
3831 taken from the fully qualified package argument or the default value
3832 will be prepended to the package argument if it is not fully qualified.
3833 </p>
3835 <p> <em>Graft</em> will report on the following actions: </p>
3837 <ul>
3839 <li> <p> Installing links to <em>package-location</em> in
3840 <em>package-target</em> </p>
3842 <p> Indicates the real package location and its <em>grafted</em>
3843 target. </p>
3845 <li> <p> Processing <em>package-directory</em> </p>
3847 <p> Indicates which package directory is being processed. </p>
3849 <li> <p> MKDIR <em>dirname</em> </p>
3851 <p> This destination directory will be created. </p>
3853 <li> <p> SYMLINK <em>dest-package-file</em> -&gt; <em>package-file</em>
3854 </p>
3856 <p> This symbolic link will be created. </p>
3858 <li> <p> NOP <em>string</em> </p>
3860 <p> No action was necessary for this package object. </p>
3862 <li> <p> BYPASS <em>dirname</em> - .nograft file found</p>
3864 <p> This directory contains a file called <tt>.nograft</tt> so its
3865 contents and any subdirectories will be bypassed by
3866 <em>Graft</em>. </p>
3868 <li> <p> READING include file
3869 <em>package-dir</em><tt>/.graft-include</tt> </p>
3871 <p> The directory currently being processed by <em>Graft</em>
3872 contains a file called <tt>.graft-include</tt> which contains
3873 a list of file and/or directory names from the directory that
3874 should only be <em>grafted</em>. The contents of this file are
3875 being read by <em>Graft</em>. </p>
3877 <li> <p> INCLUDE file <em>package-file</em> - listed in
3878 <em>package-dir</em><tt>/.graft-include</tt> </p>
3880 <p> The file name mentioned in this message appears in the
3881 <em>.graft-include</em> file and the file exists in the directory
3882 currently being processed. It will be <tt>grafted</tt>. </p>
3884 <li> <p> IGNORE file <em>package-file</em> - not listed in
3885 <em>package-dir</em><tt>/.graft-include</tt> </p>
3887 <p> The file name mentioned in this message does not appear in the
3888 <em>.graft-include</em> file and the file exists in the directory
3889 currently being processed. It will not be <tt>grafted</tt>. </p>
3891 <li> <p> INCLUDE directory <em>package-directory</em> - listed in
3892 <em>package-dir</em><tt>/.graft-include</tt> </p>
3894 <p> The directory name mentioned in this message appears
3895 in the <em>.graft-include</em> file and the directory exists
3896 in the directory currently being processed. It will be
3897 <tt>grafted</tt>. </p>
3899 <li> <p> IGNORE directory <em>package-file</em> - not listed in
3900 <em>package-dir</em><tt>/.graft-include</tt> </p>
3902 <p> The directory name mentioned in this message does not
3903 appear in the <em>.graft-include</em> file and the directory
3904 exists in the directory currently being processed. It will not
3905 be <tt>grafted</tt>. </p>
3907 <li> <p> READING exclude file
3908 <em>package-dir</em><tt>/.graft-exclude</tt> </p>
3910 <p> The directory currently being processed by <em>Graft</em>
3911 contains a file called <tt>.graft-exclude</tt> which contains
3912 a list of file and/or directory names from the directory that
3913 should not be <em>grafted</em>. The contents of this file are
3914 being read by <em>Graft</em>. </p>
3916 <li> <p> IGNORE include file
3917 <em>package-dir</em><tt>/.graft-include</tt>, overridden by exclude
3918 file <em>package-dir</em><tt>/.graft-exclude</tt> </p>
3920 <p> The directory currently being processed by <em>Graft</em>
3921 contains a file called <tt>.graft-exclude</tt> as well as a file
3922 called <tt>.graft-include</tt>. The <tt>.graft-exclude</tt>
3923 file takes precedence over the <tt>.graft-include</tt> file,
3924 so the latter file will be ignored. </p>
3926 <li> <p> EXCLUDE file <em>package-file</em> - listed in
3927 <em>package-dir</em><tt>/.graft-exclude</tt> </p>
3929 <p> The file name mentioned in this message appears in the
3930 <em>.graft-exclude</em> file and the file exists in the directory
3931 currently being processed. It will not be <tt>grafted</tt>. </p>
3933 <li> <p> EXCLUDE directory <em>package-directory</em> - listed in
3934 <em>package-dir</em><tt>/.graft-exclude</tt> </p>
3936 <p> The directory name mentioned in this message appears
3937 in the <em>.graft-exclude</em> file and the directory exists
3938 in the directory currently being processed. It will not be
3939 <tt>grafted</tt>. </p>
3941 <li> <p> CONFLICT <em>message</em> </p>
3943 <p> <em>Graft</em> could not successfully process a package object.
3944 One of the following conditions was encountered: </p>
3946 <ul>
3948 <li> The package object is a directory and the
3949 target object exists but it not a directory.
3951 <li> The package object is not a directory and the
3952 target object exists and is not a symbolic
3953 link.
3955 <li> The package object is not a directory and the
3956 target object exists and is a symbolic link to
3957 something other than the package object.
3959 </ul>
3961 <p> Conflicts are ALWAYS reported on standard error. If you wish
3962 to see if the installation of a package will have any
3963 conflicts, you can execute: </p>
3965 <pre>
3966 graft -i -n <em>package-name</em> &gt; /dev/null
3967 </pre>
3969 <p> Only <tt>CONFLICT</tt> messages will be displayed. If nothing
3970 is displayed then you can safely conclude that this package
3971 can be installed using <em>Graft</em> without any conflicts.
3972 </p>
3974 </ul>
3976 <p> If you were to test the installation of the <em>kermit-5A190</em>
3977 package you would execute the command: </p>
3979 <pre>
3980 graft -i -n kermit-5A190
3981 </pre>
3983 You should see output resembling:
3985 <pre>
3986 Installing links to /usr/local/pkgs/kermit-5A190 in /usr/local
3987 Processing /usr/local/pkgs/kermit-5A190
3988 SYMLINK /usr/local/README -&gt; /usr/local/pkgs/kermit-5A190/README
3989 NOP /usr/local/pkgs/kermit-5A190/bin and /usr/local/bin are both directories
3990 Processing /usr/local/pkgs/kermit-5A190/bin
3991 SYMLINK /usr/local/bin/kermit -&gt; /usr/local/pkgs/kermit-5A190/bin/kermit
3992 SYMLINK /usr/local/bin/wart -&gt; /usr/local/pkgs/kermit-5A190/bin/wart
3993 NOP /usr/local/pkgs/kermit-5A190/man and /usr/local/man are both directories
3994 Processing /usr/local/pkgs/kermit-5A190/man
3995 NOP /usr/local/pkgs/kermit-5A190/man/man1 and /usr/local/man/man1 are both directories
3996 Processing /usr/local/pkgs/kermit-5A190/man/man1
3997 SYMLINK /usr/local/man/man1/kermit.1 -&gt; /usr/local/pkgs/kermit-5A190/man/man1/kermit.1
3998 MKDIR /usr/local/doc
3999 Processing /usr/local/pkgs/kermit-5A190/doc
4000 SYMLINK /usr/local/doc/ckccfg.doc -&gt; /usr/local/pkgs/kermit-5A190/doc/ckccfg.doc
4001 SYMLINK /usr/local/doc/ckuins.doc -&gt; /usr/local/pkgs/kermit-5A190/doc/ckuins.doc
4002 SYMLINK /usr/local/doc/ckc190.upd -&gt; /usr/local/pkgs/kermit-5A190/doc/ckc190.upd
4003 SYMLINK /usr/local/doc/ckcker.upd -&gt; /usr/local/pkgs/kermit-5A190/doc/ckcker.upd
4004 SYMLINK /usr/local/doc/ckaaaa.hlp -&gt; /usr/local/pkgs/kermit-5A190/doc/ckaaaa.hlp
4005 SYMLINK /usr/local/doc/ckuaaa.hlp -&gt; /usr/local/pkgs/kermit-5A190/doc/ckuaaa.hlp
4006 NOP /usr/local/pkgs/kermit-5A190/lib and /usr/local/lib are both directories
4007 Processing /usr/local/pkgs/kermit-5A190/lib
4008 SYMLINK /usr/local/lib/ckedemo.ini -&gt; /usr/local/pkgs/kermit-5A190/lib/ckedemo.ini
4009 SYMLINK /usr/local/lib/ckeracu.ini -&gt; /usr/local/pkgs/kermit-5A190/lib/ckeracu.ini
4010 SYMLINK /usr/local/lib/ckermit.ini -&gt; /usr/local/pkgs/kermit-5A190/lib/ckermit.ini
4011 SYMLINK /usr/local/lib/ckermod.ini -&gt; /usr/local/pkgs/kermit-5A190/lib/ckermod.ini
4012 SYMLINK /usr/local/lib/cketest.ini -&gt; /usr/local/pkgs/kermit-5A190/lib/cketest.ini
4013 SYMLINK /usr/local/lib/ckevt.ini -&gt; /usr/local/pkgs/kermit-5A190/lib/ckevt.ini
4014 SYMLINK /usr/local/lib/ckurzsz.ini -&gt; /usr/local/pkgs/kermit-5A190/lib/ckurzsz.ini
4015 </pre>
4017 <p> This output shows you that most of the directories already exist
4018 (indicated by the <tt>NOP</tt> flags). A symbolic link will be created
4019 in the relevant target directory to each of the files in the
4020 <em>kermit-5A190</em> package. One directory exists in the
4021 <em>kermit-5A190</em> package that does not exist in the target -
4022 <tt>doc</tt>. This directory will be created by <em>Graft</em>. </p>
4024 <p> <strong>NOTE</strong>: If you are using the <em>automounter</em> you may not be
4025 able to create the directory <tt>/usr/local/doc</tt>. You'll have to create
4026 the directory on the NFS server under the file system in which it
4027 really lives. You should be familiar with the peculiarities of the
4028 <em>automounter</em> and your specific site configuration before creating
4029 any directories directly under mount points used by the
4030 <em>automounter</em>. </p>
4032 <hr width="25%">
4034 <h3><a name="installing-packages">Installing Packages</a></h3>
4036 <p> Once you have ensured that <em>Graft</em> will perform the correct
4037 actions, you can execute: </p>
4039 <pre>
4040 graft -i <em>package-name</em>
4041 </pre>
4043 <p> So to install <em>kermit</em> you would execute: </p>
4045 <pre>
4046 graft -i kermit-5A190
4047 </pre>
4049 <p> There will be no output from <em>Graft</em> unless it encounters a
4050 conflict. If you wish to see more information you can specify one of
4051 the verbose flags. For a minimum of output you can execute: </p>
4053 <pre>
4054 graft -i -v kermit-5A190
4055 </pre>
4057 <p> You should see the following output: </p>
4059 <pre>
4060 Processing /usr/local/pkgs/kermit-5A190
4061 Processing /usr/local/pkgs/kermit-5A190/bin
4062 Processing /usr/local/pkgs/kermit-5A190/man
4063 Processing /usr/local/pkgs/kermit-5A190/man/man1
4064 Processing /usr/local/pkgs/kermit-5A190/doc
4065 Processing /usr/local/pkgs/kermit-5A190/lib
4066 </pre>
4068 <p> If you choose the very verbose option by executing: </p>
4070 <pre>
4071 graft -i -V kermit-5A190
4072 </pre>
4074 <p> the output will be the same as that when the <tt>-n</tt> option was
4075 used, however this time <em>Graft</em> will actually create the symbolic
4076 links. </p>
4078 <pre>
4079 Installing links to /usr/local/pkgs/kermit-5A190 in /usr/local
4080 Processing /usr/local/pkgs/kermit-5A190
4081 SYMLINK /usr/local/README -&gt; /usr/local/pkgs/kermit-5A190/README
4082 NOP /usr/local/pkgs/kermit-5A190/bin and /usr/local/bin are both directories
4083 Processing /usr/local/pkgs/kermit-5A190/bin
4084 SYMLINK /usr/local/bin/kermit -&gt; /usr/local/pkgs/kermit-5A190/bin/kermit
4085 SYMLINK /usr/local/bin/wart -&gt; /usr/local/pkgs/kermit-5A190/bin/wart
4086 NOP /usr/local/pkgs/kermit-5A190/man and /usr/local/man are both directories
4087 Processing /usr/local/pkgs/kermit-5A190/man
4088 NOP /usr/local/pkgs/kermit-5A190/man/man1 and /usr/local/man/man1 are both directories
4089 Processing /usr/local/pkgs/kermit-5A190/man/man1
4090 SYMLINK /usr/local/man/man1/kermit.1 -&gt; /usr/local/pkgs/kermit-5A190/man/man1/kermit.1
4091 NOP /usr/local/pkgs/kermit-5A190/doc and /usr/local/doc are both directories
4092 Processing /usr/local/pkgs/kermit-5A190/doc
4093 SYMLINK /usr/local/doc/ckccfg.doc -&gt; /usr/local/pkgs/kermit-5A190/doc/ckccfg.doc
4094 SYMLINK /usr/local/doc/ckuins.doc -&gt; /usr/local/pkgs/kermit-5A190/doc/ckuins.doc
4095 SYMLINK /usr/local/doc/ckc190.upd -&gt; /usr/local/pkgs/kermit-5A190/doc/ckc190.upd
4096 SYMLINK /usr/local/doc/ckcker.upd -&gt; /usr/local/pkgs/kermit-5A190/doc/ckcker.upd
4097 SYMLINK /usr/local/doc/ckaaaa.hlp -&gt; /usr/local/pkgs/kermit-5A190/doc/ckaaaa.hlp
4098 SYMLINK /usr/local/doc/ckuaaa.hlp -&gt; /usr/local/pkgs/kermit-5A190/doc/ckuaaa.hlp
4099 NOP /usr/local/pkgs/kermit-5A190/lib and /usr/local/lib are both directories
4100 Processing /usr/local/pkgs/kermit-5A190/lib
4101 SYMLINK /usr/local/lib/ckedemo.ini -&gt; /usr/local/pkgs/kermit-5A190/lib/ckedemo.ini
4102 SYMLINK /usr/local/lib/ckeracu.ini -&gt; /usr/local/pkgs/kermit-5A190/lib/ckeracu.ini
4103 SYMLINK /usr/local/lib/ckermit.ini -&gt; /usr/local/pkgs/kermit-5A190/lib/ckermit.ini
4104 SYMLINK /usr/local/lib/ckermod.ini -&gt; /usr/local/pkgs/kermit-5A190/lib/ckermod.ini
4105 SYMLINK /usr/local/lib/cketest.ini -&gt; /usr/local/pkgs/kermit-5A190/lib/cketest.ini
4106 SYMLINK /usr/local/lib/ckevt.ini -&gt; /usr/local/pkgs/kermit-5A190/lib/ckevt.ini
4107 SYMLINK /usr/local/lib/ckurzsz.ini -&gt; /usr/local/pkgs/kermit-5A190/lib/ckurzsz.ini
4108 </pre>
4110 <p> <strong>NOTE</strong>: In this case the <tt>/usr/local/doc</tt> directory was not
4111 created by <em>Graft</em> because <tt>/usr/local</tt> is a mount point
4112 controlled by the <em>automounter</em>. The <tt>doc</tt> directory was
4113 created manually prior to executing <em>Graft</em>. </p>
4115 <hr width="25%">
4117 <h3><a name="bypass">Bypassing package directories</a></h3>
4119 <p> You may have the need to place only part of a package under the control
4120 of <em>Graft</em>. Examples of such occasions may be: </p>
4122 <ul>
4124 <li> <p> The contents of one package conflict with another package.
4125 For example <tt>/usr/local/pkgs/gcc-2.7.2.1/lib/libiberty.a</tt> and
4126 <tt>/usr/local/pkgs/gdb-4.16/lib/libiberty.a</tt>. </p>
4128 <li> <p> A package directory is obviously the exclusive domain of
4129 the package and no benefit will be gained by creating symbolic
4130 links to its files. For example
4131 <tt>/usr/local/pkgs/perl-5.18.2/lib/perl5</tt>. </p>
4133 <p> <strong>NOTE</strong>: This will ONLY work if you originally compiled and
4134 installed the package such that it refers to its files by their
4135 '<em>real</em>' pathnames and NOT by the virtual pathnames
4136 provided by <em>Graft</em>. </p>
4138 </ul>
4140 <p> You can force <em>Graft</em> to bypass a directory by creating the file </p>
4142 <pre>
4143 <em>package-name/dir/dir/</em>.nograft
4144 </pre>
4146 <p> Using the second example above, if you were to create the file: </p>
4148 <pre>
4149 /usr/local/pkgs/perl-5.18.2/lib/perl5/.nograft
4150 </pre>
4152 <p> <em>Graft</em> would create directories and symbolic links for every file
4153 and directory down to <tt>/usr/local/pkgs/perl-5.18.2/lib</tt>. The <tt>perl5</tt>
4154 directory and anything below it would not be created. </p>
4156 <hr width="25%">
4158 <h3><a name="include">Including specific files and/or directories</a></h3>
4160 <p> There may be the occasional need to include specific files and/or
4161 directories in a directory, rather than the entire directory tree itself. An
4162 example of such an occurrence would be the case where a package
4163 contains a number of subdirectories, only one of which is required to
4164 be <em>grafted</em>. </p>
4166 <p> You can force <em>Graft</em> to only include any number of files and/or
4167 directories in a package directory by creating the file </p>
4169 <pre>
4170 .graft-include
4171 </pre>
4173 <p> in the same directory. </p>
4175 <p> <tt>.graft-include</tt> will contain a list of file and/or directory names
4176 - one per line - of the files and/or directories you wish to include. </p>
4178 <p> Consider the <em>a2ps</em> package for example. When installed it
4179 contains the following directories: </p>
4181 <pre>
4182 /usr/local/pkgs/a2ps-4.13b/bin
4183 /usr/local/pkgs/a2ps-4.13b/etc
4184 /usr/local/pkgs/a2ps-4.13b/include
4185 /usr/local/pkgs/a2ps-4.13b/info
4186 /usr/local/pkgs/a2ps-4.13b/lib
4187 /usr/local/pkgs/a2ps-4.13b/man
4188 /usr/local/pkgs/a2ps-4.13b/share
4189 </pre>
4191 <p> The only directory you wish to <em>graft</em> is the <tt>bin</tt>
4192 directory. You could place a <tt>.nograft</tt> file in each of the other
4193 directories, <strong>OR</strong> you could create a single <tt>.graft-include</tt>
4194 file in <tt>/usr/local/pkgs/a2ps-4.13b/.graft-include</tt>. This file would
4195 contain </p>
4197 <pre>
4199 </pre>
4201 <p> Now only the <tt>bin</tt> directory will be <em>grafted</em>. </p>
4203 <hr width="25%">
4205 <h3><a name="exclude">Excluding specific files and/or directories</a></h3>
4207 <p> There may be the occasional need to exclude specific files and/or
4208 directories from a directory, rather than the entire directory itself. An
4209 example of such an occurrence would be the case where files from different
4210 packages have the same name. <em>Emacs</em> and <em>Xemacs</em> use the same
4211 names for a number of their configuration files for example. </p>
4213 <p> You can force <em>Graft</em> to exclude any number of files and/or
4214 directories from a package directory by creating the file </p>
4216 <pre>
4217 .graft-exclude
4218 </pre>
4220 <p> in the same directory. </p>
4222 <p> <tt>.graft-exclude</tt> will contain a list of file and/or directory names
4223 - one per line - of the files and/or directories you wish to exclude. </p>
4225 <p> For example, if you did not wish the file </p>
4227 <pre>
4228 /usr/local/pkgs/sudo-1.5.3/etc/sudoers
4229 </pre>
4231 <p> to be <em>grafted</em> as </p>
4233 <pre>
4234 /usr/local/etc/sudoers
4235 </pre>
4237 <p> but you did want </p>
4239 <pre>
4240 /usr/local/pkgs/sudo-1.5.3/etc/visudo
4241 </pre>
4243 <p> to be <em>grafted</em> as </p>
4245 <pre>
4246 /usr/local/etc/visudo
4247 </pre>
4249 <p> you would create the file </p>
4251 <pre>
4252 /usr/local/pkgs/sudo-1.5.3/etc/.graft-exclude
4253 </pre>
4255 <p> and ensure its contents contained the line: </p>
4257 <pre>
4258 sudoers
4259 </pre>
4261 <p> <strong>NOTE:</strong> Any entries made in a <tt>.graft-exclude</tt> file will
4262 override the same entries made in a <tt>.graft-include</tt> file. That is,
4263 if a file or directory name is listen in both a <tt>.graft-exclude</tt>
4264 and a <tt>.graft-include</tt> file, it will be <strong>excluded</strong> from the
4265 <em>graft</em>. </p>
4267 <hr width="25%">
4269 <h3><a name="config_dirs">Grafting configuration files</a></h3>
4271 <p> Beginning with <em>Graft</em> 2.11 there is now the ability to treat a
4272 package directory as a repository for configuration files. In this case you
4273 would place a <tt>.graft-config</tt> file in the package directory and any
4274 files in that directory would be <strong>copied</strong> to the target
4275 directory. Files in conflict would also be copied but would have a default
4276 suffix of <em>.new</em> to ensure the existing file is not clobbered.
4277 Conflict discovery is achieved using a simple 32-bit CRC check. This
4278 feature has been added to assist operating system distributors manage
4279 system configuration files, specifically it was added at the request of the
4280 maintainer of the <a href="http://www.dragora.org/">Dragora GNU/Linux</a>
4281 distribution. </p>
4283 <p> Consider the following example. You may wish to upgrade the
4284 <em>openssh</em> server as part of an upgrade to your distribution. In
4285 order to preserve any local user modifications to the relevant
4286 configuration files you would add a <tt>.graft-config</tt> file to the
4287 package as follows: </p>
4289 <pre>
4290 /usr/local/pkgs/openssh-server-6.61/etc/default/.graft-config
4291 /usr/local/pkgs/openssh-server-6.61/etc/init.d/.graft-config
4292 /usr/local/pkgs/openssh-server-6.61/etc/init/.graft-config
4293 /usr/local/pkgs/openssh-server-6.61/etc/network/if-up.d/.graft-config
4294 /usr/local/pkgs/openssh-server-6.61/etc/pam.d/.graft-config
4295 /usr/local/pkgs/openssh-server-6.61/etc/ufw/applications.d/.graft-config
4296 /usr/local/pkgs/openssh-server-6.61/lib/systemd/system/.graft-config
4297 </pre>
4299 <p> The other directories in the distribution would not require any control
4300 files. </p>
4302 <p> Imagine that the local administrator has made some changes to
4303 <tt>/etc/pam.d/sshd</tt> such as adding additional authentication methods
4304 to support two-factor authentication for example. As the distribution
4305 maintainer you do not want to reverse this local change so when the local
4306 administrator upgrades the distribution, <em>Graft</em>
4307 <strong>copies</strong> the new <tt>/etc/pam.d/sshd</tt> file to
4308 <tt>/etc/pam.d/sshd.new</tt> which allows the local administrator to merge
4309 their changes with any new features supported by the upgrade. </p>
4311 <p> To take full advantage of this feature you may need to explicitly set the
4312 target directory as follows: </p>
4314 <pre>
4315 graft -i -t / openssh-server-6.61
4316 </pre>
4318 <hr width="25%">
4320 <h3><a name="partial-graft">Grafting part of a package</a></h3>
4322 <p> Some packages can be successfully used when only part of their
4323 installation directory is <em>grafted</em>. Other packages are
4324 recalcitrant and need some special hand holding which can only be
4325 solved by <em>grafting</em> each section of the package separately. </p>
4327 <p> The first scenario can be handled by either <tt>.nograft</tt> files or
4328 partial <em>grafts</em>. Consider <em>Perl</em> version <em>5.18.2</em>.
4329 When installed in its own directory </p>
4331 <pre>
4332 /usr/local/pkgs/perl-5.18.2
4333 </pre>
4335 <p> there are three subdirectories </p>
4337 <pre>
4338 drwxr-sr-x 2 psamuel bisg 512 Oct 30 1996 bin
4339 drwxr-sr-x 3 psamuel bisg 512 Oct 30 1996 lib
4340 drwxr-sr-x 4 psamuel bisg 512 Oct 30 1996 man
4341 </pre>
4343 <p> Everything in the <tt>lib</tt> directory is exclusive to <em>Perl</em>
4344 and does not require <em>grafting</em>. Therefore, <em>perl-5.18.2</em> can
4345 be <em>grafted</em> using either of the following two methods: </p>
4347 <pre>
4348 touch /usr/local/pkgs/perl-5.18.2/lib/.nograft
4349 graft -i perl-5.18.2
4350 </pre>
4354 <pre>
4355 graft -it /usr/local/bin perl-5.18.2/bin
4356 graft -it /usr/local/man perl-5.18.2/man
4357 </pre>
4359 <p> Now let's consider a recalcitrant package - <em>ObjectStore</em> version
4360 4.0.2.a.0. When installed in </p>
4362 <pre>
4363 /usr/local/pkgs/ostore-4.0.2.a.0
4364 </pre>
4366 <p> the following files and directories are available: </p>
4368 <pre>
4369 -rwxrwxr-x 1 pauln one3 1089 Oct 31 1996 Copyright
4370 drwxrwxrwx 8 pauln one3 512 Oct 2 1996 common
4371 drwxrwxrwx 6 pauln one3 512 Oct 31 1996 sunpro
4372 -rw-r----- 1 root one3 1900544 Apr 29 1997 txn.log
4373 </pre>
4375 <p> The executable programs that need to be <em>grafted</em> are in
4376 <tt>sunpro/bin</tt> and the manual pages that need to be <em>grafted</em>
4377 are in <tt>common/man</tt>. Everything else in the package does not
4378 need to be <em>grafted</em>. If the entire package was to be
4379 <em>grafted</em> the result would be two directories that are not in the
4380 regular <strong>$PATH</strong> and <strong>$MANPATH</strong> environment variables - namely
4381 <tt>/usr/local/common/man</tt> and <tt>/usr/local/sunpro/bin</tt>, plus a host of
4382 other directories that are not relevant for <em>grafting</em>. No amount
4383 of <tt>.nograft</tt> and <tt>.graft-exclude</tt> juggling will solve
4384 this problem. </p>
4386 <p> The solution is to use two partial <em>grafts</em>: </p>
4388 <pre>
4389 graft -it /usr/local/bin ostore-4.0.2.a.0/sunpro/bin
4390 graft -it /usr/local/man ostore-4.0.2.a.0/common/bin
4391 </pre>
4393 <p> Using this approach, the correct executables and manual pages are
4394 available without the need to <em>graft</em> unnecessary files and
4395 directories. </p>
4397 <hr width="25%">
4399 <h3><a name="deleting-packages">Deleting and/or Upgrading
4400 Packages</a></h3>
4402 <p> If you wish to upgrade a package - let's assume you wish to upgrade
4403 <em>kermit</em> from version 5A190 to version 6.0.192 - you'd follow
4404 these steps. </p>
4406 <p> Firstly, you'd compile and install <em>kermit-6.0.192</em> in </p>
4408 <pre>
4409 /usr/local/pkgs/kermit-6.0.192
4410 </pre>
4412 <p> Once you'd tested it to your satisfaction, you'd need to delete the
4413 symbolic links to the current <em>grafted</em> version. You can check
4414 which actions <em>Graft</em> will perform by executing: </p>
4416 <pre>
4417 graft -d -n kermit-5A190
4418 </pre>
4420 <p> You'll see output similar to </p>
4422 <pre>
4423 Uninstalling links from /usr/local to /usr/local/pkgs/kermit-5A190
4424 Processing /usr/local/pkgs/kermit-5A190
4425 Processing /usr/local/pkgs/kermit-5A190/bin
4426 UNLINK /usr/local/bin/kermit
4427 UNLINK /usr/local/bin/wart
4428 Processing /usr/local/pkgs/kermit-5A190/man
4429 Processing /usr/local/pkgs/kermit-5A190/man/man1
4430 UNLINK /usr/local/man/man1/kermit.1
4431 Processing /usr/local/pkgs/kermit-5A190/doc
4432 UNLINK /usr/local/doc/ckccfg.doc
4433 UNLINK /usr/local/doc/ckuins.doc
4434 UNLINK /usr/local/doc/ckc190.upd
4435 UNLINK /usr/local/doc/ckcker.upd
4436 UNLINK /usr/local/doc/ckaaaa.hlp
4437 UNLINK /usr/local/doc/ckuaaa.hlp
4438 Processing /usr/local/pkgs/kermit-5A190/lib
4439 UNLINK /usr/local/lib/ckedemo.ini
4440 UNLINK /usr/local/lib/ckeracu.ini
4441 UNLINK /usr/local/lib/ckermit.ini
4442 UNLINK /usr/local/lib/ckermod.ini
4443 UNLINK /usr/local/lib/cketest.ini
4444 UNLINK /usr/local/lib/ckevt.ini
4445 UNLINK /usr/local/lib/ckurzsz.ini
4446 UNLINK /usr/local/lib/.testing
4447 </pre>
4449 <p> If you're happy with the output from the test deletion you can delete
4450 the <em>grafted</em> package. Once again, you'll only see output if a
4451 failure occurs unless you use one of the verbose options. </p>
4453 <p> If you execute: </p>
4455 <pre>
4456 graft -dV kermit-5A190
4457 </pre>
4459 <p> you'll see: </p>
4461 <pre>
4462 Uninstalling links from /usr/local to /usr/local/pkgs/kermit-5A190
4463 Processing /usr/local/pkgs/kermit-5A190
4464 Processing /usr/local/pkgs/kermit-5A190/bin
4465 UNLINK /usr/local/bin/kermit
4466 UNLINK /usr/local/bin/wart
4467 Processing /usr/local/pkgs/kermit-5A190/man
4468 Processing /usr/local/pkgs/kermit-5A190/man/man1
4469 UNLINK /usr/local/man/man1/kermit.1
4470 Processing /usr/local/pkgs/kermit-5A190/doc
4471 UNLINK /usr/local/doc/ckccfg.doc
4472 UNLINK /usr/local/doc/ckuins.doc
4473 UNLINK /usr/local/doc/ckc190.upd
4474 UNLINK /usr/local/doc/ckcker.upd
4475 UNLINK /usr/local/doc/ckaaaa.hlp
4476 UNLINK /usr/local/doc/ckuaaa.hlp
4477 EMPTY /usr/local/doc is now empty. Delete manually if necessary.
4478 Processing /usr/local/pkgs/kermit-5A190/lib
4479 UNLINK /usr/local/lib/ckedemo.ini
4480 UNLINK /usr/local/lib/ckeracu.ini
4481 UNLINK /usr/local/lib/ckermit.ini
4482 UNLINK /usr/local/lib/ckermod.ini
4483 UNLINK /usr/local/lib/cketest.ini
4484 UNLINK /usr/local/lib/ckevt.ini
4485 UNLINK /usr/local/lib/ckurzsz.ini
4486 </pre>
4488 <p> <strong>NOTE</strong>: In this case the existence of an empty directory has been
4489 discovered. If <em>Graft</em> empties a directory during a package
4490 deletion, it will either notify you or delete the directory depending
4491 on the combination of variables in the <tt>Makefile</tt> and command
4492 line options. It's probably better practise not to automatically
4493 delete empty directories as they may be used by other packages - such
4494 as lock file directories for example. </p>
4496 <p> Now you can remove the <em>real</em> package contents. (You may not wish
4497 to do this immediately as some legacy systems may depend on features
4498 provided by the older version or you may feel the need for further
4499 testing before feeling confident that the old version can be removed):
4500 </p>
4502 <pre>
4503 rm -rf /usr/local/pkgs/kermit-5A190
4504 </pre>
4506 <p> Now you can <em>graft</em> the new version of <em>kermit</em>. Execute: </p>
4508 <pre>
4509 graft -i -n kermit-6.0.192
4510 </pre>
4512 <p> to ensure that the <em>grafting</em> will proceed without error. Once
4513 you are satisfied that this is the case you can <em>graft</em> the new
4514 package by executing: </p>
4516 <pre>
4517 graft -i kermit-6.0.192
4518 </pre>
4520 <hr width="25%">
4522 <h3><a name="transitioning">Transitioning a package to <em>Graft</em>
4523 control</a></h3>
4525 <p> <em>Graft</em> can be used to easily transition a package from its
4526 current installation in your target directory to a <em>grafted</em>
4527 installation. </p>
4529 <p> As an example, let's consider the package <em>weblint</em> version 1.017.
4530 It consists of three files installed in: </p>
4532 <pre>
4533 /usr/local/bin/weblint
4534 /usr/local/lib/global.weblintrc
4535 /usr/local/man/man1/weblint.1
4536 </pre>
4538 <p> The first step is to create a new copy of the package in its own
4539 directory: </p>
4541 <pre>
4542 /usr/local/pkgs/weblint-1.017
4543 </pre>
4545 <p> Ensure that any references to library files are now made to
4546 <tt>/usr/local/pkgs/weblint-1.017/lib</tt> instead of <tt>/usr/local/lib</tt>.
4547 </p>
4549 <p> Test the new installation to ensure it behaves as expected. </p>
4551 <p> Then prune the old files from <tt>/usr/local/*</tt> using: </p>
4553 <pre>
4554 graft -pV weblint-1.017
4555 </pre>
4557 <p> You'd expect to see output similar to: </p>
4559 <pre>
4560 Pruning files in /usr/local which conflict with /usr/local/pkgs/weblint-1.017
4561 Processing /usr/local/pkgs/weblint-1.017
4562 Processing /usr/local/pkgs/weblint-1.017/man
4563 Processing /usr/local/pkgs/weblint-1.017/man/man1
4564 RENAME /usr/local/man/man1/weblint.1
4565 Processing /usr/local/pkgs/weblint-1.017/bin
4566 RENAME /usr/local/bin/weblint
4567 Processing /usr/local/pkgs/weblint-1.017/lib
4568 RENAME /usr/local/lib/global.weblintrc
4569 </pre>
4571 <p> If you elected to delete conflicting files instead of renaming them
4572 you'd use: </p>
4574 <pre>
4575 graft -pDV weblint-1.017
4576 </pre>
4578 <p> and you'd see output similar to: </p>
4580 <pre>
4581 Pruning files in /usr/local which conflict with /usr/local/pkgs/weblint-1.017
4582 Processing /usr/local/pkgs/weblint-1.017
4583 Processing /usr/local/pkgs/weblint-1.017/man
4584 Processing /usr/local/pkgs/weblint-1.017/man/man1
4585 UNLINK /usr/local/man/man1/weblint.1
4586 Processing /usr/local/pkgs/weblint-1.017/bin
4587 UNLINK /usr/local/bin/weblint
4588 Processing /usr/local/pkgs/weblint-1.017/lib
4589 UNLINK /usr/local/lib/global.weblintrc
4590 </pre>
4592 <p> Now the new version of <em>weblint</em> 1.017 can be <em>grafted</em> in
4593 place: </p>
4595 <pre>
4596 graft -i weblint-1.017
4597 </pre>
4599 <p> The <em>grafted</em> version of <em>weblint</em> can now be tested. </p>
4601 <p> If we renamed conflicting files, they can be removed once the
4602 <em>grafted</em> <em>weblint</em> has been satisfactorily tested: </p>
4604 <pre>
4605 rm /usr/local/man/man1/weblint.1.pruned
4606 rm /usr/local/bin/weblint.pruned
4607 rm /usr/local/lib/global.weblintrc.pruned
4608 </pre>
4610 <hr width="25%">
4612 <h3><a name="conflicts">Conflict Processing</a></h3>
4614 <p> Occasionally <em>Graft</em> will fail to completely install a package. This
4615 occurs because <em>Graft</em> encounters a conflict. A conflict is defined as
4616 one of the following possibilities: </p>
4618 <center>
4619 <table summary="Conflcits" border=2 cellpadding=3>
4620 <tr>
4621 <th>
4622 Package Object
4623 </th>
4625 <th>
4626 Target Object
4627 </th>
4628 </tr>
4630 <tr>
4631 <td>
4632 directory
4633 </td>
4635 <td>
4636 not a directory
4637 </td>
4638 </tr>
4640 <tr>
4641 <td>
4642 file
4643 </td>
4645 <td>
4646 directory
4647 </td>
4648 </tr>
4650 <tr>
4651 <td>
4652 file
4653 </td>
4655 <td>
4656 file
4657 </td>
4658 </tr>
4660 <tr>
4661 <td>
4662 file
4663 </td>
4665 <td>
4666 symbolic link to something other than the package object
4667 </td>
4668 </tr>
4669 </table>
4670 </center>
4672 <p> If <em>Graft</em> encounters such a conflict during the installation of a
4673 package it will report the conflict and exit. </p>
4675 <p> Resolving the conflict depends on the nature of the conflict and is
4676 beyond the scope of this discussion - however most conflicts will
4677 either be the result of attempting to <em>graft</em> a package on top of
4678 the same package actually installed in the target directory or a file
4679 name clash between two (or more) different packages. </p>
4681 <p> Conflicts arising from the pre-existence of a package in the target
4682 directory can be resolved using <em>graft</em>'s prune mechanism
4683 described above in <a href="#transitioning">&quot;Transitioning a
4684 package to <em>Graft</em> control&quot;</a>. </p>
4686 <p> File name clash conflicts can be resolved by the use of either a
4687 <a href="#bypass"><tt>.nograft</tt></a> or
4688 <a href="#exclude"><tt>.graft-exclude</tt></a> file or by
4689 <em>grafting</em> only part of a package as described above in
4690 <a href="#partial-graft">&quot;Grafting part of a package&quot;</a>.
4691 </p>
4693 <p> If <em>Graft</em> encounters a conflict while deleting a package, it will
4694 report the conflict and continue deleting the remainder of the package.
4695 In this way <em>Graft</em> will delete as much of the package as
4696 possible. Conflicts that arise during deletion will probably be the
4697 result of an incorrectly installed package or the installation of other
4698 components of the same package without the use of <em>Graft</em>. </p>
4700 <p> Conflict messages are written to standard error. All other messages
4701 are written to standard output. To quickly determine if a package will
4702 have any conflicts when <em>grafted</em>, redirect standard output to
4703 <tt>/dev/null</tt> </p>
4705 <pre>
4706 graft -i -n <em>package</em> &gt; /dev/null
4707 </pre>
4709 <p> If you don't see any output then you can safely assume that there will
4710 be no conflicts when <em>grafting</em> this package. </p>
4712 <p> See the comprehensive table above describing how
4713 <a href="#precedence">conflicts are handled</a> for more details. </p>
4715 <hr width="25%">
4717 <h3><a name="exitstatus">Exit Status</a></h3>
4719 <p> <em>Graft</em> will terminate with an exit status of either 0, 1, 2, 3 or 4
4720 under the following conditions: </p>
4722 <center>
4723 <table summary="Exit Status" border=2 cellpadding=3>
4724 <tr>
4725 <th>
4726 Exit Status
4727 </th>
4729 <th>
4730 Condition
4731 </th>
4732 </tr>
4734 <tr>
4735 <td>
4736 <center>
4737 <strong>0</strong>
4738 </center>
4739 </td>
4741 <td>
4742 All operations succeeded.
4743 </td>
4744 </tr>
4746 <tr>
4747 <td>
4748 <center>
4749 <strong>1</strong>
4750 </center>
4751 </td>
4753 <td>
4754 A conflict occurred during installation.
4755 </td>
4756 </tr>
4758 <tr>
4759 <td>
4760 <center>
4761 <strong>2</strong>
4762 </center>
4763 </td>
4765 <td>
4766 Command line syntax was incorrect.
4767 </td>
4768 </tr>
4770 <tr>
4771 <td>
4772 <center>
4773 <strong>3</strong>
4774 </center>
4775 </td>
4777 <td>
4778 One or more packages listed on the command line does not
4779 exist. Other valid packages listed on the command line were
4780 processed correctly.
4781 </td>
4782 </tr>
4784 <tr>
4785 <td>
4786 <center>
4787 <strong>4</strong>
4788 </center>
4789 </td>
4791 <td>
4792 The log file <tt>/var/log/graft</tt> could not be updated. Usually a
4793 result of a permission error. Any other error condition will
4794 override this condition.
4795 </td>
4796 </tr>
4797 </table>
4798 </center>
4800 <hr>
4802 <h2><a name="other-pkg-tools">Using <em>Graft</em> with other package
4803 management tools</a></h2>
4805 <p> Most Unix vendors have released their own package management tools with
4806 their operating systems. Examples of this are Solaris 2.<em>x</em> with its
4807 <em>SVR4 Package Manager</em> <tt>pkgadd</tt>, RedHat Linux with its
4808 <em>RedHat Package Manager</em> <tt>rpm</tt>, Ubuntu Linux (and other Debian
4809 Linux derivatives) with its <tt>dpkg</tt> system and HP-UX 10.<em>x</em> with
4810 its <tt>swinstall</tt> suite. <em>Graft</em> has been designed as an adjunct
4811 to these package managers rather than a competitor. The author has used
4812 <em>Graft</em> successfully with all of the operating systems mentioned here.
4813 </p>
4815 <ul>
4817 <li> <p> Many useful packages available in the public domain and from
4818 other commercial sources are not shipped with most flavours of
4819 Unix. <em>Graft</em> can be used to maintain a rich package
4820 environment beyond the set of packages provided by your vendor.
4821 Vendor based packages can still be maintained using the vendor's
4822 tools and <em>Graft</em> can be used to maintain your own packages.
4823 </p>
4825 <li> <p> The vendor based management tools are usually used to maintain
4826 single instances of a package on each machine. It is often
4827 difficult to have multiple versions of the same package coexisting
4828 on the same machine. <em>Graft</em> can be used to maintain multiple
4829 versions of a package to support legacy, production and development
4830 requirements simultaneously. </p>
4832 <li> <p> Another common problem with vendor supplied software is
4833 the speed at which upgrades are available. The large vendors are not
4834 known for providing quick fixes to many of their packages. (Notable
4835 exceptions to this are the vendors of operating systems based on
4836 open source software who can draw on the enormous number of users
4837 who submit patches because the source code is available). Using
4838 <em>Graft</em> you can obtain a working public domain version of
4839 a package (if one exists of course) and install it in a different
4840 location to the vendor copy. When the vendor releases a new version of
4841 the package, it can be installed using the vendor's package management
4842 tool and your <em>grafted</em> copy can be removed (only if the vendor's
4843 version of the package is better than the public domain version). </p>
4845 <li> <p> Sometimes, a vendor's package doesn't quite perform in the
4846 manner you'd like. It may be making assumptions about your file
4847 system(s) that are incorrect for your environment or it may not
4848 have all the features you'd like. If an alternative package is
4849 available - either in the public domain or from other commercial
4850 sources - it can be installed and <em>grafted</em> accordingly. </p>
4852 </ul>
4854 <hr>
4856 <h2><a name="availability">Availability</a></h2>
4858 <p> The latest version of <em>Graft</em> should always be available from: </p>
4860 <pre>
4861 <a href="http://peters.gormand.com.au/Home/tools/graft">http://peters.gormand.com.au/Home/tools/graft</a>
4862 </pre>
4864 <hr>
4866 <h2><a name="license">License</a></h2>
4868 <p> <em>Graft</em> is licensed under the terms of the GNU General Public
4869 License, Version 2, June 1991. </p>
4871 <p> You should have received a copy of the GNU General Public License
4872 along with this program; if not, write to the Free Software Foundation,
4873 Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA, or download
4874 it from the Free Software Foundation's web site: </p>
4876 <pre>
4877 <a href="http://www.gnu.org/copyleft/gpl.html">http://www.gnu.org/copyleft/gpl.html</a>
4878 <a href="http://www.gnu.org/copyleft/gpl.txt">http://www.gnu.org/copyleft/gpl.txt</a>
4879 </pre>
4882 <hr>
4884 </body>
4885 </html>
4887 <!-- html code generated by txt2tags 2.6. (http://txt2tags.org) -->
4888 <!-- cmdline: txt2tags -t html pkgmanagement.t2t -->
4889 </BODY></HTML>