Another common use case is to republish packages under a new publisher name. One case when this is useful is to consolidate packages from multiple repositories into a single repository. For example, you might want to consolidate packages from repositories of several different development teams into a single repository for integration testing.
To republish under a new publisher name, use the pkgrecv, pkgmogrify, pkgrepo, and pkgsend steps shown in the previous example.
The following sample transform changes the publisher to mypublisher:
<transform set name=pkg.fmri -> edit value pkg://[^/]+/ pkg://mypublisher/>
You can use a simple shell script to iterate over all packages in the repository. Use the output from pkgrecv --newest to process only the newest packages from the repository.
The following script saves the above transform in a file named change-pub.mog, and then republishes from development-repo to a new repository new-repo, changing the package publisher along the way:
#!/usr/bin/ksh93 pkgrepo create new-repo pkgrepo -s new-repo set publisher/prefix=mypublisher mkdir incoming for package in $(pkgrecv -s ./development-repo --newest); do pkgrecv -s development-repo -d incoming --raw $package done for pdir in incoming/*/* ; do pkgmogrify $pdir/manifest change-pub.mog > $pdir/manifest.newpub pkgsend -s new-repo publish -d $pdir $pdir/manifest.newpub done
This script could be modified to do tasks such as select only certain packages, make additional changes to the versioning scheme of the packages, and show progress as it republishes each package.