salt.modules.rpmbuild

RPM Package builder system

New in version 2015.8.0.

This system allows for all of the components to build rpms safely in chrooted environments. This also provides a function to generate yum repositories

This module implements the pkgbuild interface

salt.modules.rpmbuild.build(runas, tgt, dest_dir, spec, sources, deps, env, template, saltenv=u'base', log_dir=u'/var/log/salt/pkgbuild')

Given the package destination directory, the spec file source and package sources, use mock to safely build the rpm defined in the spec file

CLI Example:

salt '*' pkgbuild.build mock epel-7-x86_64 /var/www/html
            https://raw.githubusercontent.com/saltstack/libnacl/master/pkg/rpm/python-libnacl.spec
            https://pypi.python.org/packages/source/l/libnacl/libnacl-1.3.5.tar.gz

This example command should build the libnacl package for rhel 7 using user mock and place it in /var/www/html/ on the minion

salt.modules.rpmbuild.make_repo(repodir, keyid=None, env=None, use_passphrase=False, gnupghome=u'/etc/salt/gpgkeys', runas=u'root', timeout=15.0)

Make a package repository and optionally sign packages present

Given the repodir, create a yum repository out of the rpms therein and optionally sign it and packages present, the name is directory to turn into a repo. This state is best used with onchanges linked to your package building states.

repodir
The directory to find packages that will be in the repository.
keyid

Changed in version 2016.3.0.

Optional Key ID to use in signing packages and repository. Utilizes Public and Private keys associated with keyid which have been loaded into the minion's Pillar data.

For example, contents from a Pillar data file with named Public and Private keys as follows:

gpg_pkg_priv_key: |
  -----BEGIN PGP PRIVATE KEY BLOCK-----
  Version: GnuPG v1

  lQO+BFciIfQBCADAPCtzx7I5Rl32escCMZsPzaEKWe7bIX1em4KCKkBoX47IG54b
  w82PCE8Y1jF/9Uk2m3RKVWp3YcLlc7Ap3gj6VO4ysvVz28UbnhPxsIkOlf2cq8qc
  .
  .
  Ebe+8JCQTwqSXPRTzXmy/b5WXDeM79CkLWvuGpXFor76D+ECMRPv/rawukEcNptn
  R5OmgHqvydEnO4pWbn8JzQO9YX/Us0SMHBVzLC8eIi5ZIopzalvX
  =JvW8
  -----END PGP PRIVATE KEY BLOCK-----

gpg_pkg_priv_keyname: gpg_pkg_key.pem

gpg_pkg_pub_key: |
  -----BEGIN PGP PUBLIC KEY BLOCK-----
  Version: GnuPG v1

  mQENBFciIfQBCADAPCtzx7I5Rl32escCMZsPzaEKWe7bIX1em4KCKkBoX47IG54b
  w82PCE8Y1jF/9Uk2m3RKVWp3YcLlc7Ap3gj6VO4ysvVz28UbnhPxsIkOlf2cq8qc
  .
  .
  bYP7t5iwJmQzRMyFInYRt77wkJBPCpJc9FPNebL9vlZcN4zv0KQta+4alcWivvoP
  4QIxE+/+trC6QRw2m2dHk6aAeq/J0Sc7ilZufwnNA71hf9SzRIwcFXMsLx4iLlki
  inNqW9c=
  =s1CX
  -----END PGP PUBLIC KEY BLOCK-----

gpg_pkg_pub_keyname: gpg_pkg_key.pub
env

Changed in version 2016.3.0.

A dictionary of environment variables to be utilized in creating the repository.

Note

This parameter is not used for making yum repositories.

use_passphrase
: False

New in version 2016.3.0.

Use a passphrase with the signing key presented in keyid. Passphrase is received from Pillar data which could be passed on the command line with pillar parameter. For example:

pillar='{ "gpg_passphrase" : "my_passphrase" }'
gnupghome
: /etc/salt/gpgkeys

New in version 2016.3.0.

Location where GPG related files are stored, used with keyid.

runas
: root

New in version 2016.3.0.

User to create the repository as, and optionally sign packages.

Note

Ensure the user has correct permissions to any files and directories which are to be utilized.

timeout
: 15.0

New in version 2016.3.4.

Timeout in seconds to wait for the prompt for inputting the passphrase.

CLI Example:

salt '*' pkgbuild.make_repo /var/www/html/
salt.modules.rpmbuild.make_src_pkg(dest_dir, spec, sources, env=None, template=None, saltenv=u'base', runas=u'root')

Create a source rpm from the given spec file and sources

CLI Example:

salt '*' pkgbuild.make_src_pkg /var/www/html/
        https://raw.githubusercontent.com/saltstack/libnacl/master/pkg/rpm/python-libnacl.spec
        https://pypi.python.org/packages/source/l/libnacl/libnacl-1.3.5.tar.gz

This example command should build the libnacl SOURCE package and place it in /var/www/html/ on the minion

Changed in version 2017.7.0.

dest_dir
The directory on the minion to place the built package(s)
spec
The location of the spec file (used for rpms)
sources
The list of package sources
env
A dictionary of environment variables to be set prior to execution.
template
Run the spec file through a templating engine Optional arguement, allows for no templating engine used to be if none is desired.
saltenv
The saltenv to use for files downloaded from the salt filesever
runas

The user to run the build process as

New in version 2018.3.3.

Note

using SHA256 as digest and minimum level dist el6