New pkg(5) version for the Toolkit
By ckamps on Oct 25, 2008
The multiplatform pkg(5) Toolkit 2.0 was based on an Image Packaging System drop from July 16, 2008. The UC2 project stopped taking new features from the pkg(5) team at that time so as to stabilize the build for the 2.0 release. In preparation for delivering the 2.1 Toolkit, we are bringing in the latest pkg(5) software. This article highlights some of the new pkg(5) features that will be part of the toolkit and explains what changes were needed in the toolkit updatetool software to accommodate the new release.
Summary of New Features
The pkg(5) software now maintains a history of operations that have been performed on the image. The history can be accessed with the "pkg history" command and can be cleared out with the "pkg purge-history" command.
|Improved Search||The search feature has been improved to use more complete indexing and better data structures to improve performance. This is for both the local image and for the server.|
|Repository HTML Interface||The HTML interface for the repository has been improvided to provide links to the meta data about a package and the manifest for the package. An RSS feed capability has been added so that an RSS reader can be used to track additions to a repository. The RSS link is available on the HTML page for the repository.|
|Data Collection||The pkg(5) client now forwards information about the operations that are being performed to the the pkg.depotd server using a new HTTP header, X-IPkg-Intent.|
|New Programming API||The pkg(5) software now has a new client programming API that is intended to be more stable.|
|Actuators||The actuator feature allows package actions to be associated with a behavior that is activated either before or after the action is installed or removed. The only implementation of actuators at this time is for an SMF refresh. In the future, the plan is to implement some sort of user image actuator that would provide support for implementing configuration logic in a user image.|
|Automatic Refresh||Commands that change the repository URL for an authority now automatically update the catalog for that authority. An option is provided to not do this automatic refresh.|
|Updated pkg.depotd Server Infrastructure||The pkg.depotd server is now based on the CherryPy 3.1 framework.|
|New pkg(1) command line options||
Bringing this new version of pkg(5) into the Update Center 2 project requires several changes to the toolkit software. The pkg(5) internal changes and the toolkit changes that result include:
- The operational history feature requires that the name of the client be set when an Image object is created. This results in an img.history.client_name = 'updatetool' statement following the creation of each Image object.
- The ImagePlan constructor and Image.make_install_plan now take an additional argument, a function that indicates whether the command has been canceled. Throughout the toolkit, a function that always returns false is passed in for now. The toolkit may be able to leverage this later.
- The Image.load_optional_dependencies method takes
an additional argument, a progress tracker. Since updatetool wasn't
tracking this before, a quiet tracker is used for now.
- An ImagePlan now deletes the list of PkgPlan objects (pkg_plans) after the the plan is executed to save memory. Updatetool has one situation where it uses the list of PkgPlans after the plan is executed, so the list has to be saved away now before it gets deleted by the ImagePlan.
- The Image.split_authority method now returns the list of mirrors too. All calls this this method have been modified to expect the new return value.
- There is a new module, global_settings, for setting global settings. The misc.MAX_TIMEOUT_COUNT value was moved to that new module.
- The Image.find_root method now throws an ImageNotFoundException rather than a ValueError when the directory that is passed in is not within an image.
- The noexecute argument for the Image.make_install_plan method is now required rather than being a keyword argument.
- The ProgressTracker class has 3 new methods that must be defined by any derived class.
- The pkg.depotd process now runs a subprocess of itself to do indexing of the repository. This required some changes in the makepkgs and makeimage tools.
- The new version of CherryPy changes the way that the customized DepotResponse is passed into the server. This requires changes to the way the toolkit starts the server.
As development of 2.1 proceeds, we expect that the pkg(5) gate will be brought into the multi-platform toolkit builds more frequently up until it becomes necessary to stabilize the build in preparation for the release of 2.1.