Matplotlib 1.1.0 for Solaris on SPARC and x86, Part 3: Packaging

on

This is part 3 of a three-part series on building and packaging matplotlib as a multi-architecture, Solaris IPS package. In this tutorial, I go through creating a multiple architecture (fat) IPS package.

  1. Compiling matplotlib 1.1.0 for Solaris on SPARC and x86
  2. Setting up Solaris IPS servers to host packages for SPARC and x86
  3. Packaging matplotlib 1.1.0 for Solaris on SPARC and x86

I assume that the software has already been built and "installed" to a prototype installation folder on x86 and SPARC machines (I go through this for matplotlib in part 1). Second, I assume that three IPS servers are running, which I go through in part 2.

Create the IPS package / manifest

Since the directions are exactly the same for both sparc and x86, I only include one set of directions here. Where you see $ARCH, replace it with sparc on a sparc machine and i386 on an Intel machine.

Generate initial list of actions based on the "prototype install" folder.

$ pkgsend generate ~/install_$ARCH > mypackage.$ARCH.pkgsend

Add metadata. For larger projects, one could use pkgmogrify to automatically fill in $ARCH and other variables, but I just use a text file to keep things simple for this example.

$ vim mypackage.$ARCH.metadata
set name=pkg.fmri value=pkg://mycompany/mypackage
set name=variant.arch value=$ARCH
set name=pkg.description value="my package example."
set name=pkg.summary value="my package example."

Combine.

$ cat mypackage.$ARCH.metadata mypackage.$ARCH.pkgsend > mypackage.$ARCH.initial

When I created my package, the /usr directory was listed as having group bin. This conflicts with standard Solaris packages which expect the group to be sys, so this line needs to be changed. If a /usr/share line is present, it may need to be changed, too.

$ vim mypackage.$ARCH.initial
...
# Change this line from:
dir group=bin mode=0755 owner=root path=usr
# To:
dir group=sys mode=0755 owner=root path=usr

Generate file dependencies.

% pkgdepend generate -d ./install_$ARCH mypackage.$ARCH.initial > mypackage.$ARCH.depend

Resolve to package dependencies. This creates a *.res file. The justification for creating a file rather than outputting to stdout is that it can resolve multiple files to save work this way.

% pkgdepend resolve mypackage.$ARCH.depend

Check out the resolution file and append it to the manifest.

% ls *.res
mypackage.$ARCH.depend.res
% cat mypackage.$ARCH.initial mypackage.$ARCH.depend.res > mypackage.$ARCH.manifest

Take care of cosmetic issues, like proper line wrapping at 80 characters.

% pkgfmt mypackage.$ARCH.manifest

As a final check, run pkglint. Be sure to fix any errors that appear.

% pkglint mypackage.$ARCH.manifest

Give manifest a *.p5m extension for publishing.

% cp mypackage.$ARCH.manifest mypackage.$ARCH.p5m

Finally, publish the packages to the appropriate server. In this example I use http://myipsserver:8000 for sparc and http://myipsserver:8001 for x86.

% sudo pkgsend publish \
      -d ./install_sparc \
      -s http://myipsserver:8000 \
      mypackage.sparc.p5m
% sudo pkgsend publish \
      -d ./install_i386 \
      -s http://myipsserver:8001 \
      mypackage.i386.p5m

Merge the packages

Finally, now that each architecture-specific package is published, we can merge the two repositories into the multiple architecture repository.

$ pkgmerge -s arch=sparc,http://myipsserver:8000 \
    -s arch=i386,http://myipsserver:8001 \
    -d http://myipsserver

Test the package

The final step is to install the package and see if it worked. I recommend testing on a sparc machine and an x86 machine. I assume that the IPS (pkg command) publishers are setup correctly (pointing to the multiple architecture repository and with the correct publisher name).

pkg install pkg://mycompany/mypackage

Resources