The Update Center Toolkit project developed a makepkgs.py script that enables a pkg(5) package to be specified using a Python data format. Since it uses a single Python process to publish a package, it has the speed advantage of the intermediate SVR4 package without having to depend on the use of SVR4 packaging tools.
The makepkgs.py tool is available as part of the pkg(5) Multi-platform toolkit Downloads.
The makepkgs.py script is used by first creating a Python module that defines the package. For example, a Python module for the package, foo_proto.py, would be:
An Example
pkg = {
"name" : "foo",
"version" : "1.0,0-0.1",
"attributes" : {
"pkg.summary" : "Foo Package",
"pkg.description" : "Foo solves world hunger and reduce global warming. It also cures male pattern baldness, " \
"cancer and AIDS all while humming a nice tune.",
},
"dirtrees" : [ "foo" ],
}
Unlike the script-based approach, makepkgs.py doesn't support renaming of files as they are put into packages. It assumes that the content of the package has already been laid out on disk by the build system in the way that it is to appear on the target system. However, there is provision for selecting individual files from a directory tree and for creating directories. There is also support for defining license actions and dependencies on other packages.
Once the foo_proto.py file is defined, then pkg(5) package publishing is done using the following command:
python makepkgs.py -s http://pkg.example.com:10000/ -b basedir foo_proto.py
This command assumes that there is a pkg(5) repository server running at pkg.example.com:10000. The makepkgs.py command also supports using a "-d ''repodir''" option instead of the -s option that creates a repository in a local directory. With the -d option, then no external pkg.depotd server is needed (the command itself runs one).
Before running this command the PYTHONPATH must be set to include the directories containing the makepkgs tool and the pkg(5) libraries, including the pkg(5) depot.py file. Also, LD_LIBRARY_PATH must include the lib directory of the minimized python that is included with the Update Center Toolkit. The pkg(5) library files are in the pkg/vendor-packages directory within the distribution.
If you download one of the preinstalled pkg(5) toolkit distributions, you can unzip it anywhere. Once you have the distribution at $DIST, the commands are:
$DIST/pkg/python2.4-minimal/python tools/makepkgs.py ....
Since the depot.py file that is mentioned is already in the right place, so nothing special has to be done for that.
If you use a Python from your system, say from /usr/bin/python, then setting PYTHONPATH is necessary. The setting would be:
export PYTHONPATH=$DIST/pkg/vendor-packages
The ''basedir'' in the command above is the directory that contains the ''foo'' directory that contains the files to be included in the package.
The makepkgs.py script can take a list of packages to be published so that many packages can be published using a single command.
To see examples of proto modules that use all of makepkgs.py features, see the various proto files that are included in the tools subdirectory of the Update Center Toolkit source code.
Examples of Prototype Files
NOTE: The following examples include version strings that do not include branch_version settings. The absence of the branch_version settings is due to the fact that the build process of the UC2 toolkit automatically sets the branch_version value to the current Subversion revision number. In your cases, you will need to include a branch_version number.
| Package | Comments |
|---|---|
| pkg | |
| pkg-java | |
| pkg-extra-tools | |
| updatetool | |
| python2.4-minimal | Demonstrates excludefiles feature |
| wxpython2.8-minimal |