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

1.28      sevan       1: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
1.1       dsieger     2: <html>
                      3: <head>
1.51    ! martin      4: <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        !             5: <title>Chapter 3. 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.51    ! martin      9: <link rel="up" href="users-guide.html" title="Part I. The pkgsrc user's guide">
        !            10: <link rel="prev" href="help-user.html" title="Chapter 2. Getting help">
        !            11: <link rel="next" href="platforms.html" title="Chapter 4. Using pkgsrc on systems other than NetBSD">
1.1       dsieger    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">
1.51    ! martin     16: <tr><th colspan="3" align="center">Chapter 3. Where to get pkgsrc and how to keep it up-to-date</th></tr>
1.1       dsieger    17: <tr>
                     18: <td width="20%" align="left">
1.51    ! martin     19: <a accesskey="p" href="help-user.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>
1.1       dsieger    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">
1.51    ! martin     29: <a name="getting"></a>Chapter 3. Where to get pkgsrc and how to keep it up-to-date</h2></div></div></div>
1.1       dsieger    30: <div class="toc">
                     31: <p><b>Table of Contents</b></p>
1.26      leot       32: <dl class="toc">
1.36      rillig     33: <dt><span class="sect1"><a href="getting.html#getting-first">3.1. Getting pkgsrc for the first time</a></span></dt>
1.1       dsieger    34: <dd><dl>
1.36      rillig     35: <dt><span class="sect2"><a href="getting.html#getting-via-tar">3.1.1. As tar archive</a></span></dt>
                     36: <dt><span class="sect2"><a href="getting.html#getting-via-cvs">3.1.2. Via anonymous CVS</a></span></dt>
1.1       dsieger    37: </dl></dd>
1.36      rillig     38: <dt><span class="sect1"><a href="getting.html#uptodate">3.2. Keeping pkgsrc up-to-date</a></span></dt>
1.1       dsieger    39: <dd><dl>
1.36      rillig     40: <dt><span class="sect2"><a href="getting.html#uptodate-tar">3.2.1. Via tar files</a></span></dt>
                     41: <dt><span class="sect2"><a href="getting.html#uptodate-cvs">3.2.2. Via CVS</a></span></dt>
1.1       dsieger    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">
1.51    ! martin     55: <a name="getting-first"></a>3.1. Getting pkgsrc for the first time</h2></div></div></div>
1.1       dsieger    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.50      leot       62:        <code class="literal">2025Q2</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.51    ! martin     70: <a name="getting-via-tar"></a>3.1.1. As tar archive</h3></div></div></div>
1.1       dsieger    71: <p>The primary download location for all pkgsrc files is
1.34      sevan      72:        <a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/" target="_top">https://cdn.NetBSD.org/pub/pkgsrc/</a> or
1.15      asau       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,
1.51    ! martin     76:        which are described in detail in <a class="xref" href="ftp-layout.html" title="Appendix D. Directory layout of the pkgsrc FTP server">Appendix D, <i>Directory layout of the pkgsrc FTP server</i></a>.</p>
1.15      asau       77: <p>The tar archive for the current branch is in the directory
1.34      sevan      78:        <code class="filename">current</code> and is called <a class="ulink" href="https://cdn.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
1.34      sevan      82:        <a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc.tar.bz2" target="_top"><code class="filename">pkgsrc.tar.bz2</code></a>
1.15      asau       83:        and
1.34      sevan      84:        <a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc.tar.xz" target="_top"><code class="filename">pkgsrc.tar.xz</code></a>
1.15      asau       85:        respectively.
                     86:        </p>
                     87: <p>You can fetch the same files using FTP.</p>
1.50      leot       88: <p>The tar file for the stable branch 2025Q2 is in the
                     89:        directory <code class="filename">pkgsrc-2025Q2</code> and is also called <a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/pkgsrc-2025Q2/pkgsrc.tar.gz" target="_top"><code class="filename">pkgsrc.tar.gz</code></a>.</p>
