buildstream.project module

Loaded Project Configuration

The Project object holds all of the project settings from the project configuration file including the project directory it was loaded from.

The project configuration file should be named project.conf and be located at the project root. It holds information such as Source aliases relevant for the sources used in the given project as well as overrides for the configuration of element types used in the project.

The default BuildStream project configuration is included here for reference:
# Default BuildStream project configuration.

# Project name
#
# name: myproject

# Base project relative element path, elements will be loaded
# from this base.

element-path: .

# Alias configuration
#
# Aliases are entirely project specific, they are
# configured as a simple dictionary, example:
#
# aliases:
#   baserock: git://git.baserock.org/baserock/
#   freedesktop: git://anongit.freedesktop.org/


# Plugin path configuration
#
# You may specify one or more project relative paths to
# subdirectories where plugins should be loaded from.
#
# plugins:
#
#   elements:
#   - plugins/local-elements
#   - plugins/shared-elements
#
#   sources:
#   - plugins/local-sources


# Variable Configuration
#
# You may override the defaults of variables on a project wide
# basis by specifying the 'variables' attribute.
#
# The defaults for this version of buildstream are listed
# below.
#
variables:

  # Maximum number of parallel build processes within a given
  # build, support for this is conditional on the element type
  # and the build system used (any element using 'make' can
  # implement this).
  #
  # Note: this value defaults to the number of cores available
  max-jobs: 4

  # Path configuration, to be used in build instructions.
  #
  prefix: "/usr"
  exec_prefix: "%{prefix}"
  bindir: "%{exec_prefix}/bin"
  sbindir: "%{exec_prefix}/sbin"
  libexecdir: "%{exec_prefix}/libexec"
  datadir: "%{prefix}/share"
  sysconfdir: "/etc"
  sharedstatedir: "%{prefix}/com"
  localstatedir: "/var"
  lib: "lib"
  libdir: "%{prefix}/%{lib}"
  debugdir: "%{libdir}/debug"
  includedir: "%{prefix}/include"
  docdir: "%{datadir}/doc"
  infodir: "%{datadir}/info"
  mandir: "%{datadir}/man"

  # Indicates the default build directory where input is
  # normally staged
  build-root: /buildstream/build

  # Indicates the build installation directory in the sandbox
  install-root: /buildstream/install

  # Define some patterns which might be used in multiple
  # elements
  strip-binaries: |

    find "%{install-root}" -type f \
      '(' -perm -111 -o -name '*.so*' \
          -o -name '*.cmxs' -o -name '*.node' ')' \
      -exec sh -ec \
      'read -n4 hdr <"$1" # check for elf header
       if [ "$hdr" != "$(printf \\x7fELF)" ]; then
           exit 0
       fi
       debugfile="%{install-root}%{debugdir}/$(basename "$1")"
       mkdir -p "$(dirname "$debugfile")"
       objcopy --only-keep-debug "$1" "$debugfile"
       chmod 644 "$debugfile"
       strip --remove-section=.comment --remove-section=.note --strip-unneeded "$1"
       objcopy --add-gnu-debuglink "$debugfile" "$1"' - {} ';'


# Base sandbox environment, can be overridden by plugins
environment:
  PATH: /usr/bin:/bin:/usr/sbin:/sbin
  SHELL: /bin/sh
  TERM: dumb
  USER: tomjon
  USERNAME: tomjon
  LOGNAME: tomjon
  LC_ALL: C
  HOME: /tmp
  TZ: UTC

# List of environment variables which should not be taken into
# account when calculating a cache key for a given element.
#
environment-nocache: []


# Specify devices which should be available in the sandbox
devices:
- /dev/console
- /dev/full
- /dev/null
- /dev/urandom
- /dev/zero


# Defaults for the 'split-rules' public data found on elements
# in the 'bst' domain.
#
# These define patterns for categorizing the output of build
# elements so that selective composition can be performed by
# plugins later on.
#
# Elements may extend these rules by adding entries to the
# various split domains either in a plugin definition or
# in a project element declaration.
#
# Note that the split rules reported by
# Element.get_public_data('bst') will have any variables for
# the given element already expanded.
#
split-rules:

  # The runtime domain includes whatever is needed for the
  # built element to run, this includes stripped executables
  # and shared libraries by default.
  runtime:
  - |
    %{bindir}/.*
  - |
    %{sbindir}/.*
  - |
    %{libexecdir}/.*
  - |
    %{libdir}/lib[^/]*\.so(\.\d+)*

  # The devel domain includes additional things which
  # you may need for development.
  #
  # By default this includes header files, static libraries
  # and other metadata such as pkgconfig files, m4 macros and
  # libtool archives.
  devel:
  - |
    %{includedir}/.*
  - |
    %{libdir}/lib.*\.a
  - |
    %{libdir}/lib.*\.la
  - |
    %{libdir}/pkgconfig/.*\.pc
  - |
    %{datadir}/pkgconfig/.*\.pc
  - |
    %{datadir}/aclocal/.*\.m4

  # The debug domain includes debugging information stripped
  # away from libraries and executables
  debug:
  - |
    %{debugdir}/.*

  # The doc domain includes documentation
  doc:
  - |
    %{docdir}/.*
  - |
    %{infodir}/.*
  - |
    %{mandir}/.*

  # The locale domain includes translations etc
  locale:
  - |
    %{datadir}/locale/.*
  - |
    %{datadir}/i18n/.*
  - |
    %{datadir}/zoneinfo/.*

# Element Overrides
#
# Base attributes declared by element default yaml files
# can be overridden on a project wide basis. The elements
# dictionary can be used to override variables, environments
# or plugin specific configuration data as shown below.
#
#
# elements:
#
#   autotools:
#
#     variables:
#       bindir: "%{prefix}/bin"
#
#     config:
#       configure-commands: ...
#
#     environment:
#       PKG_CONFIG_PATH=%{libdir}/pkgconfig
#
class Project(directory, arch)

Bases: object

Project Configuration

Parameters:
  • directory (str) – The project directory
  • arch (str) – Symbolic machine architecture name
Raises:

LoadError

name = None

str – The project name

directory = None

str – The project directory

element_path = None

str – Absolute path to where elements are loaded from within the project

translate_url(url)

Translates the given url which may be specified with an alias into a fully qualified url.

Parameters:url (str) – A url, which may be using an alias
Returns:The fully qualified url, with aliases resolved
Return type:str

This method is provided for Source objects to resolve fully qualified urls based on the shorthand which is allowed to be specified in the YAML