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