1.29      leot       90: <p>To download the latest pkgsrc stable tarball, run:</p>
1.5       weinem     91: <pre class="screen">
1.50      leot       92: <code class="prompt">$</code> <strong class="userinput"><code>ftp ftp://ftp.NetBSD.org/pub/pkgsrc/pkgsrc-2025Q2/pkgsrc.tar.gz</code></strong></pre>
1.19      snj        93: <p>If you prefer, you can also fetch it using "wget", "curl",
1.15      asau       94:        or your web browser.</p>
1.5       weinem     95: <p>Then, extract it with:</p>
1.19      snj        96: <pre class="screen"><code class="prompt">$</code> <strong class="userinput"><code>tar -xzf pkgsrc.tar.gz -C /usr</code></strong></pre>
1.5       weinem     97: <p>This will create the directory <code class="filename">pkgsrc/</code>
                     98:        in <code class="filename">/usr/</code> and all the package source will be 
                     99:        stored under <code class="filename">/usr/pkgsrc/</code>.</p>
                    100: <p>To download pkgsrc-current, run:</p>
                    101: <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   102: </div>
1.14      asau      103: <div class="sect2">
1.1       dsieger   104: <div class="titlepage"><div><div><h3 class="title">
1.51    ! martin    105: <a name="getting-via-cvs"></a>3.1.2. Via anonymous CVS</h3></div></div></div>
1.10      wiz       106: <p>To fetch a specific pkgsrc stable branch, run:</p>
1.50      leot      107: <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 pkgsrc-2025Q2 -P pkgsrc</code></strong>
1.10      wiz       108: </pre>
                    109: <p>This will create the directory <code class="filename">pkgsrc/</code> 
                    110:        in your <code class="filename">/usr/</code> directory and all the package source 
                    111:        will be stored under <code class="filename">/usr/pkgsrc/</code>.</p>
                    112: <p>To fetch the pkgsrc current branch, run:</p>
1.13      wiz       113: <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   114: </pre>
1.41      leot      115: <p>Refer to the <a class="ulink" href="https://www.NetBSD.org/mirrors/#anoncvs" target="_top">list of available mirrors</a> to choose a faster CVS mirror, if needed.</p>
1.10      wiz       116: <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       117: <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   118: </pre>
1.10      wiz       119: <p>Refer to documentation on your command shell how to set CVS_RSH=ssh permanently.
                    120:        For Bourne shells, you can set it in your <code class="filename">.profile</code>
                    121:        or better globally in <code class="filename">/etc/profile</code>:</p>
                    122: <pre class="programlisting">
                    123: # set CVS remote shell command
                    124: CVS_RSH=ssh
                    125: export CVS_RSH
1.1       dsieger   126: </pre>
1.10      wiz       127: <p>By default, CVS doesn't do things like most people would expect it to do.
                    128:        But there is a way to convince CVS, by creating a file called <code class="filename">.cvsrc</code>
                    129:        in your home directory and saving the following lines to it.
                    130:        This file will save you lots of headache and some bug reports, so we strongly recommend it.
                    131:        You can find an explanation of this file in the CVS documentation.</p>
1.2       rillig    132: <pre class="programlisting">
                    133: # recommended CVS configuration file from the pkgsrc guide
1.37      sevan     134: cvs -q
1.2       rillig    135: checkout -P
1.3       rillig    136: update -dP
                    137: diff -upN
1.2       rillig    138: rdiff -u
1.10      wiz       139: release -d
1.2       rillig    140: </pre>
1.1       dsieger   141: </div>
                    142: </div>
1.14      asau      143: <div class="sect1">
1.1       dsieger   144: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.51    ! martin    145: <a name="uptodate"></a>3.2. Keeping pkgsrc up-to-date</h2></div></div></div>
1.1       dsieger   146: <p>The preferred way to keep pkgsrc up-to-date is via CVS
                    147:        (which also works if you have first installed it via a tar
                    148:        file). It saves bandwidth and hard disk activity, compared to
                    149:        downloading the tar file again.</p>
1.14      asau      150: <div class="sect2">
1.1       dsieger   151: <div class="titlepage"><div><div><h3 class="title">
1.51    ! martin    152: <a name="uptodate-tar"></a>3.2.1. Via tar files</h3></div></div></div>
1.14      asau      153: <div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
1.1       dsieger   154: <h3 class="title">Warning</h3>
                    155: <p>When updating from a tar file, you first need to
                    156:        completely remove the old pkgsrc directory. Otherwise those
                    157:        files that have been removed from pkgsrc in the mean time will
                    158:        not be removed on your local disk, resulting in inconsistencies.
                    159:        When removing the old files, any changes that you have done to
                    160:        the pkgsrc files will be lost after updating. Therefore updating
                    161:        via CVS is strongly recommended.</p>
                    162: </div>
                    163: <p>Note that by default the distfiles and the binary packages
                    164:        are saved in the pkgsrc tree, so don't forget to rescue them
