Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use packit to produce rpms for fedora-35 #1648

Merged
merged 1 commit into from
Feb 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
88 changes: 88 additions & 0 deletions .config/ansible-lint.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# spell-checker:ignore bcond pkgversion buildrequires autosetup PYTHONPATH noarch buildroot bindir sitelib numprocesses
# 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
%bcond_with check
%bcond_with privileged_tests

Name: ansible-lint
Version: VERSION_PLACEHOLDER
Release: 1%{?dist}
Summary: Ansible-lint checks ansible content for common mistakes

License: MIT
URL: https://github.com/ansible-community/ansible-lint
Source0: %{pypi_source}

BuildArch: noarch

BuildRequires: pyproject-rpm-macros
BuildRequires: python%{python3_pkgversion}-build
BuildRequires: python%{python3_pkgversion}-devel
BuildRequires: python%{python3_pkgversion}-pip
BuildRequires: python%{python3_pkgversion}-setuptools
BuildRequires: python%{python3_pkgversion}-setuptools_scm
BuildRequires: python%{python3_pkgversion}-wheel
%if %{with check}
# These are required for tests:
BuildRequires: python%{python3_pkgversion}-pyyaml
BuildRequires: python%{python3_pkgversion}-pytest
BuildRequires: python%{python3_pkgversion}-pytest-xdist
BuildRequires: python%{python3_pkgversion}-libselinux
BuildRequires: git
%endif
# Named based on fedora 35:
Requires: ansible-core >= 2.12.0
Requires: python3-enrich
Requires: python3-packaging
Requires: python3-pyyaml
Requires: python3-rich
Requires: python3-ruamel-yaml
Requires: python3-ruamel-yaml-clib
Requires: python3-wcmatch
Requires: yamllint

# generate_buildrequires
# pyproject_buildrequires

%description
Ansible-lint checks ansible content for practices and behaviors that could
potentially be improved.

%prep
%autosetup


%build
%pyproject_wheel


%install
%pyproject_install


%if %{with check}
%check
PYTHONPATH=%{buildroot}%{python3_sitelib} \
pytest-3 \
-v \
--disable-pytest-warnings \
--numprocesses=auto \
%if %{with privileged_tests}
tests
%else
tests/unit
%endif
%endif


%files
%{python3_sitelib}/ansiblelint/
%{python3_sitelib}/ansible_lint-*.dist-info/
%{_bindir}/ansible-lint
%license COPYING
%doc docs/* README.rst

%changelog
Available at https://github.com/ansible-community/ansible-lint/releases
ssbarnea marked this conversation as resolved.
Show resolved Hide resolved
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,6 @@ test/fixtures/formatting-before/
.DS_Store
.vscode
.idea
src/ansiblelint/_version.py
*.tar.gz
.pytest_cache
33 changes: 33 additions & 0 deletions .packit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# spell-checker:ignore packit specfile copr epel
specfile_path: dist/ansible-lint.spec
actions:
create-archive:
# packit.dev service does have these module pre-installed:
- python3 -m pip install --user build setuptools-scm
- python3 -m build --sdist --outdir dist
ssbarnea marked this conversation as resolved.
Show resolved Hide resolved
- sh -c "ls dist/ansible-lint-*.tar.gz"
get-current-version:
- ./tools/get-version.sh
post-upstream-clone:
ssbarnea marked this conversation as resolved.
Show resolved Hide resolved
- ./tools/update-version.sh
jobs:
webknjaz marked this conversation as resolved.
Show resolved Hide resolved
- job: copr_build
metadata:
targets:
# Unable to build `centos-stream` due to missing python3-setuptools_scm_git_archive
# which is part of EPEL.
# - centos-stream-x86_64
# - epel-8-x86_64
# Unable to build fedora-stable as it includes both 34 and 35 and on first one we do not have python3-setuptools_scm
# - fedora-stable
- fedora-35
trigger: pull_request
# - job: tests
# trigger: pull_request
# metadata:
# targets:
# - fedora-all
# - job: propose_downstream
# trigger: release
# metadata:
# dist-git-branch: master
4 changes: 4 additions & 0 deletions mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,7 @@ ignore_missing_imports = True

[mypy-wcmatch.*]
ignore_missing_imports = True

# This is generated by setuptools-scm, so is normal to be missing:
[mypy-ansiblelint._version]
ignore_missing_imports = True
3 changes: 0 additions & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
[aliases]
dists = clean --all sdist bdist_wheel

[metadata]
name = ansible-lint
url = https://github.com/ansible-community/ansible-lint
Expand Down
2 changes: 1 addition & 1 deletion src/ansiblelint/version.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Ansible-lint version information."""
try:
from ._version import version as __version__ # type: ignore
from ._version import version as __version__
except ImportError:

try:
Expand Down
7 changes: 7 additions & 0 deletions tools/get-version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash
set -e
{
python3 -c "import setuptools_scm" || python3 -m pip install --user setuptools-scm
} 1>&2 # redirect stdout to stderr to avoid polluting the output
python3 -m setuptools_scm | \
sed 's/Guessed Version\([^+]\+\).*/\1/'
7 changes: 7 additions & 0 deletions tools/update-version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash
DIR=$(dirname "$0")
VERSION=$(./tools/get-version.sh)
mkdir -p "${DIR}/../dist"
sed -e "s/VERSION_PLACEHOLDER/${VERSION}/" \
"${DIR}/../.config/ansible-lint.spec" \
> "${DIR}/../dist/ansible-lint.spec"