Package writing guidelines

This page tries to start effort on documenting various practices used in building package. It's not complete, but hopefully one day will be

General rules

To avoid work duplication

... it is suggested to announce your work before or soon after you started. sfwnv-discuss@OpenSolaris.org

C++ code has to be compiled using SunStudio CC. g++ is not allowed

Sorry. Binary output from different C++ compilers does not mix. You can use gcc for c code, but not g++ for C++ code.
Nice summary is also here: http://pkgbuild.wiki.sourceforge.net/SFE_cpp_libs

Makefile rules

Use "env - ..." and not "env ..." in the Makefiles

... to make sure "configure" & "make" only see the env variables they should really get(and not pick-up any random environment variable)

Use either $(SHELL) or /usr/bin/bash for configure scripts

configure scripts should be executed in a specific shell so we know which one is used and configure doesn't pick one itself.

  • Use $(SHELL) (which is ksh93 by default) whenever possible. This documents that the configure script works with ksh93
    Invoke configure as $(SHELL) ./configure $(CONFIGURE_OPTIONS)
  • Use /usr/bin/bash if the configure script does not work with $(SHELL)
    Invoke configure as /usr/bin/bash ./configure $(CONFIGURE_OPTIONS)

Install Scripts

install-sfw scripts should use /usr/bin/ksh93 or /usr/bin/bash

  • should use /usr/bin/ksh93 or /usr/bin/bash
  • add a '$ set -o errexit' at the beginning
  • replace ". $SRC/tools/install.subr" with "source $SRC/tools/install.subr"
  • the idea is to catch failures in the script and abort it at that point, right now the script will just continue.

Scripts should be validated

Verify that all shell scripts added or changed pass
> /usr/bin/ksh93 -n script.sh
any warnings are SERIOUS bugs in the code and must be fixed.

METADATA

For all open source components to be included in the SFW consolidation, a METADATA file with relevant information about the component should be included in the package's top directory (where the package specific Makefile.sfw lives).  This file contains a set of common data in a common format and is largely static.  Updates to this file are likely to be prompted by bug fixing or component upgrade, but little else is expected to cause any updates.

NOTE: As of 2009-05-07, components integrating into the SFW gate must have a METADATA file and this file must contain all of the fields described below.  The SFW build now validates the file prior to building each component and will fail if it doesn't exist or contains data that is not properly formatted.

Example:

NAME:             cups
VERSION:          1.3.9
DESCRIPTION:      Common Unix Print System
LICENSE:          CUPS, Aladdin, Unicode
PACKAGE:          SUNWcupsr SUNWcupsu
PROJECT_URL:      http://www.cups.org/
SOURCE_DOWNLOAD:  http://ftp.easysw.com/pub/cups/1.3.9/cups-1.3.9-source.tar.bz2
SUPPORT:          C
BUGTRAQ:          solaris/print/cups
OSR:              8430
COMMENTS:
    Any additional information that you want to supply goes down here

A complete description of the fields follows:

Field
Description
NAME
The "short" name that the open source project is known by, usually the prefix used in naming the source archive.
VERSION
The full version string ofthe version of the open source project.
DESCRIPTION
A one line summary of what the open source project supplied.
LICENSE
A comma separated list of license names that apply to this software. (see @licenses in $(SRC)/tools/metainfo.pl for a list of more common abreviations.
PACKAGE
A whitespace separated list of SVR4 package names containing the software, when built.
PROJECT_URL
The URL to the open source project page.
SOURCE_DOWNLOAD
A URL that can be used to download the source.  This URL must always end with /{name-of-source-archive-file}. If you can't locate a URL in that format, please use ftp://tarballs.opensolaris.org/pub/{name-of-source-archive-file} and place the actual source archive download URL (from the project page) in the comments section of this file on a line by itself using "download={url}
SUPPORT
One of
  • C:  Support will only be provided through community update.
  • B:  Support will primarily provided through community update, but severe issues may be addressed
  • A:  Support may be provided through community update, but will be as expected for all software written in-house.
BUGTRAQ
A string in the form {product}/{category}/{subcategory}
OSR
The OpenSource Review number assigned by Sun legal.
COMMENTS
Start of comments section of the file.  The rest of this line should be blank and the rest of the file is considered to be a comment block.

Values for all keys except for the COMMENTS: section should consist of one line only to allow for easy parsing of metadata.

The COMMENTS section must come last in the METADATA file

CDDL and Copyright Headers

  • The official CDDL header and Copyright lines format are given in the onnv-gate prototypes.

Root and Usr Packages

  • Externally there is a bit in the devref:

http://opensolaris.org/os/community/on/devref_toc/devref_4/#4_4_3_packages

  • Internally there's a bit in the gate README in the 'hints on integration' section about creating packages:

Remember that you may need separate root and usr packages.  If you deliver anything into a filesystem other than /usr, or touch such files in class-action or other package scripts,then you probably need a root package - consult the gatekeepers if you are unsure how to proceed.

  • Of course the build attempts to catch this so we don't have a mad scramble when trying to deliver the packages to RE weeks later.

WEBREV review

  • Prior to submitting a review webrev to the forum, check the contents of the webrev yourself and remove any silly mistakes you may have made. This will save the reviewers time.
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.

Sign up or Log in to add a comment or watch this page.


The individuals who post here are part of the extended Sun Microsystems community and they might not be employed or in any way formally affiliated with Sun Microsystems. The opinions expressed here are their own, are not necessarily reviewed in advance by anyone but the individual authors, and neither Sun nor any other party necessarily agrees with them.

© 2010, Oracle Corporation and/or its affiliates
Powered by Atlassian Confluence
Oracle Social Media Participation Policy Privacy Policy Terms of Use Trademarks Site Map Employment Investor Relations Contact