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

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.11      spz         6: <link rel="stylesheet" type="text/css" href="/global.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>
1.14      asau       27: <div class="chapter">
1.1       dsieger    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>
1.26      leot       32: <dl class="toc">
1.1       dsieger    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>
1.15      asau       35: <dt><span class="sect2"><a href="getting.html#getting-via-tar">2.1.1. As tar archive</a></span></dt>
1.10      wiz        36: <dt><span class="sect2"><a href="getting.html#getting-via-cvs">2.1.2. Via anonymous CVS</a></span></dt>
1.1       dsieger    37: </dl></dd>
                     38: <dt><span class="sect1"><a href="getting.html#uptodate">2.2. Keeping pkgsrc up-to-date</a></span></dt>
                     39: <dd><dl>
                     40: <dt><span class="sect2"><a href="getting.html#uptodate-tar">2.2.1. Via tar files</a></span></dt>
                     41: <dt><span class="sect2"><a href="getting.html#uptodate-cvs">2.2.2. Via CVS</a></span></dt>
                     42: </dl></dd>
                     43: </dl>
                     44: </div>
                     45: <p>Before you download and extract the files, you need to decide
                     46: where you want to extract them. When using pkgsrc as root user, pkgsrc
                     47: is usually installed in <code class="filename">/usr/pkgsrc</code>. You are though
                     48: free to install the sources and binary packages wherever you want in
                     49: your filesystem, provided that the pathname does not contain white-space
                     50: or other characters that are interpreted specially by the shell and some
                     51: other programs. A safe bet is to use only letters, digits, underscores
                     52: and dashes.</p>
1.14      asau       53: <div class="sect1">
1.1       dsieger    54: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
                     55: <a name="getting-first"></a>2.1. Getting pkgsrc for the first time</h2></div></div></div>
                     56: <p>Before you download any pkgsrc files, you should decide
                     57:        whether you want the <span class="emphasis"><em>current</em></span> branch or the
                     58:        <span class="emphasis"><em>stable</em></span> branch. The latter is forked on a
                     59:        quarterly basis from the current branch and only gets modified
                     60:        for security updates. The names of the stable branches are built
                     61:        from the year and the quarter, for example
1.27    ! sevan      62:        <code class="literal">2016Q4</code>.</p>
1.1       dsieger    63: <p>The second step is to decide <span class="emphasis"><em>how</em></span> you
1.10      wiz        64:        want to download pkgsrc. You can get it as a tar file or via CVS.
                     65:        Both ways are described here.</p>
1.15      asau       66: <p>Note that tar archive contains CVS working copy.
                     67:        Thus you can switch to using CVS at any later time.</p>
1.14      asau       68: <div class="sect2">
1.1       dsieger    69: <div class="titlepage"><div><div><h3 class="title">
1.15      asau       70: <a name="getting-via-tar"></a>2.1.1. As tar archive</h3></div></div></div>
1.1       dsieger    71: <p>The primary download location for all pkgsrc files is
1.15      asau       72:        <a class="ulink" href="http://ftp.NetBSD.org/pub/pkgsrc/" target="_top">http://ftp.NetBSD.org/pub/pkgsrc/</a> or
                     73:        <a class="ulink" href="ftp://ftp.NetBSD.org/pub/pkgsrc/" target="_top">ftp://ftp.NetBSD.org/pub/pkgsrc/</a>
                     74:        (it points to the same location).
                     75:        There are a number of subdirectories for different purposes,
                     76:        which are 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>
                     77: <p>The tar archive for the current branch is in the directory
                     78:        <code class="filename">current</code> and is called <a class="ulink" href="http://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc.tar.gz" target="_top"><code class="filename">pkgsrc.tar.gz</code></a>.
1.27    ! sevan      79:        It is autogenerated weekly.</p>
1.15      asau       80: <p>To save download time we provide bzip2- and
                     81:        xz-compressed archives which are published at
                     82:        <a class="ulink" href="http://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc.tar.bz2" target="_top"><code class="filename">pkgsrc.tar.bz2</code></a>
                     83:        and
                     84:        <a class="ulink" href="http://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc.tar.xz" target="_top"><code class="filename">pkgsrc.tar.xz</code></a>
                     85:        respectively.
                     86:        </p>
                     87: <p>You can fetch the same files using FTP.</p>
1.27    ! sevan      88: <p>The tar file for the stable branch 2016Q4 is in the
        !            89:        directory <code class="filename">pkgsrc-2016Q4</code> and is also called <a class="ulink" href="ftp://ftp.NetBSD.org/pub/pkgsrc/pkgsrc-2016Q4/pkgsrc.tar.gz" target="_top"><code class="filename">pkgsrc.tar.gz</code></a>.</p>
