Annotation of htdocs/docs/pkgsrc/getting.html, revision 1.7

1.1       dsieger     1: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
                      2: <html>
                      3: <head>
                      4: <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
                      5: <title>Chapter 2. Where to get pkgsrc and how to keep it up-to-date</title>
1.2       rillig      6: <link rel="stylesheet" href="/global.css" type="text/css">
1.1       dsieger     7: <meta name="generator" content="DocBook XSL Stylesheets VX.X.X">
1.7     ! rillig      8: <link rel="home" href="index.html" title="The pkgsrc guide">
1.1       dsieger     9: <link rel="up" href="users-guide.html" title="Part I. The pkgsrc user's guide">
                     10: <link rel="prev" href="users-guide.html" title="Part I. The pkgsrc user's guide">
                     11: <link rel="next" href="platforms.html" title="Chapter 3. Using pkgsrc on systems other than NetBSD">
                     12: </head>
                     13: <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
                     14: <div class="navheader">
                     15: <table width="100%" summary="Navigation header">
                     16: <tr><th colspan="3" align="center">Chapter 2. Where to get pkgsrc and how to keep it up-to-date</th></tr>
                     17: <tr>
                     18: <td width="20%" align="left">
                     19: <a accesskey="p" href="users-guide.html">Prev</a> </td>
                     20: <th width="60%" align="center">Part I. The pkgsrc user's guide</th>
                     21: <td width="20%" align="right"> <a accesskey="n" href="platforms.html">Next</a>
                     22: </td>
                     23: </tr>
                     24: </table>
                     25: <hr>
                     26: </div>
                     27: <div class="chapter" lang="en">
                     28: <div class="titlepage"><div><div><h2 class="title">
                     29: <a name="getting"></a>Chapter 2. Where to get pkgsrc and how to keep it up-to-date</h2></div></div></div>
                     30: <div class="toc">
                     31: <p><b>Table of Contents</b></p>
                     32: <dl>
                     33: <dt><span class="sect1"><a href="getting.html#getting-first">2.1. Getting pkgsrc for the first time</a></span></dt>
                     34: <dd><dl>
                     35: <dt><span class="sect2"><a href="getting.html#getting-via-tar">2.1.1. As tar file</a></span></dt>
                     36: <dt><span class="sect2"><a href="getting.html#getting-via-sup">2.1.2. Via SUP</a></span></dt>
                     37: <dt><span class="sect2"><a href="getting.html#getting-via-cvs">2.1.3. Via anonymous CVS</a></span></dt>
                     38: </dl></dd>
                     39: <dt><span class="sect1"><a href="getting.html#uptodate">2.2. Keeping pkgsrc up-to-date</a></span></dt>
                     40: <dd><dl>
                     41: <dt><span class="sect2"><a href="getting.html#uptodate-tar">2.2.1. Via tar files</a></span></dt>
                     42: <dt><span class="sect2"><a href="getting.html#uptodate-cvs">2.2.2. Via CVS</a></span></dt>
                     43: </dl></dd>
                     44: </dl>
                     45: </div>
                     46: <p>Before you download and extract the files, you need to decide
                     47: where you want to extract them. When using pkgsrc as root user, pkgsrc
                     48: is usually installed in <code class="filename">/usr/pkgsrc</code>. You are though
                     49: free to install the sources and binary packages wherever you want in
                     50: your filesystem, provided that the pathname does not contain white-space
                     51: or other characters that are interpreted specially by the shell and some
                     52: other programs. A safe bet is to use only letters, digits, underscores
                     53: and dashes.</p>
                     54: <div class="sect1" lang="en">
                     55: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
                     56: <a name="getting-first"></a>2.1. Getting pkgsrc for the first time</h2></div></div></div>
                     57: <p>Before you download any pkgsrc files, you should decide
                     58:        whether you want the <span class="emphasis"><em>current</em></span> branch or the
                     59:        <span class="emphasis"><em>stable</em></span> branch. The latter is forked on a
                     60:        quarterly basis from the current branch and only gets modified
                     61:        for security updates. The names of the stable branches are built
                     62:        from the year and the quarter, for example
