4.5 Using the Ports Collection

- Remove the whole make deinstall business.  Tell people to run pkg_delete
  directly
- Move Ports and Disk Space after Upgrading Ports; count on people installing
  Portupgrade in Upgrading text, I'm showing some portupgrade utilities there.
  The section is rewritten anyway.
- Start Upgrading text with mention of pkg_version -v
- Cut the awfully informal chatter at the beginning of Upgrading text
- Reword the rest of Upgrading text, add examples in there
- Mention pkgdb -F earlier, kill <note>
- Suggest portsclean -C for mass cleaning
- Suggest portsclean -D for distfile cleanup
- Mention pkg_cutleaves tool
This commit is contained in:
Pav Lucistnik 2005-12-27 03:37:25 +00:00
parent 051265d88b
commit 39245f512e
Notes: svn2git 2020-12-08 03:00:23 +00:00
svn path=/head/; revision=26709

View file

@ -1090,55 +1090,13 @@ ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/distfiles/ fetch</userinput></screen>
later on decide that you installed the wrong port.
We will remove our previous example (which was
<command>lsof</command> for
those of you not paying attention). As with installing ports,
the first thing you must do is change to the port directory,
<filename>/usr/ports/sysutils/lsof</filename>. After you change
directories, you are ready to uninstall <command>lsof</command>.
This is done with
the <command>make deinstall</command> command:</para>
those of you not paying attention). Ports are being removed exactly
the same as the packages (discussed in the <link
linkend="packages-using">Packages section</link>), using the
&man.pkg.delete.1; command:</para>
<screen>&prompt.root; <userinput>cd /usr/ports/sysutils/lsof</userinput>
&prompt.root; <userinput>make deinstall</userinput>
===&gt; Deinstalling for lsof-4.57</screen>
<screen>&prompt.root; <userinput>pkg_delete lsof-4.57</userinput></screen>
<para>That was easy enough. You have removed
<command>lsof</command>
from your system. If you would like to reinstall it, you can do
so by running <command>make reinstall</command> from the
<filename>/usr/ports/sysutils/lsof</filename> directory.</para>
<para>The <command>make deinstall</command> and <command>make
reinstall</command> sequence does not work once you have run
<command>make clean</command>. If you want to deinstall a
port after cleaning, use &man.pkg.delete.1; as
discussed in the <link linkend="packages-using">Packages
section of the Handbook</link>.</para>
</sect2>
<sect2 id="ports-disk-space">
<title>Ports and Disk Space</title>
<indexterm>
<primary>ports</primary>
<secondary>disk-space</secondary>
</indexterm>
<para>Using the Ports Collection will use up disk
space over time. Because of this tendency of the ports tree to grow in size,
after building and installing software from the ports,
you should always remember to clean up
the temporary <filename class="directory">work</filename> directories using the <command>make
<makevar>clean</makevar></command> command. This will remove
the <filename class="directory">work</filename> directory after a port has been
built and installed. You can also remove the source distribution files from
the <filename class="directory">distfiles</filename> directory, and remove the
installed ports if the need for them has passed.</para>
<para>Some users choose to limit the available port categories by placing an entry
in the <filename>refuse</filename> file. This way, when they run the
<application>CVSup</application> application, it will not download the
files in that category. More information regarding the
<filename>refuse</filename> file can be found in <xref
linkend="cvsup-refuse-file">.</para>
</sect2>
<sect2 id="ports-upgrading">
@ -1151,6 +1109,11 @@ ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/distfiles/ fetch</userinput></screen>
<primary>ports</primary>
<secondary>upgrading</secondary>
</indexterm>
<para>First, list outdated ports that have a newer version available in
the Ports Collection with the &man.pkg.version.1; command:</para>
<screen>&prompt.root; <userinput>pkg_version -v</userinput></screen>
<note>
<para>Once you updated your Ports Collection, before
attempting a port upgrade, you should check the
@ -1159,41 +1122,38 @@ ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/distfiles/ fetch</userinput></screen>
encounter and need to perform when updating a port.</para>
</note>
<para>Keeping your ports up to date can be a tedious job. For
instance, to upgrade a port you would go to the ports
directory, build the port, deinstall the old port, install the
new port, and then clean up after the build. Imagine doing
that for five ports, tedious right? This was a large problem
for system administrators to deal with, and now we have
utilities which do this for us. For instance the <filename
role="package">sysutils/portupgrade</filename> utility will do
everything for you! Just install it like you would any other
port, using the <command>make <makevar>install
clean</makevar></command> command.</para>
<para>The <application>portupgrade</application> utility is designed
to easily upgrade installed ports. It is available from the <filename
role="package">sysutils/portupgrade</filename> port. Install it like
any other port, using the <command>make <makevar>install
clean</makevar></command> command:</para>
<para>Now create a database with the <command>pkgdb -F</command>
command. This will read the list of installed ports and
create a database file in the <filename>/var/db/pkg</filename>
directory. Now when you run <command>portupgrade
-a</command>, it will read this and the ports
<filename>INDEX</filename> file. Finally,
<application>portupgrade</application> will begin to download, build,
backup, install, and clean the ports which have been updated.
<application>portupgrade</application> comes with a lot of options
for different use cases, the most important ones will be presented
below.</para>
<screen>&prompt.root; <userinput>cd /usr/ports/sysutils/portupgrade</userinput>
&prompt.root; <userinput>make install clean</userinput></screen>
<para>If you want to upgrade only a certain application, not the
complete database, use <command>portupgrade
<replaceable>pkgname</replaceable></command>,
include the flags <option>-r</option> if
<application>portupgrade</application> should act on all
those packages depending on the given package as well, and
<option>-R</option> to act on all packages required by
the given packages.</para>
<para>Scan the list of installed ports with the <command>pkgdb
-F</command> command and fix all the inconsistencies it reports. It is
a good idea to do this regularly, before every upgrade.</para>
<para>When you run <command>portupgrade -a</command>,
<application>portupgrade</application> will begin to upgrade all the
outdated ports installed on your system. Use the <option>-i</option>
flag if you want to be asked for confirmation of every individual
upgrade.</para>
<screen>&prompt.root; <userinput>portupgrade -ai</userinput></screen>
<para>If you want to upgrade only a
certain application, not all available ports, use <command>portupgrade
<replaceable>pkgname</replaceable></command>. Include the
<option>-R</option> flag if <application>portupgrade</application>
should first upgrade all the ports required by the given
application.</para>
<screen>&prompt.root; <userinput>portupgrade -R firefox</userinput></screen>
<para>To use packages instead of ports for installation, provide
<option>-P</option>. With this option
<option>-P</option> flag. With this option
<application>portupgrade</application> searches
the local directories listed in <envar>PKG_PATH</envar>, or
fetches packages from remote site if it is not found locally.
@ -1201,24 +1161,48 @@ ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/distfiles/ fetch</userinput></screen>
<application>portupgrade</application> will use ports.
To avoid using ports, specify <option>-PP</option>.</para>
<screen>&prompt.root; <userinput>portupgrade -PR gnome2</userinput></screen>
<para>To just fetch distfiles (or packages, if
<option>-P</option> is specified) without building or
installing anything, use <option>-F</option>.
For further information see &man.portupgrade.1;.</para>
</sect2>
<sect2 id="ports-disk-space">
<title>Ports and Disk Space</title>
<indexterm>
<primary>ports</primary>
<secondary>disk-space</secondary>
</indexterm>
<para>Using the Ports Collection will use up disk
space over time. After building and installing software from the
ports, you should always remember to clean up
the temporary <filename class="directory">work</filename> directories using the <command>make
<makevar>clean</makevar></command> command. You can sweep the whole
Ports Collection with the following command:</para>
<screen>&prompt.root; <userinput>portsclean -C</userinput></screen>
<para>You will accumulate a lot of old source distribution files in the
<filename class="directory">distfiles</filename> directory over time.
You can remove them by hand, or you can use the following command to
delete all the distfiles that are no longer referenced by any
ports:</para>
<screen>&prompt.root; <userinput>portsclean -D</userinput></screen>
<note>
<para>It is important to regularly update the package database using
<command>pkgdb -F</command> to fix inconsistencies, especially when
<application>portupgrade</application> asks you to. Do not abort
<application>portupgrade</application> while it is updating the
package database, this will leave you an inconsistent
database.</para>
<para>The <command>portsclean</command> utility is part of the
<application>portupgrade</application> suite.</para>
</note>
<para>Other utilities exist which will do this, check out the
<filename>ports/sysutils</filename> directory and see what you
come up with.</para>
<para>Do not forget to remove the installed ports once you no longer need
them. A nice tool to help automate this task is available from the
<filename role="package">sysutils/pkg_cutleaves</filename> port.</para>
</sect2>
</sect1>
<sect1 id="ports-nextsteps">