To keep this concrete, we will use the example of removing some symbolic links from the developer/gcc-3 package. That places symlinks to itself in /usr/bin, something we do not want, since a newer version of gcc is preferred in OI, and we want symlinks to that version to reside in /usr/bin.

First, we use pkgrecv to retrieve the package so that we can modify it.

herzen@oi:~/tmp$ pkg list -afv gcc-3
FMRI                                                                         IFO
pkg://openindiana.org/developer/gcc-3@3.4.3,5.11-0.151.1:20110912T022602Z    —
herzen@oi:~/tmp$ mkdir IPS_raw
herzen@oi:~/tmp$ pfexec pkgrecv -s http://pkg.openindiana.org/dev-il -d IPS_raw --raw pkg://openindiana.org/developer/gcc-3@3.4.3,5.11-0.151.1:20110912T022602Z
herzen@oi:~/tmp:$ cd IPS_raw

We now have a directory developer%2Fgcc-3 with a directory 3.4.3%2C5.11-0.151.1%3A20110912T022602Z in it, which is the raw IPS package. In the latter directory, we edit manifest to remove the symlinks we do not want from it. So, for example, we delete the line

link path=usr/bin/gcc target=../sfw/bin/gcc

Also, we need to remove the timestamp from the FMRI defined in the top line of the manifest. So we change

set name=pkg.fmri value=pkg://openindiana.org/developer/gcc-3@3.4.3,5.11-0.151.1:20110912T022602Z

to

set name=pkg.fmri value=pkg://openindiana.org/developer/gcc-3@3.4.3,5.11-0.151.1

Finally, we use pkgsend to republish the modified package to the local file-based repo.in /export/repo.

herzen@oi:~/tmp$ pfexec pkgsend -s /export/repo publish -d 3.4.3%2C5.11-0.151.1%3A20110912T022602Z --fmri-in-manifest 3.4.3%2C5.11-0.151.1%3A20110912T022602Z/manifest

You can now install our new gcc-3 after finding out its FMRI by doing pfexec pkg list -afv gcc-3. (We run that as root to allow pkg to refresh its list of packages.)