PCT and OpenSolaris
By Jan Hlodan on Jun 16, 2009
What is PCT?
PCT means - Pre Consolidation Testing. We are using PCT for testing our patches and fixed packages before integration. We are able to find many bugs and fix them before official integration. It's also very good way for our engineers how to test their patches and packages.
PCT and OpenSolaris
1. System requires
2. Preparing the building machine
Install the Distribution Constructor (DC):
$ pfexec pkg install SUNWdistro-const
Copy and edit DC's manifest:
$ cp /usr/share/distro_const/slim_cd/all_lang_slim_cd_x86.xml ~/pct/
$ chmod +xw ~/pct/all_lang_slim_cd_x86.xml
$ vim ~/pct/all_lang_slim_cd_x86.xml
Change these sections as required:
Note: the image's name:
<pkg_repo_default_authority> <main url="http://repo_with_testing_packages" authname="testing.com"/>
Note: be sure that you set the IPS repository where the testing packages are pulled as a default _authority!
<pkg_repo_addl_authority> <main url="http://ipkg.sfbay/dev" authname="opensolaris.org"/>
Note: don't forget to uncomment addl_authority section and set dev repository (e.g. http://ipkg.sfbay/dev or public: http://pkg.opensolaris.org/dev )
Note: authname for the addl_authority must be different then for the default_authority!
Note: only if the different build_area is required.
<pkg name="entire"/> <pkg name="SUNWcsd"/> <pkg name="SUNWcs"/> <pkg name="babel_install"/> <pkg name="SUNWslim-utils"/> </packages>
Note: change only if some extra package should be installed on the Live CD. Then just add package name below the list.
Remove this section for the faster building process:
<script name="/usr/share/distro_const/create_usb"> <checkpoint name="usb" message="USB image creation"/> </script>
3. Publishing SVR4 packages to the local repository
You need to pull the testing packages to the local IPS repository.
There are two options how to publish SVR4 packages to the IPS repository:
- pkgsend(1) - image packaging system publication client
- solaris.py - script from the pkg gate (How to build and clone pkg gate you can find here)
Note: published packages must have the same or higher version, otherwise the Distribution Constructor will ignore them!
Open the transaction:
$ eval `pkgsend -s http://localhost:10000 open SUNWpackage@0.5.11,5.11-0.101`
Import the package
$ pkgsend -s http://localhost:10000 import SUNWpackage
Close the transaction
$ pkgsend -s http://localhost:10000 close
Open web browser and type: http://localhost:10000 to verify if SUNWpackage
is published to this repository. In this way the Distribution
Constructor will compare versions of SUNWpackage packages and choose
a newer/higher version automatically.
Note: this method is ideal for a simple package which does not contain any post-install scripts! Pkgsend(1) won't publish these scripts and the package will be uncompleted!
Pushing complicated packages up to the IPS repository involves using the solaris.py tool from the 'pkg gate' area where you set up your IPS repository. The solaris.py tool requires you to set up a directory with some stuff in it and then a meta file pointing to stuff in that directory.
I want to update SUNWslim-utils. I first create the directory with stuff in it. In this case, it's just a file containing the name of the package I want to push up to the IPS repository:
cd ~/gate/src/util/distro-import/ mkdir slim-utils cat > slim-utils/SUNWslim-utils << EOF package SUNWslim-utils import SUNWslim-utils end package
I then create a meta file pointing to the slim-utils stuff:
cd ~/gate/src/util/distro-import/ cat > slim-utils.list << EOF include slim-utils/SUNWslim-utils EOF
Now, run solaris.py:
cd ~/gate/src/util/distro-import ./solaris.py -b 0.131 -d -s http://localhost:10000 -w ~/slim_source/packages/i386/nightly-nd slim-utils.list
The "-b 0.131" specifies the revision. You just bump it up higher and higher to make sure that version is found. The "~/slim_source/packages/i386/nightly-nd" is the directory containing the packages.
Note you can use solaris.py to push any package you want. For example, I used it to push up eSpeak and gnome-speech packages.
As an anal retentive step, I check to make sure the IPS gives me the stuff I just gave it. That is, I want the SUNWslim-utils it gives me to be the one I put up there, not some older one. So, I run these commands (I needed to create a 'jack' user on my machine for this to work):
pkg image-create -F -a test=http://localhost:10000 /tmp/test-image pkg -R /tmp/test-image install SUNWslim-utils pkg -R /tmp/test-image list -av SUNWslim-utils
Pay attention to the revision number and such of the thing listed as "installed".### Modify build_dist.lib to Hack the Live CD's / ###
So, you want to hack more, such as monkey around with stuff under / or /etc on the Live CD? SUNWslim-utils is not the place to do that. Instead, you can mess around in the livemedia_processing method in distro_constructor/src/build.lib. For example, I added these lines to livemedia_processing to create /root/.orbitrc:
cat <⁞< \\ORBITRC_EOF > $PROTO/root/.orbitrc ORBIIOPIPv4=1 ORBIIOPUNIX=0 ORBITRC_EOF
Anywhere you want to muck with /, just use $PROTO/.
Now if you are done with publishing, you can run the Distribution Constructor to build the PCT image.
4. Building the PCT image
$ pfexec distro_const build ~/pct/all_lang_slim_cd.xml
After a few hours the building will finish and the PCT image can be found in the build_area (which you specified in the manifest).