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

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
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.4       hubertf   109:        run <span class="command"><strong>sup -v
1.1       dsieger   110:        <em class="replaceable"><code>/path/to/your/supfile</code></em></strong></span>.</p>
                    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>
                    118: <pre class="screen">
                    119:     <code class="prompt">%</code> <strong class="userinput"><code>setenv CVSROOT anoncvs@anoncvs.NetBSD.org:/cvsroot</code></strong>
                    120:     <code class="prompt">%</code> <strong class="userinput"><code>setenv CVS_RSH ssh</code></strong>
                    121: </pre>
                    122: <p>Or, the same for the bourne shell:</p>
                    123: <pre class="screen">
1.5     ! weinem    124:     <code class="prompt">$</code> <strong class="userinput"><code>export CVSROOT="anoncvs@anoncvs.NetBSD.org:/cvsroot"</code></strong>
        !           125:     <code class="prompt">$</code> <strong class="userinput"><code>export CVS_RSH="ssh"</code></strong>
1.1       dsieger   126: </pre>
1.2       rillig    127: <p>By default, cvs doesn't do things like most people would
1.5     ! weinem    128:        expect it to do. But there is a
1.2       rillig    129:        way to convince cvs, by creating a file called
                    130:        <code class="filename">.cvsrc</code> in your home directory and saving
                    131:        the following lines to it. This file will save you lots of
                    132:        headache and some bug reports, so we strongly recommend it. You
                    133:        can find an explanation of this file in the CVS
                    134:        documentation.</p>
                    135: <pre class="programlisting">
                    136: # recommended CVS configuration file from the pkgsrc guide
                    137: checkout -P
1.3       rillig    138: update -dP
1.2       rillig    139: release -d
1.3       rillig    140: diff -upN
1.2       rillig    141: cvs -q -z3
                    142: rdiff -u
                    143: </pre>
1.5     ! weinem    144: <p>To fetch a specific pkgsrc stable branch from scratch, run:</p>
        !           145: <pre class="screen"><code class="prompt">$</code> <strong class="userinput"><code>cd /usr</code></strong>
        !           146:        <code class="prompt">$</code> <strong class="userinput"><code>cvs checkout -r <em class="replaceable"><code>pkgsrc-200xQy</code></em> -P pkgsrc</code></strong></pre>
        !           147: <p>Where <em class="replaceable"><code>pkgsrc-200xQy</code></em> is the stable 
        !           148:        branch to be checked out, for example, &#8220;<span class="quote">pkgsrc-2007Q4</span>&#8221;</p>
        !           149: <p>This will create the directory <code class="filename">pkgsrc/</code> 
        !           150:        in your <code class="filename">/usr/</code> directory and all the package source 
        !           151:        will be stored under <code class="filename">/usr/pkgsrc/</code>.</p>
        !           152: <p>To fetch the pkgsrc current branch, run:</p>
        !           153: <pre class="screen"><code class="prompt">$</code> <strong class="userinput"><code>cd /usr</code></strong>
        !           154: <code class="prompt">$</code> <strong class="userinput"><code>cvs checkout -r -P pkgsrc</code></strong></pre>
1.1       dsieger   155: </div>
                    156: </div>
                    157: <div class="sect1" lang="en">
                    158: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
                    159: <a name="uptodate"></a>2.2. Keeping pkgsrc up-to-date</h2></div></div></div>
                    160: <p>The preferred way to keep pkgsrc up-to-date is via CVS
                    161:        (which also works if you have first installed it via a tar
                    162:        file). It saves bandwidth and hard disk activity, compared to
                    163:        downloading the tar file again.</p>
                    164: <div class="sect2" lang="en">
                    165: <div class="titlepage"><div><div><h3 class="title">
                    166: <a name="uptodate-tar"></a>2.2.1. Via tar files</h3></div></div></div>
                    167: <div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
                    168: <h3 class="title">Warning</h3>
                    169: <p>When updating from a tar file, you first need to
                    170:        completely remove the old pkgsrc directory. Otherwise those
                    171:        files that have been removed from pkgsrc in the mean time will
                    172:        not be removed on your local disk, resulting in inconsistencies.
                    173:        When removing the old files, any changes that you have done to
                    174:        the pkgsrc files will be lost after updating. Therefore updating
                    175:        via CVS is strongly recommended.</p>
                    176: </div>
                    177: <p>Note that by default the distfiles and the binary packages
                    178:        are saved in the pkgsrc tree, so don't forget to rescue them
                    179:        before updating. You can also configure pkgsrc to use other than
                    180:        the default directories by setting the
                    181:        <code class="varname">DISTDIR</code> and <code class="varname">PACKAGES</code>