1.5       weinem     63:        <code class="literal">2007Q4</code>.</p>
1.1       dsieger    64: <p>The second step is to decide <span class="emphasis"><em>how</em></span> you
                     65:        want to download pkgsrc. You can get it as a tar file, via SUP,
                     66:        or via CVS. All three ways are described here.</p>
                     67: <div class="sect2" lang="en">
                     68: <div class="titlepage"><div><div><h3 class="title">
                     69: <a name="getting-via-tar"></a>2.1.1. As tar file</h3></div></div></div>
                     70: <p>The primary download location for all pkgsrc files is
1.4       hubertf    71:        <a class="ulink" href="ftp://ftp.NetBSD.org/pub/pkgsrc/" target="_top">ftp://ftp.NetBSD.org/pub/pkgsrc/</a>. There are a
1.1       dsieger    72:        number of subdirectories for different purposes, which are
1.4       hubertf    73:        described in detail in <a class="xref" href="ftp-layout.html" title="Appendix C. Directory layout of the pkgsrc FTP server">Appendix C, <i>Directory layout of the pkgsrc FTP server</i></a>.</p>
1.1       dsieger    74: <p>The tar file for the current branch is in the directory
1.4       hubertf    75:        <code class="filename">current</code> and is called <a class="ulink" href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc.tar.gz" target="_top"><code class="filename">pkgsrc.tar.gz</code></a>.
1.1       dsieger    76:        It is autogenerated daily.</p>
1.5       weinem     77: <p>The tar file for the stable branch 2007Q4 is in the
                     78:        directory <code class="filename">pkgsrc-2007Q4</code> and is also called <a class="ulink" href="ftp://ftp.NetBSD.org/pub/pkgsrc/pkgsrc-2007Q4/pkgsrc-2007Q4.tar.gz" target="_top"><code class="filename">pkgsrc-2007Q4.tar.gz</code></a>.</p>
                     79: <p>To download a pkgsrc stable tarball, run:</p>
                     80: <pre class="screen">
                     81: <code class="prompt">$</code> <strong class="userinput"><code>ftp ftp://ftp.NetBSD.org/pub/pkgsrc/<em class="replaceable"><code>pkgsrc-200xQy</code></em>/<em class="replaceable"><code>pkgsrc-200xQy</code></em>.tar.gz</code></strong></pre>
                     82: <p>Where <em class="replaceable"><code>pkgsrc-200xQy</code></em> is the
                     83:        stable branch to be downloaded, for example, 
                     84:        &#8220;<span class="quote">pkgsrc-2007Q4</span>&#8221;.</p>
                     85: <p>Then, extract it with:</p>
                     86: <pre class="screen"><code class="prompt">$</code> <strong class="userinput"><code>tar -xzf <em class="replaceable"><code>pkgsrc-200xQy</code></em>.tar.gz -C /usr</code></strong></pre>
                     87: <p>This will create the directory <code class="filename">pkgsrc/</code>
                     88:        in <code class="filename">/usr/</code> and all the package source will be 
                     89:        stored under <code class="filename">/usr/pkgsrc/</code>.</p>
                     90: <p>To download pkgsrc-current, run:</p>
                     91: <pre class="screen"><code class="prompt">$</code> <strong class="userinput"><code>ftp ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc.tar.gz</code></strong></pre>
1.1       dsieger    92: </div>
                     93: <div class="sect2" lang="en">
                     94: <div class="titlepage"><div><div><h3 class="title">
                     95: <a name="getting-via-sup"></a>2.1.2. Via SUP</h3></div></div></div>
                     96: <p>As an alternative to the tar file, you can get pkgsrc via
                     97:        the Software Update Protocol, SUP. To do so, make sure your
                     98:        supfile has a line
                     99: 
                    100: </p>
                    101: <pre class="programlisting">
                    102: release=pkgsrc
                    103: </pre>
                    104: <p>
                    105: 
                    106:        in it, see the examples in
                    107:        <code class="filename">/usr/share/examples/supfiles</code>, and that the
                    108:        <code class="filename">/usr/pkgsrc</code> directory exists. Then, simply
1.6       weinem    109:        run:</p>
                    110: <pre class="screen"><code class="prompt">$</code> <strong class="userinput"><code>sup -v <em class="replaceable"><code>/path/to/your/supfile</code></em></code></strong>.</pre>
