pkgsrc/doc/guide/files/getting.xml
sevan 63272a3282 Point to 2016Q4.
Archives are generated weekly.
2017-01-07 01:24:05 +00:00

221 lines
9 KiB
XML

<!-- $NetBSD: getting.xml,v 1.34 2017/01/07 01:24:05 sevan Exp $ -->
<chapter id="getting">
<title>Where to get pkgsrc and how to keep it up-to-date</title>
<para>Before you download and extract the files, you need to decide
where you want to extract them. When using pkgsrc as root user, pkgsrc
is usually installed in <filename>/usr/pkgsrc</filename>. You are though
free to install the sources and binary packages wherever you want in
your filesystem, provided that the pathname does not contain white-space
or other characters that are interpreted specially by the shell and some
other programs. A safe bet is to use only letters, digits, underscores
and dashes.</para>
<sect1 id="getting-first">
<title>Getting pkgsrc for the first time</title>
<para>Before you download any pkgsrc files, you should decide
whether you want the <emphasis>current</emphasis> branch or the
<emphasis>stable</emphasis> branch. The latter is forked on a
quarterly basis from the current branch and only gets modified
for security updates. The names of the stable branches are built
from the year and the quarter, for example
<literal>2016Q4</literal>.</para>
<para>The second step is to decide <emphasis>how</emphasis> you
want to download pkgsrc. You can get it as a tar file or via CVS.
Both ways are described here.</para>
<para>Note that tar archive contains CVS working copy.
Thus you can switch to using CVS at any later time.</para>
<sect2 id="getting-via-tar">
<title>As tar archive</title>
<para>The primary download location for all pkgsrc files is
<ulink url="http://ftp.NetBSD.org/pub/pkgsrc/"/> or
<ulink url="ftp://ftp.NetBSD.org/pub/pkgsrc/"/>
(it points to the same location).
There are a number of subdirectories for different purposes,
which are described in detail in <xref linkend="ftp-layout"/>.</para>
<para>The tar archive for the current branch is in the directory
<filename>current</filename> and is called <ulink
url="http://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc.tar.gz"><filename>pkgsrc.tar.gz</filename></ulink>.
It is autogenerated weekly.</para>
<para>To save download time we provide bzip2- and
xz-compressed archives which are published at
<ulink url="http://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc.tar.bz2"><filename>pkgsrc.tar.bz2</filename></ulink>
and
<ulink url="http://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc.tar.xz"><filename>pkgsrc.tar.xz</filename></ulink>
respectively.
</para>
<para>You can fetch the same files using FTP.</para>
<para>The tar file for the stable branch 2016Q4 is in the
directory <filename>pkgsrc-2016Q4</filename> and is also called <ulink
url="ftp://ftp.NetBSD.org/pub/pkgsrc/pkgsrc-2016Q4/pkgsrc.tar.gz"><filename>pkgsrc.tar.gz</filename></ulink>.</para>
<para>To download a pkgsrc stable tarball, run:</para>
<screen>
&uprompt; <userinput>ftp ftp://ftp.NetBSD.org/pub/pkgsrc/<replaceable>pkgsrc-20xxQy</replaceable>/pkgsrc.tar.gz</userinput></screen>
<para>Where <replaceable>pkgsrc-20xxQy</replaceable> is the
stable branch to be downloaded, for example,
<quote>pkgsrc-2016Q4</quote>.</para>
<para>If you prefer, you can also fetch it using "wget", "curl",
or your web browser.</para>
<!--
<para>After downloading the tar file, change to the directory
where you want to have pkgsrc. This is usually
<filename>/usr</filename>. Then, run <command>gzcat
pkgsrc.tar.gz | tar xf -</command> to extract the files.</para>
-->
<para>Then, extract it with:</para>
<screen>&uprompt; <userinput>tar -xzf pkgsrc.tar.gz -C /usr</userinput></screen>
<para>This will create the directory <filename>pkgsrc/</filename>
in <filename>/usr/</filename> and all the package source will be
stored under <filename>/usr/pkgsrc/</filename>.</para>
<para>To download pkgsrc-current, run:</para>
<screen>&uprompt; <userinput>ftp ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc.tar.gz</userinput></screen>
</sect2>
<sect2 id="getting-via-cvs">
<title>Via anonymous CVS</title>
<para>To fetch a specific pkgsrc stable branch, run:</para>
<screen>&uprompt; <userinput>cd /usr &amp;&amp; cvs -q -z2 -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -r <replaceable>pkgsrc-20xxQy</replaceable> -P pkgsrc</userinput>
</screen>
<para>Where <replaceable>pkgsrc-20xxQy</replaceable> is the stable
branch to be checked out, for example, <quote>pkgsrc-2016Q4</quote></para>
<para>This will create the directory <filename>pkgsrc/</filename>
in your <filename>/usr/</filename> directory and all the package source
will be stored under <filename>/usr/pkgsrc/</filename>.</para>
<para>To fetch the pkgsrc current branch, run:</para>
<screen>&uprompt; <userinput>cd /usr &amp;&amp; cvs -q -z2 -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -P pkgsrc</userinput>
</screen>
<para>Refer to the <ulink url="http://www.NetBSD.org/mirrors/#anoncvs">list of available mirrors</ulink> to choose a faster CVS mirror, if needed.</para>
<!-- FIXME: All this CVS magic should move into appendix or so. -->
<para>If you get error messages from <literal>rsh</literal>, you need to set CVS_RSH variable. E.g.:</para>
<screen>&uprompt; <userinput>cd /usr &amp;&amp; env CVS_RSH=ssh cvs -q -z2 -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -P pkgsrc</userinput>
</screen>
<para>Refer to documentation on your command shell how to set CVS_RSH=ssh permanently.
For Bourne shells, you can set it in your <filename>.profile</filename>
or better globally in <filename>/etc/profile</filename>:</para>
<programlisting>
# set CVS remote shell command
CVS_RSH=ssh
export CVS_RSH
</programlisting>
<!-- FIXME: This should move into appendix or so. -->
<para>By default, CVS doesn't do things like most people would expect it to do.
But there is a way to convince CVS, by creating a file called <filename>.cvsrc</filename>
in your home directory and saving the following lines to it.
This file will save you lots of headache and some bug reports, so we strongly recommend it.
You can find an explanation of this file in the CVS documentation.</para>
<programlisting>
# recommended CVS configuration file from the pkgsrc guide
cvs -q -z2
checkout -P
update -dP
diff -upN
rdiff -u
release -d
</programlisting>
</sect2>
</sect1>
<sect1 id="uptodate">
<title>Keeping pkgsrc up-to-date</title>
<para>The preferred way to keep pkgsrc up-to-date is via CVS
(which also works if you have first installed it via a tar
file). It saves bandwidth and hard disk activity, compared to
downloading the tar file again.</para>
<sect2 id="uptodate-tar">
<title>Via tar files</title>
<warning><para>When updating from a tar file, you first need to
completely remove the old pkgsrc directory. Otherwise those
files that have been removed from pkgsrc in the mean time will
not be removed on your local disk, resulting in inconsistencies.
When removing the old files, any changes that you have done to
the pkgsrc files will be lost after updating. Therefore updating
via CVS is strongly recommended.</para></warning>
<para>Note that by default the distfiles and the binary packages
are saved in the pkgsrc tree, so don't forget to rescue them
before updating. You can also configure pkgsrc to store distfiles
and packages in directories outside the pkgsrc tree by setting the
<varname>DISTDIR</varname> and <varname>PACKAGES</varname>
variables. See <xref linkend="configuring"/> for the details.</para>
<para>To update pkgsrc from a tar file, download the tar file as
explained above. Then, make sure that you have not made any
changes to the files in the pkgsrc directory. Remove the pkgsrc
directory and extract the new tar file. Done.</para>
</sect2>
<sect2 id="uptodate-cvs">
<title>Via CVS</title>
<para>To update pkgsrc via CVS, change to the <filename>pkgsrc</filename> directory and run cvs:</para>
<screen>&uprompt; <userinput>cd /usr/pkgsrc &amp;&amp; cvs update -dP</userinput>
</screen>
<para>If you get error messages from <literal>rsh</literal>, you need to set CVS_RSH variable as described above. E.g.:</para>
<screen>&uprompt; <userinput>cd /usr/pkgsrc &amp;&amp; env CVS_RSH=ssh cvs up -dP</userinput>
</screen>
<sect3 id="uptodate-cvs-switch">
<title>Switching between different pkgsrc branches</title>
<para>When updating pkgsrc, the CVS program keeps track of the
branch you selected. But if you, for whatever reason, want to
switch from the stable branch to the current one, you can do it
by adding the option <quote>-A</quote> after the
<quote>update</quote> keyword. To switch from the current branch
back to the stable branch, add the
<quote>-rpkgsrc-2016Q4</quote> option.</para>
</sect3>
<sect3 id="uptodate-cvs-changes">
<title>What happens to my changes when updating?</title>
<para>When you update pkgsrc, the CVS program will only touch
those files that are registered in the CVS repository. That
means that any packages that you created on your own will stay
unmodified. If you change files that are managed by CVS, later
updates will try to merge your changes with those that have been
done by others. See the CVS manual, chapter
<quote>update</quote> for details.</para>
</sect3>
</sect2>
</sect1>
</chapter>