Oracle Blog

News

Removing a package from a pkg(5) repository

Recently, several people have asked about how to remove a package from a pkg(5) repository.

First,
there isn't any tool for doing this. Generally, once a package is
published to a repository, it is meant to stay there forever. People
may have installed the package into images and if they run a "pkg fix",
the content of the package might again be needed from the repository.
But during development, cases arise in which a package might be
published to a repository by mistake, and there is a desire to remove
it before anyone installs it.

The manual steps for removing a package are:

1) Remove the package manifest from the $REPO/pkg directory
2) Remove the package entry from $REPO/catalog/catalog file
3) Remove any references to the package from any files in the $REPO/updatelog
directory
4) Edit the $REPO/catalog/attrs file to bump the package count down one

This is all without using the --rebuild option with pkg.depotd. If you do just step (1) and then
start pkg.depotd with --rebuild, then steps 2-4 will be done for you,
except that all of the files in the updatelog directory will be erased. The impact of not having updatelog files is:

a) Clients will not receive incremental updates of catalogs. If the
updatelog files are not there, the clients will always receive the full catalog.
b) The RSS feed of recently added packages will be empty if the updatelog files are not there.

This
procedure does not remove the compressed files associated with the
package. From the point of view of the client, the package will not be
in the repository, but the compressed files for the package are still
there taking up space. The difficultly in removing the compressed
files is that they may be shared with other versions of the package
that is being removed or with other packages. Before removing a
compressed file, one make sure that the file is not referenced by any
manifest in the repository, and currently there is not any tool
available to do that.