1.1       dsieger   111: </div>
                    112: <div class="sect2" lang="en">
                    113: <div class="titlepage"><div><div><h3 class="title">
                    114: <a name="getting-via-cvs"></a>2.1.3. Via anonymous CVS</h3></div></div></div>
1.5       weinem    115: <p>To do an initial (full) checkout of pkgsrc, you first
1.1       dsieger   116:        have to set some environment variables. For the C-Shell,
                    117:        type:</p>
1.6       weinem    118: <pre class="screen"><code class="prompt">%</code> <strong class="userinput"><code>setenv CVSROOT anoncvs@anoncvs.NetBSD.org:/cvsroot</code></strong>
                    119: <code class="prompt">%</code> <strong class="userinput"><code>setenv CVS_RSH ssh</code></strong>
1.1       dsieger   120: </pre>
                    121: <p>Or, the same for the bourne shell:</p>
1.6       weinem    122: <pre class="screen"><code class="prompt">$</code> <strong class="userinput"><code>export CVSROOT="anoncvs@anoncvs.NetBSD.org:/cvsroot"</code></strong>
                    123: <code class="prompt">$</code> <strong class="userinput"><code>export CVS_RSH="ssh"</code></strong>
1.1       dsieger   124: </pre>
1.6       weinem    125: <p>By default, CVS doesn't do things like most people would
1.5       weinem    126:        expect it to do. But there is a
1.6       weinem    127:        way to convince CVS, by creating a file called
1.2       rillig    128:        <code class="filename">.cvsrc</code> in your home directory and saving
                    129:        the following lines to it. This file will save you lots of
                    130:        headache and some bug reports, so we strongly recommend it. You
                    131:        can find an explanation of this file in the CVS
                    132:        documentation.</p>
                    133: <pre class="programlisting">
                    134: # recommended CVS configuration file from the pkgsrc guide
                    135: checkout -P
1.3       rillig    136: update -dP
1.2       rillig    137: release -d
1.3       rillig    138: diff -upN
1.2       rillig    139: cvs -q -z3
                    140: rdiff -u
                    141: </pre>
1.5       weinem    142: <p>To fetch a specific pkgsrc stable branch from scratch, run:</p>
                    143: <pre class="screen"><code class="prompt">$</code> <strong class="userinput"><code>cd /usr</code></strong>
1.6       weinem    144: <code class="prompt">$</code> <strong class="userinput"><code>cvs checkout -r <em class="replaceable"><code>pkgsrc-200xQy</code></em> -P pkgsrc</code></strong></pre>
1.5       weinem    145: <p>Where <em class="replaceable"><code>pkgsrc-200xQy</code></em> is the stable 
                    146:        branch to be checked out, for example, &#8220;<span class="quote">pkgsrc-2007Q4</span>&#8221;</p>
                    147: <p>This will create the directory <code class="filename">pkgsrc/</code> 
                    148:        in your <code class="filename">/usr/</code> directory and all the package source 
                    149:        will be stored under <code class="filename">/usr/pkgsrc/</code>.</p>
                    150: <p>To fetch the pkgsrc current branch, run:</p>
                    151: <pre class="screen"><code class="prompt">$</code> <strong class="userinput"><code>cd /usr</code></strong>
1.6       weinem    152: <code class="prompt">$</code> <strong class="userinput"><code>cvs checkout -P pkgsrc</code></strong></pre>
1.1       dsieger   153: </div>
                    154: </div>
                    155: <div class="sect1" lang="en">
                    156: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
                    157: <a name="uptodate"></a>2.2. Keeping pkgsrc up-to-date</h2></div></div></div>
                    158: <p>The preferred way to keep pkgsrc up-to-date is via CVS
                    159:        (which also works if you have first installed it via a tar
                    160:        file). It saves bandwidth and hard disk activity, compared to
                    161:        downloading the tar file again.</p>
                    162: <div class="sect2" lang="en">
                    163: <div class="titlepage"><div><div><h3 class="title">
                    164: <a name="uptodate-tar"></a>2.2.1. Via tar files</h3></div></div></div>
                    165: <div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
                    166: <h3 class="title">Warning</h3>
                    167: <p>When updating from a tar file, you first need to
                    168:        completely remove the old pkgsrc directory. Otherwise those
                    169:        files that have been removed from pkgsrc in the mean time will
                    170:        not be removed on your local disk, resulting in inconsistencies.
                    171:        When removing the old files, any changes that you have done to
                    172:        the pkgsrc files will be lost after updating. Therefore updating
                    173:        via CVS is strongly recommended.</p>
                    174: </div>
                    175: <p>Note that by default the distfiles and the binary packages
                    176:        are saved in the pkgsrc tree, so don't forget to rescue them
                    177:        before updating. You can also configure pkgsrc to use other than
                    178:        the default directories by setting the
                    179:        <code class="varname">DISTDIR</code> and <code class="varname">PACKAGES</code>