1.19      snj       165:        before updating. You can also configure pkgsrc to store distfiles
                    166:         and packages in directories outside the pkgsrc tree by setting the
1.1       dsieger   167:        <code class="varname">DISTDIR</code> and <code class="varname">PACKAGES</code>
1.51    ! martin    168:        variables. See <a class="xref" href="configuring.html" title="Chapter 6. Configuring pkgsrc">Chapter 6, <i>Configuring pkgsrc</i></a> for the details.</p>
1.1       dsieger   169: <p>To update pkgsrc from a tar file, download the tar file as
                    170:        explained above. Then, make sure that you have not made any
                    171:        changes to the files in the pkgsrc directory. Remove the pkgsrc
                    172:        directory and extract the new tar file. Done.</p>
                    173: </div>
1.14      asau      174: <div class="sect2">
1.1       dsieger   175: <div class="titlepage"><div><div><h3 class="title">
1.51    ! martin    176: <a name="uptodate-cvs"></a>3.2.2. Via CVS</h3></div></div></div>
1.11      spz       177: <p>To update pkgsrc via CVS, change to the <code class="filename">pkgsrc</code> directory and run cvs:</p>
                    178: <pre class="screen"><code class="prompt">$</code> <strong class="userinput"><code>cd /usr/pkgsrc &amp;&amp; cvs update -dP</code></strong>
                    179: </pre>
                    180: <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>
                    181: <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>
                    182: </pre>
1.14      asau      183: <div class="sect3">
1.1       dsieger   184: <div class="titlepage"><div><div><h4 class="title">
1.51    ! martin    185: <a name="uptodate-cvs-switch"></a>3.2.2.1. Switching between different pkgsrc branches</h4></div></div></div>
1.1       dsieger   186: <p>When updating pkgsrc, the CVS program keeps track of the
                    187:        branch you selected. But if you, for whatever reason, want to
                    188:        switch from the stable branch to the current one, you can do it
1.51    ! martin    189:        by adding the option <span class="quote">“<span class="quote">-A</span>”</span> after the
        !           190:        <span class="quote">“<span class="quote">update</span>”</span> keyword. To switch from the current branch
1.1       dsieger   191:        back to the stable branch, add the
1.51    ! martin    192:        <span class="quote">“<span class="quote">-rpkgsrc-2025Q2</span>”</span> option.</p>
1.1       dsieger   193: </div>
1.14      asau      194: <div class="sect3">
1.1       dsieger   195: <div class="titlepage"><div><div><h4 class="title">
1.51    ! martin    196: <a name="uptodate-cvs-changes"></a>3.2.2.2. What happens to my changes when updating?</h4></div></div></div>
1.1       dsieger   197: <p>When you update pkgsrc, the CVS program will only touch
                    198:        those files that are registered in the CVS repository. That
                    199:        means that any packages that you created on your own will stay
                    200:        unmodified. If you change files that are managed by CVS, later
                    201:        updates will try to merge your changes with those that have been
                    202:        done by others. See the CVS manual, chapter
1.51    ! martin    203:        <span class="quote">“<span class="quote">update</span>”</span> for details.</p>
1.1       dsieger   204: </div>
                    205: </div>
                    206: </div>
                    207: </div>
                    208: <div class="navfooter">
                    209: <hr>
                    210: <table width="100%" summary="Navigation footer">
                    211: <tr>
                    212: <td width="40%" align="left">
1.51    ! martin    213: <a accesskey="p" href="help-user.html">Prev</a> </td>
1.1       dsieger   214: <td width="20%" align="center"><a accesskey="u" href="users-guide.html">Up</a></td>
1.51    ! martin    215: <td width="40%" align="right"> <a accesskey="n" href="platforms.html">Next</a>
1.1       dsieger   216: </td>
                    217: </tr>
                    218: <tr>
1.51    ! martin    219: <td width="40%" align="left" valign="top">Chapter 2. Getting help </td>
1.1       dsieger   220: <td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td>
1.51    ! martin    221: <td width="40%" align="right" valign="top"> Chapter 4. Using pkgsrc on systems other than NetBSD</td>
1.1       dsieger   222: </tr>
                    223: </table>
                    224: </div>
                    225: </body>
                    226: </html>

CVSweb <webmaster@jp.NetBSD.org>