Annotation of htdocs/docs/pkgsrc/getting.html, revision 1.14
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>
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>
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.8 snj 62: <code class="literal">2009Q1</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.14 ! asau 66: <div class="sect2">
1.1 dsieger 67: <div class="titlepage"><div><div><h3 class="title">
68: <a name="getting-via-tar"></a>2.1.1. As tar file</h3></div></div></div>
69: <p>The primary download location for all pkgsrc files is
1.4 hubertf 70: <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 71: number of subdirectories for different purposes, which are
1.4 hubertf 72: 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 73: <p>The tar file for the current branch is in the directory
1.4 hubertf 74: <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 75: It is autogenerated daily.</p>
1.8 snj 76: <p>The tar file for the stable branch 2009Q1 is in the
77: directory <code class="filename">pkgsrc-2009Q1</code> and is also called <a class="ulink" href="ftp://ftp.NetBSD.org/pub/pkgsrc/pkgsrc-2009Q1/pkgsrc-2009Q1.tar.gz" target="_top"><code class="filename">pkgsrc-2009Q1.tar.gz</code></a>.</p>
1.5 weinem 78: <p>To download a pkgsrc stable tarball, run:</p>
79: <pre class="screen">
1.9 jakllsch 80: <code class="prompt">$</code> <strong class="userinput"><code>ftp ftp://ftp.NetBSD.org/pub/pkgsrc/<em class="replaceable"><code>pkgsrc-20xxQy</code></em>/<em class="replaceable"><code>pkgsrc-20xxQy</code></em>.tar.gz</code></strong></pre>
81: <p>Where <em class="replaceable"><code>pkgsrc-20xxQy</code></em> is the
1.5 weinem 82: stable branch to be downloaded, for example,
1.10 wiz 83: <span class="quote">“<span class="quote">pkgsrc-2009Q1</span>”</span>.</p>
1.5 weinem 84: <p>Then, extract it with:</p>
1.9 jakllsch 85: <pre class="screen"><code class="prompt">$</code> <strong class="userinput"><code>tar -xzf <em class="replaceable"><code>pkgsrc-20xxQy</code></em>.tar.gz -C /usr</code></strong></pre>
1.5 weinem 86: <p>This will create the directory <code class="filename">pkgsrc/</code>
87: in <code class="filename">/usr/</code> and all the package source will be
88: stored under <code class="filename">/usr/pkgsrc/</code>.</p>
89: <p>To download pkgsrc-current, run:</p>
90: <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 91: </div>
1.14 ! asau 92: <div class="sect2">
1.1 dsieger 93: <div class="titlepage"><div><div><h3 class="title">
1.10 wiz 94: <a name="getting-via-cvs"></a>2.1.2. Via anonymous CVS</h3></div></div></div>
95: <p>To fetch a specific pkgsrc stable branch, run:</p>
1.13 wiz 96: <pre class="screen"><code class="prompt">$</code> <strong class="userinput"><code>cd /usr && 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 97: </pre>
98: <p>Where <em class="replaceable"><code>pkgsrc-20xxQy</code></em> is the stable
99: branch to be checked out, for example, <span class="quote">“<span class="quote">pkgsrc-2009Q1</span>”</span></p>
100: <p>This will create the directory <code class="filename">pkgsrc/</code>
101: in your <code class="filename">/usr/</code> directory and all the package source
102: will be stored under <code class="filename">/usr/pkgsrc/</code>.</p>
103: <p>To fetch the pkgsrc current branch, run:</p>
1.13 wiz 104: <pre class="screen"><code class="prompt">$</code> <strong class="userinput"><code>cd /usr && cvs -q -z2 -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -P pkgsrc</code></strong>
1.1 dsieger 105: </pre>
1.12 dholland 106: <p>Refer to the <a class="ulink" href="http://www.NetBSD.org/mirrors/" target="_top">list of available mirrors</a> to choose a faster CVS mirror, if needed.</p>
1.10 wiz 107: <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 108: <pre class="screen"><code class="prompt">$</code> <strong class="userinput"><code>cd /usr && env CVS_RSH=ssh cvs -q -z2 -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -P pkgsrc</code></strong>
1.1 dsieger 109: </pre>
1.10 wiz 110: <p>Refer to documentation on your command shell how to set CVS_RSH=ssh permanently.
111: For Bourne shells, you can set it in your <code class="filename">.profile</code>
112: or better globally in <code class="filename">/etc/profile</code>:</p>
113: <pre class="programlisting">
114: # set CVS remote shell command
115: CVS_RSH=ssh
116: export CVS_RSH
1.1 dsieger 117: </pre>
1.10 wiz 118: <p>By default, CVS doesn't do things like most people would expect it to do.
119: But there is a way to convince CVS, by creating a file called <code class="filename">.cvsrc</code>
120: in your home directory and saving the following lines to it.
121: This file will save you lots of headache and some bug reports, so we strongly recommend it.
122: You can find an explanation of this file in the CVS documentation.</p>
1.2 rillig 123: <pre class="programlisting">
124: # recommended CVS configuration file from the pkgsrc guide
1.13 wiz 125: cvs -q -z2
1.2 rillig 126: checkout -P
1.3 rillig 127: update -dP
128: diff -upN
1.2 rillig 129: rdiff -u
1.10 wiz 130: release -d
1.2 rillig 131: </pre>
1.1 dsieger 132: </div>
133: </div>
1.14 ! asau 134: <div class="sect1">
1.1 dsieger 135: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
136: <a name="uptodate"></a>2.2. Keeping pkgsrc up-to-date</h2></div></div></div>
137: <p>The preferred way to keep pkgsrc up-to-date is via CVS
138: (which also works if you have first installed it via a tar
139: file). It saves bandwidth and hard disk activity, compared to
140: downloading the tar file again.</p>
1.14 ! asau 141: <div class="sect2">
1.1 dsieger 142: <div class="titlepage"><div><div><h3 class="title">
143: <a name="uptodate-tar"></a>2.2.1. Via tar files</h3></div></div></div>
1.14 ! asau 144: <div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
1.1 dsieger 145: <h3 class="title">Warning</h3>
146: <p>When updating from a tar file, you first need to
147: completely remove the old pkgsrc directory. Otherwise those
148: files that have been removed from pkgsrc in the mean time will
149: not be removed on your local disk, resulting in inconsistencies.
150: When removing the old files, any changes that you have done to
151: the pkgsrc files will be lost after updating. Therefore updating
152: via CVS is strongly recommended.</p>
153: </div>
154: <p>Note that by default the distfiles and the binary packages
155: are saved in the pkgsrc tree, so don't forget to rescue them
156: before updating. You can also configure pkgsrc to use other than
157: the default directories by setting the
158: <code class="varname">DISTDIR</code> and <code class="varname">PACKAGES</code>
1.4 hubertf 159: 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 160: <p>To update pkgsrc from a tar file, download the tar file as
161: explained above. Then, make sure that you have not made any
162: changes to the files in the pkgsrc directory. Remove the pkgsrc
163: directory and extract the new tar file. Done.</p>
164: </div>
1.14 ! asau 165: <div class="sect2">
1.1 dsieger 166: <div class="titlepage"><div><div><h3 class="title">
167: <a name="uptodate-cvs"></a>2.2.2. Via CVS</h3></div></div></div>
1.11 spz 168: <p>To update pkgsrc via CVS, change to the <code class="filename">pkgsrc</code> directory and run cvs:</p>
169: <pre class="screen"><code class="prompt">$</code> <strong class="userinput"><code>cd /usr/pkgsrc && cvs update -dP</code></strong>
170: </pre>
171: <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>
172: <pre class="screen"><code class="prompt">$</code> <strong class="userinput"><code>cd /usr/pkgsrc && env CVS_RSH=ssh cvs up -dP</code></strong>
173: </pre>
1.14 ! asau 174: <div class="sect3">
1.1 dsieger 175: <div class="titlepage"><div><div><h4 class="title">
176: <a name="uptodate-cvs-switch"></a>2.2.2.1. Switching between different pkgsrc branches</h4></div></div></div>
177: <p>When updating pkgsrc, the CVS program keeps track of the
178: branch you selected. But if you, for whatever reason, want to
179: switch from the stable branch to the current one, you can do it
1.10 wiz 180: by adding the option <span class="quote">“<span class="quote">-A</span>”</span> after the
181: <span class="quote">“<span class="quote">update</span>”</span> keyword. To switch from the current branch
1.1 dsieger 182: back to the stable branch, add the
1.10 wiz 183: <span class="quote">“<span class="quote">-rpkgsrc-2009Q3</span>”</span> option.</p>
1.1 dsieger 184: </div>
1.14 ! asau 185: <div class="sect3">
1.1 dsieger 186: <div class="titlepage"><div><div><h4 class="title">
187: <a name="uptodate-cvs-changes"></a>2.2.2.2. What happens to my changes when updating?</h4></div></div></div>
188: <p>When you update pkgsrc, the CVS program will only touch
189: those files that are registered in the CVS repository. That
190: means that any packages that you created on your own will stay
191: unmodified. If you change files that are managed by CVS, later
192: updates will try to merge your changes with those that have been
193: done by others. See the CVS manual, chapter
1.10 wiz 194: <span class="quote">“<span class="quote">update</span>”</span> for details.</p>
1.1 dsieger 195: </div>
196: </div>
197: </div>
198: </div>
199: <div class="navfooter">
200: <hr>
201: <table width="100%" summary="Navigation footer">
202: <tr>
203: <td width="40%" align="left">
204: <a accesskey="p" href="users-guide.html">Prev</a> </td>
205: <td width="20%" align="center"><a accesskey="u" href="users-guide.html">Up</a></td>
206: <td width="40%" align="right"> <a accesskey="n" href="platforms.html">Next</a>
207: </td>
208: </tr>
209: <tr>
210: <td width="40%" align="left" valign="top">Part I. The pkgsrc user's guide </td>
211: <td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td>
212: <td width="40%" align="right" valign="top"> Chapter 3. Using pkgsrc on systems other than NetBSD</td>
213: </tr>
214: </table>
215: </div>
216: </body>
217: </html>
CVSweb <webmaster@jp.NetBSD.org>