1.5       weinem     90: <p>To download a pkgsrc stable tarball, run:</p>
                     91: <pre class="screen">
1.16      jnemeth    92: <code class="prompt">$</code> <strong class="userinput"><code>ftp ftp://ftp.NetBSD.org/pub/pkgsrc/<em class="replaceable"><code>pkgsrc-20xxQy</code></em>/pkgsrc.tar.gz</code></strong></pre>
1.9       jakllsch   93: <p>Where <em class="replaceable"><code>pkgsrc-20xxQy</code></em> is the
1.5       weinem     94:        stable branch to be downloaded, for example, 
1.27    ! sevan      95:        <span class="quote">&#8220;<span class="quote">pkgsrc-2016Q4</span>&#8221;</span>.</p>
1.19      snj        96: <p>If you prefer, you can also fetch it using "wget", "curl",
1.15      asau       97:        or your web browser.</p>
1.5       weinem     98: <p>Then, extract it with:</p>
1.19      snj        99: <pre class="screen"><code class="prompt">$</code> <strong class="userinput"><code>tar -xzf pkgsrc.tar.gz -C /usr</code></strong></pre>
1.5       weinem    100: <p>This will create the directory <code class="filename">pkgsrc/</code>
                    101:        in <code class="filename">/usr/</code> and all the package source will be 
                    102:        stored under <code class="filename">/usr/pkgsrc/</code>.</p>
                    103: <p>To download pkgsrc-current, run:</p>
                    104: <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   105: </div>
1.14      asau      106: <div class="sect2">
1.1       dsieger   107: <div class="titlepage"><div><div><h3 class="title">
1.10      wiz       108: <a name="getting-via-cvs"></a>2.1.2. Via anonymous CVS</h3></div></div></div>
                    109: <p>To fetch a specific pkgsrc stable branch, run:</p>
1.13      wiz       110: <pre class="screen"><code class="prompt">$</code> <strong class="userinput"><code>cd /usr &amp;&amp; cvs -q -z2 -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -r <em class="replaceable"><code>pkgsrc-20xxQy</code></em> -P pkgsrc</code></strong>
1.10      wiz       111: </pre>
                    112: <p>Where <em class="replaceable"><code>pkgsrc-20xxQy</code></em> is the stable 
1.27    ! sevan     113:        branch to be checked out, for example, <span class="quote">&#8220;<span class="quote">pkgsrc-2016Q4</span>&#8221;</span></p>
1.10      wiz       114: <p>This will create the directory <code class="filename">pkgsrc/</code> 
                    115:        in your <code class="filename">/usr/</code> directory and all the package source 
                    116:        will be stored under <code class="filename">/usr/pkgsrc/</code>.</p>
                    117: <p>To fetch the pkgsrc current branch, run:</p>
1.13      wiz       118: <pre class="screen"><code class="prompt">$</code> <strong class="userinput"><code>cd /usr &amp;&amp; cvs -q -z2 -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -P pkgsrc</code></strong>
1.1       dsieger   119: </pre>
1.19      snj       120: <p>Refer to the <a class="ulink" href="http://www.NetBSD.org/mirrors/#anoncvs" target="_top">list of available mirrors</a> to choose a faster CVS mirror, if needed.</p>
1.10      wiz       121: <p>If you get error messages from <code class="literal">rsh</code>, you need to set CVS_RSH variable. E.g.:</p>
1.13      wiz       122: <pre class="screen"><code class="prompt">$</code> <strong class="userinput"><code>cd /usr &amp;&amp; env CVS_RSH=ssh cvs -q -z2 -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -P pkgsrc</code></strong>
1.1       dsieger   123: </pre>
1.10      wiz       124: <p>Refer to documentation on your command shell how to set CVS_RSH=ssh permanently.
                    125:        For Bourne shells, you can set it in your <code class="filename">.profile</code>
                    126:        or better globally in <code class="filename">/etc/profile</code>:</p>
                    127: <pre class="programlisting">
                    128: # set CVS remote shell command
                    129: CVS_RSH=ssh
                    130: export CVS_RSH
1.1       dsieger   131: </pre>
1.10      wiz       132: <p>By default, CVS doesn't do things like most people would expect it to do.
                    133:        But there is a way to convince CVS, by creating a file called <code class="filename">.cvsrc</code>
                    134:        in your home directory and saving the following lines to it.
                    135:        This file will save you lots of headache and some bug reports, so we strongly recommend it.
                    136:        You can find an explanation of this file in the CVS documentation.</p>