1.4       hubertf   180:        variables. See <a class="xref" href="configuring.html" title="Chapter 5. Configuring pkgsrc">Chapter 5, <i>Configuring pkgsrc</i></a> for the details.</p>
1.1       dsieger   181: <p>To update pkgsrc from a tar file, download the tar file as
                    182:        explained above. Then, make sure that you have not made any
                    183:        changes to the files in the pkgsrc directory. Remove the pkgsrc
                    184:        directory and extract the new tar file. Done.</p>
                    185: </div>
                    186: <div class="sect2" lang="en">
                    187: <div class="titlepage"><div><div><h3 class="title">
                    188: <a name="uptodate-cvs"></a>2.2.2. Via CVS</h3></div></div></div>
                    189: <p>To update pkgsrc via CVS, make sure the environment
                    190:        variable <code class="varname">CVS_RSH</code> is set as above. Then,
1.6       weinem    191:        change to the <code class="filename">pkgsrc</code> directory and run cvs:</p>
                    192: <pre class="screen"><code class="prompt">$</code> <strong class="userinput"><code>cd /usr/pkgsrc</code></strong>
                    193: <code class="prompt">$</code> <strong class="userinput"><code>cvs update -dP</code></strong></pre>
1.1       dsieger   194: <div class="sect3" lang="en">
                    195: <div class="titlepage"><div><div><h4 class="title">
                    196: <a name="uptodate-cvs-switch"></a>2.2.2.1. Switching between different pkgsrc branches</h4></div></div></div>
                    197: <p>When updating pkgsrc, the CVS program keeps track of the
                    198:        branch you selected. But if you, for whatever reason, want to
                    199:        switch from the stable branch to the current one, you can do it
                    200:        by adding the option &#8220;<span class="quote">-A</span>&#8221; after the
                    201:        &#8220;<span class="quote">update</span>&#8221; keyword. To switch from the current branch
                    202:        back to the stable branch, add the
1.6       weinem    203:        &#8220;<span class="quote">-rpkgsrc-2007Q4</span>&#8221; option.</p>
1.1       dsieger   204: </div>
                    205: <div class="sect3" lang="en">
                    206: <div class="titlepage"><div><div><h4 class="title">
                    207: <a name="uptodate-cvs-changes"></a>2.2.2.2. What happens to my changes when updating?</h4></div></div></div>
                    208: <p>When you update pkgsrc, the CVS program will only touch
                    209:        those files that are registered in the CVS repository. That
                    210:        means that any packages that you created on your own will stay
                    211:        unmodified. If you change files that are managed by CVS, later
                    212:        updates will try to merge your changes with those that have been
                    213:        done by others. See the CVS manual, chapter
                    214:        &#8220;<span class="quote">update</span>&#8221; for details.</p>
                    215: </div>
                    216: </div>
                    217: </div>
                    218: </div>
                    219: <div class="navfooter">
                    220: <hr>
                    221: <table width="100%" summary="Navigation footer">
                    222: <tr>
                    223: <td width="40%" align="left">
                    224: <a accesskey="p" href="users-guide.html">Prev</a> </td>
                    225: <td width="20%" align="center"><a accesskey="u" href="users-guide.html">Up</a></td>
                    226: <td width="40%" align="right"> <a accesskey="n" href="platforms.html">Next</a>
                    227: </td>
                    228: </tr>
                    229: <tr>
                    230: <td width="40%" align="left" valign="top">Part I. The pkgsrc user's guide </td>
                    231: <td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td>
                    232: <td width="40%" align="right" valign="top"> Chapter 3. Using pkgsrc on systems other than NetBSD</td>
                    233: </tr>
                    234: </table>
                    235: </div>
                    236: </body>
                    237: </html>

CVSweb <webmaster@jp.NetBSD.org>