Skip to content

Commit

Permalink
Correct the docstrings formatting in pkgbuild modules and state (#34194)
Browse files Browse the repository at this point in the history
  • Loading branch information
vutny authored and Nicole Thomas committed Jun 22, 2016
1 parent a8429c2 commit 37978a1
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 35 deletions.
71 changes: 42 additions & 29 deletions salt/modules/debbuild.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
This system allows for all of the components to build debs safely in chrooted
environments. This also provides a function to generate debian repositories
This module impliments the pkgbuild interface
This module implements the pkgbuild interface
'''

# import python libs
Expand All @@ -19,9 +19,9 @@
import shutil

# Import salt libs
import salt.utils
from salt.exceptions import SaltInvocationError, CommandExecutionError
from salt.ext.six.moves.urllib.parse import urlparse as _urlparse # pylint: disable=no-name-in-module,import-error
from salt.exceptions import SaltInvocationError, CommandExecutionError
import salt.utils

HAS_LIBS = False

Expand Down Expand Up @@ -103,8 +103,8 @@ def _get_repo_options_env(env):
.. code-block:: yaml
- env:
- OPTIONS : 'ask-passphrase'
- env:
- OPTIONS : 'ask-passphrase'
.. warning::
Expand Down Expand Up @@ -139,15 +139,15 @@ def _get_repo_dists_env(env):
.. code-block:: yaml
- env:
- ORIGIN : 'jessie'
- LABEL : 'salt debian'
- SUITE : 'main'
- VERSION : '8.1'
- CODENAME : 'jessie'
- ARCHS : 'amd64 i386 source'
- COMPONENTS : 'main'
- DESCRIPTION : 'SaltStack Debian package repo'
- env:
- ORIGIN : 'jessie'
- LABEL : 'salt debian'
- SUITE : 'main'
- VERSION : '8.1'
- CODENAME : 'jessie'
- ARCHS : 'amd64 i386 source'
- COMPONENTS : 'main'
- DESCRIPTION : 'SaltStack Debian package repo'
.. warning::
Expand All @@ -164,15 +164,15 @@ def _get_repo_dists_env(env):
# 1 | 'text string for repo field'
# 2 | 'default value'
dflts_dict = {
'OPTIONS': ('I', '', 'processed by _get_repo_options_env'),
'ORIGIN': ('O', 'Origin', 'SaltStack'),
'LABEL': ('O', 'Label', 'salt_debian'),
'SUITE': ('O', 'Suite', 'stable'),
'VERSION': ('O', 'Version', '8.1'),
'CODENAME': ('M', 'Codename', 'jessie'),
'ARCHS': ('M', 'Architectures', 'i386 amd64 source'),
'COMPONENTS': ('M', 'Components', 'main'),
'DESCRIPTION': ('O', 'Description', 'SaltStack debian package repo'),
'OPTIONS': ('I', '', 'processed by _get_repo_options_env'),
'ORIGIN': ('O', 'Origin', 'SaltStack'),
'LABEL': ('O', 'Label', 'salt_debian'),
'SUITE': ('O', 'Suite', 'stable'),
'VERSION': ('O', 'Version', '8.1'),
'CODENAME': ('M', 'Codename', 'jessie'),
'ARCHS': ('M', 'Architectures', 'i386 amd64 source'),
'COMPONENTS': ('M', 'Components', 'main'),
'DESCRIPTION': ('O', 'Description', 'SaltStack debian package repo'),
}

env_dists = ''
Expand Down Expand Up @@ -224,8 +224,8 @@ def _create_pbuilders(env):
.. code-block:: yaml
- env:
- DEB_BUILD_OPTIONS: 'nocheck'
- env:
- DEB_BUILD_OPTIONS: 'nocheck'
.. warning::
Expand Down Expand Up @@ -288,7 +288,10 @@ def make_src_pkg(dest_dir, spec, sources, env=None, template=None, saltenv='base
CLI Example:
Debian
**Debian**
.. code-block:: bash
salt '*' pkgbuild.make_src_pkg /var/www/html/ https://raw.githubusercontent.com/saltstack/libnacl/master/pkg/deb/python-libnacl.control.tar.xz 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
Expand Down Expand Up @@ -386,7 +389,10 @@ def build(runas,
CLI Example:
Debian
**Debian**
.. code-block:: bash
salt '*' pkgbuild.make_src_pkg deb-8-x86_64 /var/www/html https://raw.githubusercontent.com/saltstack/libnacl/master/pkg/deb/python-libnacl.control https://pypi.python.org/packages/source/l/libnacl/libnacl-1.3.5.tar.gz
This example command should build the libnacl package for Debian using pbuilder
Expand Down Expand Up @@ -439,13 +445,20 @@ def build(runas,
return ret


def make_repo(repodir, keyid=None, env=None, use_passphrase=False, gnupghome='/etc/salt/gpgkeys', runas='root'):
def make_repo(repodir,
keyid=None,
env=None,
use_passphrase=False,
gnupghome='/etc/salt/gpgkeys',
runas='root'):
'''
Given the repodir (directory to create repository in), create a Debian
repository and optionally sign it and packages present. This state is
best used with onchanges linked to your package building states
CLI Example::
CLI Example:
.. code-block:: bash
salt '*' pkgbuild.make_repo /var/www/html
Expand Down
8 changes: 7 additions & 1 deletion salt/modules/rpmbuild.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def __virtual__():
if __grains__.get('os_family', False) in ('RedHat', 'Suse'):
return __virtualname__
else:
# The module will be exposed as `rpmbuild` on non-rpm based systems
# The module will be exposed as `rpmbuild` on non-RPM based systems
return 'rpmbuild'
else:
return False, 'The rpmbuild module could not be loaded: requires python-gnupg, gpg, rpm, rpmbuild, mock and createrepo utilities to be installed'
Expand Down Expand Up @@ -165,6 +165,8 @@ def make_src_pkg(dest_dir, spec, sources, env=None, template=None, saltenv='base
CLI Example:
.. code-block:: bash
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
Expand Down Expand Up @@ -209,6 +211,8 @@ def build(runas,
CLI Example:
.. code-block:: bash
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
Expand Down Expand Up @@ -299,6 +303,8 @@ def make_repo(repodir, keyid=None, env=None, use_passphrase=False, gnupghome='/e
CLI Example::
.. code-block:: bash
salt '*' pkgbuild.make_repo /var/www/html/
repodir
Expand Down
11 changes: 6 additions & 5 deletions salt/states/pkgbuild.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
'''
The pkgbuild state is the front of Salt package building backend. It
automatically
automatically builds DEB and RPM packages from specified sources
.. versionadded:: 2015.8.0
Expand Down Expand Up @@ -116,6 +116,7 @@ def built(name,
Run the spec file through a templating engine
.. versionchanged:: 2015.8.2
This argument is now optional, allowing for no templating engine to
be used if none is desired.
Expand All @@ -132,8 +133,8 @@ def built(name,
.. code-block:: yaml
- env:
DEB_BUILD_OPTIONS: 'nocheck'
- env:
DEB_BUILD_OPTIONS: 'nocheck'
.. warning::
Expand Down Expand Up @@ -305,8 +306,8 @@ def repo(name,
.. code-block:: yaml
- env:
OPTIONS: 'ask-passphrase'
- env:
OPTIONS: 'ask-passphrase'
.. warning::
Expand Down

0 comments on commit 37978a1

Please sign in to comment.