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

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">
                      8: <link rel="start" href="index.html" title="The pkgsrc guide">
                      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
                     63:        <code class="literal">2007Q1</code>.</p>
                     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
                     71:        <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/" target="_top">ftp://ftp.NetBSD.org/pub/pkgsrc/</a>. There are a
                     72:        number of subdirectories for different purposes, which are
                     73:        described in detail in <a 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>
                     74: <p>The tar file for the current branch is in the directory
                     75:        <code class="filename">current</code> and is called <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc.tar.gz" target="_top"><code class="filename">pkgsrc.tar.gz</code></a>.
                     76:        It is autogenerated daily.</p>
                     77: <p>The tar file for the stable branch 2007Q1 is in the
                     78:        directory <code class="filename">pkgsrc-2007Q1</code> and is also called <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/pkgsrc-2007Q1/pkgsrc-2007Q1.tar.gz" target="_top"><code class="filename">pkgsrc-2007Q1.tar.gz</code></a>.</p>
                     79: <p>After downloading the tar file, change to the directory
                     80:        where you want to have pkgsrc. This is usually
                     81:        <code class="filename">/usr</code>. Then, run <span><strong class="command">gzcat
                     82:        pkgsrc.tar.gz | tar xf -</strong></span> to extract the files.</p>
                     83: </div>
                     84: <div class="sect2" lang="en">
                     85: <div class="titlepage"><div><div><h3 class="title">
                     86: <a name="getting-via-sup"></a>2.1.2. Via SUP</h3></div></div></div>
                     87: <p>As an alternative to the tar file, you can get pkgsrc via
                     88:        the Software Update Protocol, SUP. To do so, make sure your
                     89:        supfile has a line
                     90: 
                     91: </p>
                     92: <pre class="programlisting">
                     93: release=pkgsrc
                     94: </pre>
                     95: <p>
                     96: 
                     97:        in it, see the examples in
                     98:        <code class="filename">/usr/share/examples/supfiles</code>, and that the
                     99:        <code class="filename">/usr/pkgsrc</code> directory exists. Then, simply
                    100:        run <span><strong class="command">sup -v
                    101:        <em class="replaceable"><code>/path/to/your/supfile</code></em></strong></span>.</p>
                    102: </div>
                    103: <div class="sect2" lang="en">
                    104: <div class="titlepage"><div><div><h3 class="title">
                    105: <a name="getting-via-cvs"></a>2.1.3. Via anonymous CVS</h3></div></div></div>
                    106: <p>To get pkgsrc via CVS, make sure you have <a href="http://netbsd.gw.com/cgi-bin/man-cgi?cvs+1+NetBSD-current"><span class="citerefentry"><span class="refentrytitle">cvs</span>(1)</span></a>
                    107:        installed. To do an initial (full) checkout of pkgsrc, you first
                    108:        have to set some environment variables. For the C-Shell,
                    109:        type:</p>
                    110: <pre class="screen">
                    111:     <code class="prompt">%</code> <strong class="userinput"><code>setenv CVSROOT anoncvs@anoncvs.NetBSD.org:/cvsroot</code></strong>
                    112:     <code class="prompt">%</code> <strong class="userinput"><code>setenv CVS_RSH ssh</code></strong>
                    113: </pre>
                    114: <p>Or, the same for the bourne shell:</p>
                    115: <pre class="screen">
                    116:     <code class="prompt">$</code> <strong class="userinput"><code>CVSROOT="anoncvs@anoncvs.NetBSD.org:/cvsroot"</code></strong>
                    117:     <code class="prompt">$</code> <strong class="userinput"><code>CVS_RSH="ssh"</code></strong>
                    118:     <code class="prompt">$</code> <strong class="userinput"><code>export CVSROOT CVS_RSH</code></strong>
                    119: </pre>
1.2       rillig    120: <p>By default, cvs doesn't do things like most people would
                    121:        expect it to do, and this is unlikely to change. But there is a
                    122:        way to convince cvs, by creating a file called
                    123:        <code class="filename">.cvsrc</code> in your home directory and saving
                    124:        the following lines to it. This file will save you lots of
                    125:        headache and some bug reports, so we strongly recommend it. You
                    126:        can find an explanation of this file in the CVS
                    127:        documentation.</p>
                    128: <pre class="programlisting">
                    129: # recommended CVS configuration file from the pkgsrc guide
                    130: checkout -P
1.3     ! rillig    131: update -dP
1.2       rillig    132: release -d
1.3     ! rillig    133: diff -upN
1.2       rillig    134: cvs -q -z3
                    135: rdiff -u
                    136: </pre>
