Spectacle Tutorial

Introduction

Spectacle is the toolset for packaging maintenance of MeeGo, including the tool to generate spec files from metadata file in YAML format, and tools to convert spec files or spec-builder's ini files to YAML format.

For spectacle managed packages, all generic packaging information will be stored in the YAML file, and it also allows maintaining customizations in the spec file directly with special enclosure tags.

Three separated tools will be installed:

Installation

Instruction

Several methods available for spectacle installation:

Requirements

Usage

specify

Usage: specify [options] [yaml-path]

Options:
  --version             show program's version number and exit
  -h, --help            show this help message and exit
  -o OUTFILE_PATH, --output=OUTFILE_PATH
                        Path of output spec file
  -s, --skip-scm        Skip to check upstream SCM when specified in YAML
  -N, --not-download    Do not try to download newer source files
  -n, --non-interactive
                    Non interactive running, to use default answers

ini2spectacle

Usage: ini2spectacle [options] [ini-path]

Options:
  --version             show program's version number and exit
  -h, --help            show this help message and exit
  -o OUTFILE_PATH, --output=OUTFILE_PATH
                        Path of output yaml file
  -f, --include-files   To store files list in YAML file

spec2spectacle

Usage: spec2spectacle [options] [spec-path]

Options:
  --version             show program's version number and exit
  -h, --help            show this help message and exit
  -o OUTFILE_PATH, --output=OUTFILE_PATH
                        Path of output yaml file
  -r, --replace-macros  To replace self-defined macros in spec file
  --no-builder-parsing  Do NOT try to parse build/install scripts
  -f, --include-files   To store files list in YAML file

Syntax of spectacle YAML

The syntax of YAML can be refered here: http://www.yaml.org/spec/

Two example spectacle YAML files are placed to examples/ directory in source code:

All available directives for spectacle are listed as the following:

CAUTION: The following cases of value string have special meaning in YAML syntax:

Then these string values need to be quoted by '(single-quote) or " (double-quote), and the choice of quote char should not conflict with the value string self.

Mandatory and valid keywords for all packages

Mandatory keywords

The following keywords are mandatory for main package:

The following keywords are mandatory for sub-package:

Valid keywords for sub-packages

For sub-packages, only a subset of keywords can be specified:

Keywords only for sub-packages

The following keywords are only valid for sub-packages:

Namespace support for multi-architecture in several keywords

For the following spectacle YAML keywords:

If one of the items need to be architecture specified, we can add arch prefix to it. The supported prefix and the corresponding architectures as the followings:

Here's some samples:

Requires:
    - arm:pkg-need-in-arm-image
    - ix86:pkg-need-in-x86-image
    - normal-pkg
ConfigOptions:
    - arm:--arm-specific-opt
    - ix86:--ix86-specific-opt
    - --common-opt

Customizations in spec

Generated spec files by specify will have many placeholders for customizations, such as:

# >> build pre
# << build pre

You can add any custom code between the markers, next time when you run specify, the text between the markers will be kept as is, all other sections relying on the meta data from the YAML file will be changed depending on the values in the YAML file.

The following placeholders in spec can be customized:

NOTE: The placeholder lines will NOT generated in spec by default. If you need customized macros2, it need be added manually before %pre section of the .spec file, and only once.

Internal Implementation

Spectacle uses cheetah templates to generate the spec file, based the metadata from YAML file. But the end users need not tackle it.

Tips