SourceForge.net Logo    pkgbuild

 
About
Manual
Screenshots
License
Download
Bugs
Mailing lists
SFE
Wiki
 

IPS support for pkgbuild

About IPS

Current status

  • Automatically detects IPS and uses it
  • Publishes packages to the local repository (if enabled), or to the one defined in the PKGBUILD_IPS_SERVER env variable
  • Falls back to SVr4 if IPS is not found or not enabled
  • Automatically installs the packages from the repository
  • Uses OpenSolaris compliant package versioning
  • Automatically translates SVr4 package names of dependencies to IPS package names (e.g. if your spec file requires SUNWPython-devel, pkgbuild will figure out that it's included in SUNWPython on OpenSolaris)
  • "subpackages" defined in the spec file using %package are merged in the main package and tagged with the package name, unless %package -n is used. For example, the following definitions:

    Name: foo
    ...
    
    %package devel
    ...
    
    %package doc
    ...
    
    %package -n foo-extras
    ...
    

    will create 2 packages: foo and foo-extras. Files that are listed in %foo devel are included in package foo and tagged with devel (in the manifest: "devel=true") and, similarly, files listed in %files doc are also included in package foo and are tagged with doc ("doc=true").

  • uninstall-pkgs does not work, because IPS does not support uninstalling packages that are dependencies of other packages
  • Additional stuff needed for full IPS support:
    • need to define and implement additional spec file elements for attributes and tags, e.g. %tag (foo) in %files and Attribute(name): value
    • build IPS source packages that can be rebuilt automatically

Installation

  • Install OpenSolaris
  • Install the Desktop CBE from opensolaris.org (see more details here)
  • Download pkgbuild-ips the tarball (see below)
  • Remove the [old] version of pkgbuild that comes with the Desktop CBE:

    pfexec pkgrm SFpkgbuild
    

  • Build pkgbuild-ips:

    bzcat pkgbuild-1.3.98.tar.bz2 | tar xf -
    cd pkgbuild-1.3.98
    ./configure --prefix=/opt/dtbld/
    make
    pfexec make install
    

  • Workaround for an ACLOCAL problem you may see when building packages:

    Add the following lines to

    /usr/share/aclocal/dirlist

    /usr/sfw/share/aclocal
    /opt/dtbld/share/aclocal
    

  • Enable the IPS server on your machine:

    svcadm enable pkg/server
    

Usage

  • To download the sources, build and install a package from a spec file:

    pkgtool build --download foo.spec
    

  • pkgtool cannot uninstall IPS packages, so if you wish to uninstall one, you need to do it using pkg(1)

    pfexec pkg uninstall foo
    

    Note: you cannot uninstall a package if other packages depend on it.

  • You can update packages to newer versions (note: the version number must be higher!)

    pkgtool build --update foo.spec
    

Developing spec files

  • The syntax and semantics of spec files is very similar to RPM's spec files. There is a wealth of information and tutorials available for RPM spec file so I will not repeat all that. Some pointers can be found on the pkgbuild web site. The SVr4-specific differences are also detailed there. In this section I describe the IPS-specific differences.
    • IPS specific tags:

      Meta(name): value Adds a package attribute called "name" with the value "value"
      IPS_component_version see Package versioning below
      IPS_build_version see Package versioning below
      IPS_vendor_version see Package versioning below

    • Other spec file tags translate to IPS package attributes as follows:

      Name pkg.name
      Summary description
      Summary pkg.summary
      Url info.upstream_url (defaults to http://pkgbuild.sf.net/)
      Group info.classification (freedesktop.org:: is prepended to the value of Group)
      SUNW_Copyright license
      Meta(<name>) <name>

      Note: info.maintainer_url defaults to pkgbuild-sfe-devel@sourceforge.net

    • Package naming

      The same spec file can be used to build SVr4 and IPS packages, in fact an SVr4 package is always built before an IPS package and the IPS transaction publishes the files directly from the SVr4 package. The IPS package names, however need not be the same as the SVr4 package names. When building IPS packages, the Name tag is used to define the name of the package. This is also the default for the SVr4 package name, but it can be overridden using the SUNW_Pkg tag. Example: the following spec file fragment defines an IPS package called "foo" and a corresponding SVr4 package called "SUNWfoo":

      Name: foo
      Version: 1.0
      SUNW_Pkg: SUNWfoo
      

      Without the SUNW_Pkg tag, both the IPS and the SVr4 package would be called "foo".

      Packages defined in the same spec file are considered "subpackages" unless they are defined with the -n option (i.e. %package -n <name>). Subpackages become separate SVr4 packages, but they are merged in the main IPS package. Files belonging to the subpackages are tagged in IPS with the name of the subpackage. Example: the following spec file fragment defines 1 IPS package, but 2 SVr4 packages:

      Name: foo
      ...
      
      %package devel
      ...
      
      %files
      ...
      
      %files devel
      ...
      

      Files listed in %files devel are tagged with "devel=true" in the IPS manifest, but they are included in the "foo" package. The SVr4 packages will be called "foo" and "foo-devel".

      If we add a SUNW_Pkg tag, the SVr4 package names are changed, but not the IPS package name:

      Name: foo
      SUNW_Pkg: SUNWfoo
      ...
      
      %package devel
      ...
      
      

      This will create 2 SVr4 packages: "SUNWfoo" and "SUNWfoo-devel" and a single IPS package called "foo" The fun doesn't stop here :) Packages created using %package -n <name> are not considered subpackages therefore separate IPS packages (and of course separate SVr4 packages) are created:

      Name: foo
      SUNW_Pkg: SUNWfoo
      ...
      
      %package devel
      ...
      
      %package -n foo-extras
      SUNW_Pkg: SUNWfoo-extras
      ...
      
      

      The above spec file fragment creates 2 IPS packages: "foo" and "foo-extras" (remember, the "devel" files are included in "foo" and tagged with "devel=true"). It creates 3 SVr4 packages: "SUNWfoo", "SUNWfoo-devel" and "SUNWfoo-extas".

    • Package versioning

      The IPS package version string consists of the following components:

      • component version: this is the upstream version number of the component, e.g. 2.6.1 for Python-2.6.1
      • build version: this is the version of OpenSolaris that the binaries were built on, e.g. 5.11
      • vendor version (or branch version): this is for vendor-specific versioning. In the case of OpenSolaris package, it contains the OpenSolaris build number.
      • timestamp: the time of publishing (assigned by the IPS server)Except for timestamp, pkgbuild has IPS-specific tags to define the above version string components.
      They also have sensible defaults:

      IPS_component_version value of the Version tag
      IPS_build_version `uname -r`
      IPS_vendor_version 0.`uname -v`

      And they can also be defined on the command line as macros:

      pkgtool build --define 'ips_vendor_version 0.107' foo.spec
      

    • Dependencies

      In short: use SVr4 package names in dependencies.

      Details:

      pkgbuild spec files (like RPM spec files) define build time and runtime dependencies:

      BuildRequires: pkg1, ... build time dependency
      Requires: pkga, ... runtime dependency

      As the name suggests, build time dependencies must be installed for building a binary package from the sources, while runtime dependencies a required for the binaries to function. Build time dependencies are not recorded in the IPS or SVr4 packages. They are included in the spec file and pkgbuild verifies their presence before commencing the build. Runtime dependencies are recorded in the IPS (and SVr4) packages as package dependencies. Since the same spec file is used for both IPS and SVr4, pkgbuild expect the package names in the Requires/BuildRequires tags to be SVr4 package names. When creating IPS packages, pkgbuild translates the SVr4 package names to IPS package names by searching for "legacy" actions that define those package names. Packages without legacy tags are not visible to pkgbuild.

    Downloads

    History

    Last Updated: laszlo.peter _at_ gmail.com 2009-02-01