1.1       dsieger   137: <p>Then, you change to the directory where you want to have
                    138:        your copy of pkgsrc. In most cases this is
                    139:        <code class="filename">/usr</code>. In that directory you run the
                    140:        checkout command, which is <span><strong class="command">cvs -q checkout -P
                    141:        pkgsrc</strong></span> for the current branch and <span><strong class="command">cvs -q
                    142:        checkout -rpkgsrc-2007Q1 -P pkgsrc</strong></span> for the stable
                    143:        branch. This command will create a directory called
                    144:        <code class="filename">pkgsrc</code> with all the pkgsrc files in
                    145:        it.</p>
                    146: </div>
                    147: </div>
                    148: <div class="sect1" lang="en">
                    149: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
                    150: <a name="uptodate"></a>2.2. Keeping pkgsrc up-to-date</h2></div></div></div>
                    151: <p>The preferred way to keep pkgsrc up-to-date is via CVS
                    152:        (which also works if you have first installed it via a tar
                    153:        file). It saves bandwidth and hard disk activity, compared to
                    154:        downloading the tar file again.</p>
                    155: <div class="sect2" lang="en">
                    156: <div class="titlepage"><div><div><h3 class="title">
                    157: <a name="uptodate-tar"></a>2.2.1. Via tar files</h3></div></div></div>
                    158: <div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
                    159: <h3 class="title">Warning</h3>
                    160: <p>When updating from a tar file, you first need to
                    161:        completely remove the old pkgsrc directory. Otherwise those
                    162:        files that have been removed from pkgsrc in the mean time will
                    163:        not be removed on your local disk, resulting in inconsistencies.
                    164:        When removing the old files, any changes that you have done to
                    165:        the pkgsrc files will be lost after updating. Therefore updating
                    166:        via CVS is strongly recommended.</p>
                    167: </div>
                    168: <p>Note that by default the distfiles and the binary packages
                    169:        are saved in the pkgsrc tree, so don't forget to rescue them
                    170:        before updating. You can also configure pkgsrc to use other than
                    171:        the default directories by setting the
                    172:        <code class="varname">DISTDIR</code> and <code class="varname">PACKAGES</code>
                    173:        variables. See <a href="configuring.html" title="Chapter 5. Configuring pkgsrc">Chapter 5, <i>Configuring pkgsrc</i></a> for the details.</p>
                    174: <p>To update pkgsrc from a tar file, download the tar file as
                    175:        explained above. Then, make sure that you have not made any
                    176:        changes to the files in the pkgsrc directory. Remove the pkgsrc
                    177:        directory and extract the new tar file. Done.</p>
                    178: </div>
                    179: <div class="sect2" lang="en">
                    180: <div class="titlepage"><div><div><h3 class="title">
                    181: <a name="uptodate-cvs"></a>2.2.2. Via CVS</h3></div></div></div>
                    182: <p>To update pkgsrc via CVS, make sure the environment
                    183:        variable <code class="varname">CVS_RSH</code> is set as above. Then,
                    184:        change to the pkgsrc directory and run <span><strong class="command">cvs -q update
                    185:        -dP</strong></span>.</p>
                    186: <div class="sect3" lang="en">
                    187: <div class="titlepage"><div><div><h4 class="title">
                    188: <a name="uptodate-cvs-switch"></a>2.2.2.1. Switching between different pkgsrc branches</h4></div></div></div>
                    189: <p>When updating pkgsrc, the CVS program keeps track of the
                    190:        branch you selected. But if you, for whatever reason, want to
                    191:        switch from the stable branch to the current one, you can do it
                    192:        by adding the option &#8220;<span class="quote">-A</span>&#8221; after the
                    193:        &#8220;<span class="quote">update</span>&#8221; keyword. To switch from the current branch
                    194:        back to the stable branch, add the
                    195:        &#8220;<span class="quote">-rpkgsrc-2007Q1</span>&#8221; option.</p>
                    196: </div>
                    197: <div class="sect3" lang="en">
                    198: <div class="titlepage"><div><div><h4 class="title">
                    199: <a name="uptodate-cvs-changes"></a>2.2.2.2. What happens to my changes when updating?</h4></div></div></div>
                    200: <p>When you update pkgsrc, the CVS program will only touch
                    201:        those files that are registered in the CVS repository. That
                    202:        means that any packages that you created on your own will stay
                    203:        unmodified. If you change files that are managed by CVS, later
                    204:        updates will try to merge your changes with those that have been
                    205:        done by others. See the CVS manual, chapter
                    206:        &#8220;<span class="quote">update</span>&#8221; for details.</p>
                    207: </div>
                    208: </div>
                    209: </div>
                    210: </div>
                    211: <div class="navfooter">
                    212: <hr>
                    213: <table width="100%" summary="Navigation footer">
                    214: <tr>
                    215: <td width="40%" align="left">
                    216: <a accesskey="p" href="users-guide.html">Prev</a> </td>
                    217: <td width="20%" align="center"><a accesskey="u" href="users-guide.html">Up</a></td>
                    218: <td width="40%" align="right"> <a accesskey="n" href="platforms.html">Next</a>
                    219: </td>
                    220: </tr>
                    221: <tr>
                    222: <td width="40%" align="left" valign="top">Part I. The pkgsrc user's guide </td>
                    223: <td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td>
                    224: <td width="40%" align="right" valign="top"> Chapter 3. Using pkgsrc on systems other than NetBSD</td>
                    225: </tr>
                    226: </table>
                    227: </div>
                    228: </body>
                    229: </html>

CVSweb <webmaster@jp.NetBSD.org>