1.2       rillig    137: <pre class="programlisting">
                    138: # recommended CVS configuration file from the pkgsrc guide
1.13      wiz       139: cvs -q -z2
1.2       rillig    140: checkout -P
1.3       rillig    141: update -dP
                    142: diff -upN
1.2       rillig    143: rdiff -u
1.10      wiz       144: release -d
1.2       rillig    145: </pre>
1.1       dsieger   146: </div>
                    147: </div>
1.14      asau      148: <div class="sect1">
1.1       dsieger   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>
1.14      asau      155: <div class="sect2">
1.1       dsieger   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>
1.14      asau      158: <div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
1.1       dsieger   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
1.19      snj       170:        before updating. You can also configure pkgsrc to store distfiles
                    171:         and packages in directories outside the pkgsrc tree by setting the
1.1       dsieger   172:        <code class="varname">DISTDIR</code> and <code class="varname">PACKAGES</code>
1.4       hubertf   173:        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   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>
1.14      asau      179: <div class="sect2">
1.1       dsieger   180: <div class="titlepage"><div><div><h3 class="title">
                    181: <a name="uptodate-cvs"></a>2.2.2. Via CVS</h3></div></div></div>
1.11      spz       182: <p>To update pkgsrc via CVS, change to the <code class="filename">pkgsrc</code> directory and run cvs:</p>
                    183: <pre class="screen"><code class="prompt">$</code> <strong class="userinput"><code>cd /usr/pkgsrc &amp;&amp; cvs update -dP</code></strong>
                    184: </pre>
                    185: <p>If you get error messages from <code class="literal">rsh</code>, you need to set CVS_RSH variable as described above. E.g.:</p>
                    186: <pre class="screen"><code class="prompt">$</code> <strong class="userinput"><code>cd /usr/pkgsrc &amp;&amp; env CVS_RSH=ssh cvs up -dP</code></strong>
                    187: </pre>
1.14      asau      188: <div class="sect3">
1.1       dsieger   189: <div class="titlepage"><div><div><h4 class="title">
                    190: <a name="uptodate-cvs-switch"></a>2.2.2.1. Switching between different pkgsrc branches</h4></div></div></div>
                    191: <p>When updating pkgsrc, the CVS program keeps track of the
                    192:        branch you selected. But if you, for whatever reason, want to
                    193:        switch from the stable branch to the current one, you can do it
1.10      wiz       194:        by adding the option <span class="quote">&#8220;<span class="quote">-A</span>&#8221;</span> after the
                    195:        <span class="quote">&#8220;<span class="quote">update</span>&#8221;</span> keyword. To switch from the current branch
1.1       dsieger   196:        back to the stable branch, add the
1.27    ! sevan     197:        <span class="quote">&#8220;<span class="quote">-rpkgsrc-2016Q4</span>&#8221;</span> option.</p>
1.1       dsieger   198: </div>
1.14      asau      199: <div class="sect3">
1.1       dsieger   200: <div class="titlepage"><div><div><h4 class="title">
                    201: <a name="uptodate-cvs-changes"></a>2.2.2.2. What happens to my changes when updating?</h4></div></div></div>
                    202: <p>When you update pkgsrc, the CVS program will only touch
                    203:        those files that are registered in the CVS repository. That
                    204:        means that any packages that you created on your own will stay
                    205:        unmodified. If you change files that are managed by CVS, later
                    206:        updates will try to merge your changes with those that have been
                    207:        done by others. See the CVS manual, chapter
1.10      wiz       208:        <span class="quote">&#8220;<span class="quote">update</span>&#8221;</span> for details.</p>
1.1       dsieger   209: </div>
                    210: </div>
                    211: </div>
                    212: </div>
                    213: <div class="navfooter">
                    214: <hr>
                    215: <table width="100%" summary="Navigation footer">
                    216: <tr>
                    217: <td width="40%" align="left">
                    218: <a accesskey="p" href="users-guide.html">Prev</a> </td>
                    219: <td width="20%" align="center"><a accesskey="u" href="users-guide.html">Up</a></td>
                    220: <td width="40%" align="right"> <a accesskey="n" href="platforms.html">Next</a>
                    221: </td>
                    222: </tr>
                    223: <tr>
                    224: <td width="40%" align="left" valign="top">Part I. The pkgsrc user's guide </td>
                    225: <td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td>
                    226: <td width="40%" align="right" valign="top"> Chapter 3. Using pkgsrc on systems other than NetBSD</td>
                    227: </tr>
                    228: </table>
                    229: </div>
                    230: </body>
                    231: </html>

CVSweb <webmaster@jp.NetBSD.org>