-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make tox -e rpm testing easier to use
- Loading branch information
Showing
3 changed files
with
85 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# spell-checker:ignore bcond pkgversion buildrequires autosetup PYTHONPATH noarch buildroot bindir sitelib numprocesses clib | ||
# All tests require Internet access | ||
# to test in mock use: --enable-network --with check | ||
# to test in a privileged environment use: | ||
# --with check --with privileged_tests | ||
%global debug_package %{nil} | ||
%bcond_with check | ||
%bcond_with privileged_tests | ||
|
||
Name: ansible-compat | ||
Version: VERSION_PLACEHOLDER | ||
Release: 1%{?dist} | ||
Summary: Ansible Compat | ||
|
||
License: GPL-3.0-or-later AND MIT | ||
URL: https://github.com/ansible/ansible-compat | ||
Source0: %{pypi_source} | ||
|
||
BuildArch: noarch | ||
|
||
BuildRequires: python%{python3_pkgversion}-devel | ||
%if %{with check} | ||
# These are required for tests: | ||
BuildRequires: python%{python3_pkgversion}-pytest | ||
BuildRequires: python%{python3_pkgversion}-pytest-xdist | ||
BuildRequires: python%{python3_pkgversion}-libselinux | ||
BuildRequires: python%{python3_pkgversion}-jsonschema | ||
BuildRequires: python%{python3_pkgversion}-subprocess-tee | ||
BuildRequires: git-core | ||
%endif | ||
Requires: git-core | ||
|
||
|
||
%description | ||
A python package containing functions that help interacting with various versions of Ansible. | ||
|
||
%prep | ||
%autosetup | ||
|
||
|
||
%build | ||
%pyproject_wheel | ||
|
||
|
||
%install | ||
%pyproject_install | ||
|
||
|
||
%if %{with check} | ||
%check | ||
pytest | ||
%endif | ||
|
||
|
||
%files -f %{pyproject_files} | ||
%doc docs/ README.md | ||
|
||
%changelog |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/bash | ||
set -euxo pipefail | ||
|
||
# Clean leftovers from previous builds | ||
rm -R dist/*/ dist/*-record dist/*-distinfo dist/*.tar.gz 2> /dev/null || true | ||
|
||
if [ -f /etc/redhat-release ]; then | ||
sudo dnf install -y libcurl-devel krb5-devel python3-jsonschema python3-devel rpm-build | ||
# Only Fedora has packit as rpm available, on others we install it using pip | ||
if grep Fedora /etc/redhat-release; then | ||
sudo dnf install -y packit python3-setuptools_scm+toml python3-subprocess-tee | ||
else | ||
type packit 2>/dev/null || sudo pip3 install packitos | ||
fi | ||
else | ||
echo 'FATAL: This can be run only on rpm based operating systems at this moment.' >&2 | ||
exit 1 | ||
fi | ||
|
||
packit build locally | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters