## START: Set by rpmautospec
## (rpmautospec version 0.7.3)
## RPMAUTOSPEC: autorelease, autochangelog
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
    release_number = 1;
    base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}"));
    print(release_number + base_release_number - 1);
}%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}}
## END: Set by rpmautospec

%bcond_without tests

# at least one test fails on Koji
# use --with all_tests on local builds to make sure test suite is still good
%bcond_with all_tests

%global srcname damo
%global _description %{expand:
damo is a user space tool for DAMON. Using this, you can monitor the data access
patterns of your system or workloads and make data access-aware memory
management optimizations.}

Name:           python-%{srcname}
Version:        2.5.9
Release:        %autorelease
Summary:        Data Access Monitoring Operator

License:        GPL-2.0-only
URL:            https://github.com/damonitor/damo
# PyPI source does not contain tests
# Source:         %%pypi_source
Source:        %{url}/archive/v%{version}/%{srcname}-%{version}.tar.gz

BuildArch:      noarch
ExcludeArch:    %{ix86}

%description %{_description}


%package -n %{srcname}
Summary:        %{summary}
BuildRequires:  python3-devel
%if %{with tests}
BuildRequires:  python3dist(pytest)
%endif

%description -n %{srcname} %{_description}


%prep
%autosetup -p 1 -n %{srcname}-%{version}


# from packaging/build.sh
for f in pyproject.toml setup.py; do
  cp -p packaging/$f .
done

mkdir -p src/damo
cp -p src/*.py src/damo/

for f in pyproject.toml setup.py; do
  cp -p packaging/$f .
done
# remove shebang from the newly copied damo.py
sed -i '1{\@^#!/usr/bin/env python@d}' src/damo/damo.py
touch -r damo src/damo/damo.py
touch -r damo src/damo/__init__.py

%generate_buildrequires
%pyproject_buildrequires


%build
%pyproject_wheel


%install
%pyproject_install
%pyproject_save_files %{srcname}


%check
%pyproject_check_import
%if %{with tests}
%if %{with all_tests}
%pytest
%else
# get_damon_dir does not work on Koji
# "read failed (reading /sys/kernel/debug/damon/mk_contexts failed ([Errno 22] Invalid argument))"
%pytest -k "not test_files_content_to_kdamonds"
%endif
%endif


%files -n %{srcname} -f %{pyproject_files}
%license COPYING
%doc CONTRIBUTING FEATURES_DEPRECATION_PROCESS.md FEATURES_DEPRECATION_SCHEDULE.md README.md REPORTING.md SECURITY.md TODO USAGE.md release_note
%{_bindir}/%{srcname}


%changelog
## START: Generated by rpmautospec
* Tue Dec 10 2024 Packit <hello@packit.dev> - 2.5.9-1
- Update to 2.5.9
- Resolves rhbz#2331303

* Sun Dec 01 2024 Packit <hello@packit.dev> - 2.5.8-1
- Update to 2.5.8
- Resolves rhbz#2329775

* Tue Nov 26 2024 Packit <hello@packit.dev> - 2.5.7-1
- Update to 2.5.7
- Resolves rhbz#2328818

* Tue Nov 19 2024 Michel Lind <salimma@fedoraproject.org> - 2.5.6-2
- Package more documentation
- features deprecation
- reporting
- todo

* Tue Nov 19 2024 Packit <hello@packit.dev> - 2.5.6-1
- Update to 2.5.6
- Resolves rhbz#2327256

* Tue Nov 12 2024 Packit <hello@packit.dev> - 2.5.5-1
- Update to 2.5.5
- Resolves rhbz#2325364

* Mon Nov 04 2024 Packit <hello@packit.dev> - 2.5.4-1
- Update to 2.5.4
- Resolves rhbz#2323729

* Thu Oct 31 2024 Packit <hello@packit.dev> - 2.5.3-1
- Update to 2.5.3
- Resolves rhbz#2317112

* Tue Sep 03 2024 Packit <hello@packit.dev> - 2.4.9-1
- Update to 2.4.9
- Resolves rhbz#2309327

* Fri Aug 30 2024 Michel Lind <salimma@fedoraproject.org> - 2.4.8-1
- Update to 2.4.8
- Exclude 32-bit ix86, some tests start failing
- Resolves rhbz#2306031

* Mon Aug 12 2024 Packit <hello@packit.dev> - 2.4.7-1
- Update to 2.4.7
- Resolves rhbz#2304213

* Mon Aug 05 2024 Packit <hello@packit.dev> - 2.4.6-1
- Update to 2.4.6
- Resolves rhbz#2302967

* Mon Jul 29 2024 Packit <hello@packit.dev> - 2.4.5-1
- Update to 2.4.5
- Resolves rhbz#2301395

* Mon Jul 22 2024 Packit <hello@packit.dev> - 2.4.4-1
- Update to 2.4.4
- Resolves rhbz#2299405

* Fri Jul 19 2024 Fedora Release Engineering <releng@fedoraproject.org> - 2.4.3-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild

* Mon Jul 15 2024 Packit <hello@packit.dev> - 2.4.3-1
- Update to 2.4.3
- Resolves rhbz#2298041

* Mon Jul 08 2024 Packit <hello@packit.dev> - 2.4.2-1
- Update to 2.4.2
- Resolves rhbz#2295454

* Mon Jun 24 2024 Packit <hello@packit.dev> - 2.4.0-1
- Update to 2.4.0
- Resolves rhbz#2292798

* Tue Jun 11 2024 Packit <hello@packit.dev> - 2.3.8-1
- Update to 2.3.8
- Resolves rhbz#2287265

* Fri Jun 07 2024 Python Maint <python-maint@redhat.com> - 2.3.6-3
- Rebuilt for Python 3.13

* Tue May 28 2024 Michel Lind <salimma@fedoraproject.org> - 2.3.6-2
- Adjust for source code layout change

* Mon May 27 2024 Packit <hello@packit.dev> - 2.3.6-1
- Update to 2.3.6
- Resolves rhbz#2282012

* Thu May 02 2024 Michel Lind <salimma@fedoraproject.org> - 2.3.3-1
- Update to 2.3.3
- Resolves: rhbz#2277883

* Mon Apr 22 2024 Packit <hello@packit.dev> - 2.3.2-1
- Update to 2.3.2
- Resolves rhbz#2276515

* Mon Apr 15 2024 Packit <hello@packit.dev> - 2.3.1-1
- Update to 2.3.1
- Resolves rhbz#2274065

* Mon Apr 01 2024 Packit <hello@packit.dev> - 2.2.8-1
- Update to 2.2.8
- Resolves rhbz#2272547

* Tue Mar 26 2024 Packit <hello@packit.dev> - 2.2.7-1
- Update to 2.2.7
- Resolves rhbz#2271542

* Tue Mar 19 2024 Packit <hello@packit.dev> - 2.2.6-1
- Update to 2.2.6
- Resolves rhbz#2270231

* Mon Mar 11 2024 Packit <hello@packit.dev> - 2.2.5-1
- Update to 2.2.5
- Resolves rhbz#2269048

* Mon Mar 04 2024 Packit <hello@packit.dev> - 2.2.4-1
- Update to 2.2.4
- Resolves rhbz#2267809

* Mon Feb 26 2024 Packit <hello@packit.dev> - 2.2.3-1
- Update to 2.2.3
- Resolves rhbz#2266176

* Fri Feb 23 2024 Packit <hello@packit.dev> - 2.2.2-1
- Update to 2.2.2
- Resolves rhbz#2264998

* Fri Feb 23 2024 Michel Lind <salimma@fedoraproject.org> - 2.2.1-2
- Remove ExclusiveArch; i686 builders are already excluded from picking up
  noarch builds

* Tue Feb 13 2024 Packit <hello@packit.dev> - 2.2.1-1
- Update to 2.2.1
- Resolves rhbz#2262869

* Sun Feb 04 2024 Michel Lind <salimma@fedoraproject.org> - 2.1.9-2
- Fix build on Koji - disabling test that fails due to permission issue
- Run pyproject_check_import
- Remove setup.py that was accidentally shipped

* Mon Jan 29 2024 Packit <hello@packit.dev> - 2.1.9-1
- Update to 2.1.9
- Resolves rhbz#2258524

* Fri Jan 26 2024 Fedora Release Engineering <releng@fedoraproject.org> - 2.1.6-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

* Mon Jan 22 2024 Fedora Release Engineering <releng@fedoraproject.org> - 2.1.6-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

* Tue Jan 09 2024 Packit <hello@packit.dev> - 2.1.6-1
- Update to 2.1.6
- Resolves rhbz#2257364

* Mon Jan 01 2024 Packit <hello@packit.dev> - 2.1.5-1
- Update to 2.1.5
- Resolves rhbz#2255867

* Thu Dec 21 2023 Michel Lind <salimma@fedoraproject.org> - 2.1.2-2
- Add newline before the bug resolved

* Mon Dec 18 2023 Packit <hello@packit.dev> - 2.1.2-1
- Update to 2.1.2 - Resolves rhbz#2255148

* Tue Dec 12 2023 Michel Lind <salimma@fedoraproject.org> - 2.1.1-2
- Make Packit mark bugs as resolved

* Tue Dec 12 2023 Packit <hello@packit.dev> - 2.1.1-1
- Update to 2.1.1

* Tue Dec 12 2023 Michel Lind <salimma@fedoraproject.org> - 2.1.0-4
- Override commit-message, not changelog-entry

* Tue Dec 12 2023 Michel Lind <salimma@fedoraproject.org> - 2.1.0-3
- Use Packit only for Rawhide to keep history from diverging

* Tue Dec 12 2023 Miroslav Suchý <msuchy@redhat.com> - 2.1.0-2
- add packit automation for pull_from_upstream

* Mon Dec 11 2023 Michel Lind <salimma@fedoraproject.org> - 2.1.0-1
- Update to 2.1.0

* Thu Nov 09 2023 Michel Lind <salimma@fedoraproject.org> - 2.0.6-1
- Update to 2.0.6

* Tue Sep 26 2023 Michel Lind <salimma@fedoraproject.org> - 2.0.0-1
- Update to 2.0.0

* Mon Sep 18 2023 Michel Lind <salimma@fedoraproject.org> - 1.9.8-1
- Update to 1.9.8

* Tue Sep 05 2023 Michel Alexandre Salim <salimma@fedoraproject.org> - 1.9.7-1
- Update to 1.9.7

* Wed Aug 23 2023 Michel Alexandre Salim <salimma@fedoraproject.org> - 1.9.5-1
- Update to 1.9.5

* Tue Jul 25 2023 Michel Alexandre Salim <salimma@fedoraproject.org> - 1.9.1-1
- Update to 1.9.1

* Fri Jul 21 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1.8.7-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild

* Tue Jun 27 2023 Python Maint <python-maint@redhat.com> - 1.8.7-2
- Rebuilt for Python 3.12

* Mon Jun 26 2023 Michel Alexandre Salim <salimma@fedoraproject.org> - 1.8.7-1
- Update to 1.8.7 (closes: rhbz#2217628)

* Mon Jun 26 2023 Python Maint <python-maint@redhat.com> - 1.8.6-2
- Rebuilt for Python 3.12

* Wed Jun 21 2023 Michel Alexandre Salim <salimma@fedoraproject.org> - 1.8.6-1
- Update to 1.8.6

* Tue Jun 13 2023 Python Maint <python-maint@redhat.com> - 1.8.4-2
- Rebuilt for Python 3.12

* Tue Jun 06 2023 Michel Alexandre Salim <salimma@fedoraproject.org> - 1.8.4-1
- Update to 1.8.4

* Mon Jun 05 2023 Michel Alexandre Salim <salimma@fedoraproject.org> - 1.8.3-1
- Update to 1.8.3

* Wed May 17 2023 Michel Alexandre Salim <salimma@fedoraproject.org> - 1.8.1-2
- Avoid building on 32-bit platforms

* Wed May 17 2023 Michel Alexandre Salim <salimma@fedoraproject.org> - 1.8.1-1
- Initial Fedora package
## END: Generated by rpmautospec