1.4       hubertf   182:        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   183: <p>To update pkgsrc from a tar file, download the tar file as
                    184:        explained above. Then, make sure that you have not made any
                    185:        changes to the files in the pkgsrc directory. Remove the pkgsrc
                    186:        directory and extract the new tar file. Done.</p>
                    187: </div>
                    188: <div class="sect2" lang="en">
                    189: <div class="titlepage"><div><div><h3 class="title">
                    190: <a name="uptodate-cvs"></a>2.2.2. Via CVS</h3></div></div></div>
                    191: <p>To update pkgsrc via CVS, make sure the environment
                    192:        variable <code class="varname">CVS_RSH</code> is set as above. Then,
1.5     ! weinem    193:        change to the pkgsrc directory and run:</p>
        !           194: <pre class="screen"><code class="prompt">$</code> <strong class="userinput"><code>cvs update -dP</code></strong></pre>
1.1       dsieger   195: <div class="sect3" lang="en">
                    196: <div class="titlepage"><div><div><h4 class="title">
                    197: <a name="uptodate-cvs-switch"></a>2.2.2.1. Switching between different pkgsrc branches</h4></div></div></div>
                    198: <p>When updating pkgsrc, the CVS program keeps track of the
                    199:        branch you selected. But if you, for whatever reason, want to
                    200:        switch from the stable branch to the current one, you can do it
                    201:        by adding the option &#8220;<span class="quote">-A</span>&#8221; after the
                    202:        &#8220;<span class="quote">update</span>&#8221; keyword. To switch from the current branch
                    203:        back to the stable branch, add the
                    204:        &#8220;<span class="quote">-rpkgsrc-2007Q1</span>&#8221; option.</p>
                    205: </div>
                    206: <div class="sect3" lang="en">
                    207: <div class="titlepage"><div><div><h4 class="title">
                    208: <a name="uptodate-cvs-changes"></a>2.2.2.2. What happens to my changes when updating?</h4></div></div></div>
                    209: <p>When you update pkgsrc, the CVS program will only touch
                    210:        those files that are registered in the CVS repository. That
                    211:        means that any packages that you created on your own will stay
                    212:        unmodified. If you change files that are managed by CVS, later
                    213:        updates will try to merge your changes with those that have been
                    214:        done by others. See the CVS manual, chapter
                    215:        &#8220;<span class="quote">update</span>&#8221; for details.</p>
                    216: </div>
                    217: </div>
                    218: </div>
                    219: </div>
                    220: <div class="navfooter">
                    221: <hr>
                    222: <table width="100%" summary="Navigation footer">
                    223: <tr>
                    224: <td width="40%" align="left">
                    225: <a accesskey="p" href="users-guide.html">Prev</a> </td>
                    226: <td width="20%" align="center"><a accesskey="u" href="users-guide.html">Up</a></td>
                    227: <td width="40%" align="right"> <a accesskey="n" href="platforms.html">Next</a>
                    228: </td>
                    229: </tr>
                    230: <tr>
                    231: <td width="40%" align="left" valign="top">Part I. The pkgsrc user's guide </td>
                    232: <td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td>
                    233: <td width="40%" align="right" valign="top"> Chapter 3. Using pkgsrc on systems other than NetBSD</td>
                    234: </tr>
                    235: </table>
                    236: </div>
                    237: </body>
                    238: </html>

CVSweb <webmaster@jp.NetBSD.org>