Compare commits
No commits in common. "a8-epel8-bootstrap" and "c10s" have entirely different histories.
a8-epel8-b
...
c10s
2
.gitignore
vendored
2
.gitignore
vendored
@ -1 +1 @@
|
||||
rpmautospec-*.tar.gz
|
||||
/rpmautospec-*.tar.gz
|
||||
|
@ -1 +0,0 @@
|
||||
4740a471d25896314cbb37ab7a34d24fa7d3b6512ea4d5d7444528e0669bca79cb23a180b8a591378a40e832df4a6673ac20930f38672d268d9c70fb49748771 SOURCES/rpmautospec-0.6.5.tar.gz
|
3
README.md
Normal file
3
README.md
Normal file
@ -0,0 +1,3 @@
|
||||
# python-rpmautospec
|
||||
|
||||
The python-rpmautospec package
|
@ -1,228 +0,0 @@
|
||||
From d128484a6502f76a2dc3f70551efbc880583c075 Mon Sep 17 00:00:00 2001
|
||||
From: eabdullin <ed.abdullin.1@gmail.com>
|
||||
Date: Wed, 30 Oct 2024 12:38:20 +0300
|
||||
Subject: [PATCH] Added AlmaLinux change identifier
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
When modifying a package in AlmaLinux relative to upstream, we do not increment the package’s version/release number. Instead, we use almalinux.{almalinux_release_number}.
|
||||
Therefore, the ability to identify AlmaLinux-specific changes was added, using the comment "AlmaLinux change: ".
|
||||
If this comment is used, the base release number of the package remains unchanged, but the suffix almalinux.{almalinux_release_number} is appended.
|
||||
The almalinux_release_number counter increments with each AlmaLinux-specific change to the package and resets upon version/release updates of the package.
|
||||
---
|
||||
rpmautospec/changelog.py | 2 +
|
||||
rpmautospec/magic_comments.py | 7 +-
|
||||
rpmautospec/pkg_history.py | 85 +++++++++++++++++++++-
|
||||
rpmautospec/subcommands/process_distgit.py | 9 ++-
|
||||
4 files changed, 98 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/rpmautospec/changelog.py b/rpmautospec/changelog.py
|
||||
index cb3e74f..b123bbe 100644
|
||||
--- a/rpmautospec/changelog.py
|
||||
+++ b/rpmautospec/changelog.py
|
||||
@@ -106,6 +106,8 @@ class ChangelogEntry(dict):
|
||||
changelog_evr = f" - {entry_info['epoch-version']}"
|
||||
if entry_info["release-complete"]:
|
||||
changelog_evr += f"-{entry_info['release-complete']}"
|
||||
+ if entry_info["almalinux-release-complete"]:
|
||||
+ changelog_evr += f".{entry_info['almalinux-release-complete']}"
|
||||
else:
|
||||
changelog_evr = ""
|
||||
changelog_header = f"* {changelog_date} {entry_info['authorblurb']}{changelog_evr}"
|
||||
diff --git a/rpmautospec/magic_comments.py b/rpmautospec/magic_comments.py
|
||||
index d56086e..4c1c06c 100644
|
||||
--- a/rpmautospec/magic_comments.py
|
||||
+++ b/rpmautospec/magic_comments.py
|
||||
@@ -3,19 +3,24 @@ from typing import NamedTuple
|
||||
|
||||
magic_comment_re = re.compile(r"^\s*\[(?P<magic>.*)\]\s*$")
|
||||
skip_changelog_re = re.compile(r"\s*skip\s+changelog\s*")
|
||||
+is_almalinux_re = re.compile(r"almalinux\s+change", re.IGNORECASE)
|
||||
bump_release_re = re.compile(r"\s*bump\s+release\s*(?::\s*)?(?P<bump_value>\d+)\s*")
|
||||
|
||||
|
||||
class MagicCommentResult(NamedTuple):
|
||||
skip_changelog: bool
|
||||
+ is_almalinux: bool
|
||||
bump_release: int
|
||||
|
||||
|
||||
def parse_magic_comments(message: str) -> MagicCommentResult:
|
||||
skip_changelog = False
|
||||
+ is_almalinux = False
|
||||
bump_release = 0
|
||||
|
||||
for line in message.split("\n"):
|
||||
+ if is_almalinux_re.match(line):
|
||||
+ is_almalinux = True
|
||||
if l_match := magic_comment_re.match(line):
|
||||
for part in l_match.group("magic").split(","):
|
||||
if skip_changelog_re.match(part):
|
||||
@@ -23,4 +28,4 @@ def parse_magic_comments(message: str) -> MagicCommentResult:
|
||||
if br_match := bump_release_re.match(part):
|
||||
bump_release = max(bump_release, int(br_match.group("bump_value")))
|
||||
|
||||
- return MagicCommentResult(skip_changelog=skip_changelog, bump_release=bump_release)
|
||||
+ return MagicCommentResult(skip_changelog=skip_changelog, bump_release=bump_release, is_almalinux=is_almalinux)
|
||||
diff --git a/rpmautospec/pkg_history.py b/rpmautospec/pkg_history.py
|
||||
index 9dabf10..3524383 100644
|
||||
--- a/rpmautospec/pkg_history.py
|
||||
+++ b/rpmautospec/pkg_history.py
|
||||
@@ -313,13 +313,61 @@ class PkgHistoryProcessor:
|
||||
)
|
||||
release_number = max(parent_release_numbers, default=0)
|
||||
|
||||
- if self.specfile.name in commit.tree:
|
||||
+ if (
|
||||
+ self.specfile.name in commit.tree
|
||||
+ and (
|
||||
+ not commit_result["magic-comment-result"].is_almalinux
|
||||
+ and len(commit.parents) == 1
|
||||
+ )
|
||||
+ ):
|
||||
release_number += 1
|
||||
|
||||
release_number = max(release_number, commit_result["magic-comment-result"].bump_release)
|
||||
|
||||
commit_result["release-number"] = release_number
|
||||
|
||||
+ is_parent_almalinux = any(
|
||||
+ res.get("almalinux-release-number") for res in parent_results if res
|
||||
+ )
|
||||
+
|
||||
+ is_almalinux_commit = (
|
||||
+ commit_result["magic-comment-result"].is_almalinux or is_parent_almalinux
|
||||
+ )
|
||||
+
|
||||
+ if is_almalinux_commit:
|
||||
+ log.debug("\tHas AlmaLinux changes or parent Almalinux release")
|
||||
+
|
||||
+ parent_almalinux_release_numbers = tuple(
|
||||
+ (
|
||||
+ res.get("almalinux-release-number", 0)
|
||||
+ if res and (
|
||||
+ epoch_version is None or res["epoch-version"] is None or epoch_version == res["epoch-version"]
|
||||
+ )
|
||||
+ else 0
|
||||
+ )
|
||||
+ for res in parent_results
|
||||
+ )
|
||||
+ almalinux_release_number = max(parent_almalinux_release_numbers, default=0)
|
||||
+
|
||||
+ if commit_result["magic-comment-result"].is_almalinux:
|
||||
+ almalinux_release_number += 1
|
||||
+
|
||||
+ if (
|
||||
+ release_number > max(parent_release_numbers, default=0) or
|
||||
+ (is_parent_almalinux and len(commit.parents) > 1)
|
||||
+ ):
|
||||
+ almalinux_release_number = 1
|
||||
+ elif epoch_version != commit_verflags.get("epoch-version"):
|
||||
+ almalinux_release_number = 1
|
||||
+
|
||||
+ commit_result["almalinux-release-number"] = almalinux_release_number
|
||||
+ almalinux_release_number_with_base = almalinux_release_number + base - 1
|
||||
+ commit_result["almalinux-release-complete"] = f"alma.{almalinux_release_number_with_base}"
|
||||
+ log.debug("\talmalinux_release_number: %s", almalinux_release_number)
|
||||
+ else:
|
||||
+ commit_result["almalinux-release-number"] = 0
|
||||
+ commit_result["almalinux-release-complete"] = ""
|
||||
+
|
||||
log.debug("\trelease_number: %s", release_number)
|
||||
|
||||
prerel_str = "0." if prerelease else ""
|
||||
@@ -410,6 +458,7 @@ class PkgHistoryProcessor:
|
||||
"commitlog": commit.message,
|
||||
"epoch-version": commit_result["epoch-version"],
|
||||
"release-complete": commit_result["release-complete"],
|
||||
+ "almalinux-release-complete": commit_result["almalinux-release-complete"]
|
||||
}
|
||||
)
|
||||
|
||||
@@ -442,13 +491,17 @@ class PkgHistoryProcessor:
|
||||
else:
|
||||
log.debug("\tno parent to follow")
|
||||
previous_changelog = ()
|
||||
+ second_parent = None
|
||||
for candidate in parent_results:
|
||||
if not candidate:
|
||||
continue
|
||||
if candidate["commit-id"] == parent_to_follow.id:
|
||||
previous_changelog = candidate.get("changelog", ())
|
||||
skip_for_changelog = True
|
||||
- break
|
||||
+ else:
|
||||
+ second_parent = candidate.get("changelog", ())
|
||||
+ if second_parent is not None:
|
||||
+ previous_changelog = self._add_missing_changes(previous_changelog, second_parent)
|
||||
|
||||
log.debug("\tskip_for_changelog: %s", skip_for_changelog)
|
||||
|
||||
@@ -461,6 +514,34 @@ class PkgHistoryProcessor:
|
||||
|
||||
yield commit_result
|
||||
|
||||
+ @staticmethod
|
||||
+ def _add_missing_changes(changelog1, changelog2):
|
||||
+ def add_unique_entries(entries, new_changelog, added_entries):
|
||||
+ for entry in entries:
|
||||
+ key = (entry['epoch-version'], entry['release-complete'], entry['almalinux-release-complete'])
|
||||
+ if key not in added_entries:
|
||||
+ new_changelog.append(entry)
|
||||
+ added_entries.add(key)
|
||||
+
|
||||
+ new_changelog = []
|
||||
+ added_entries = set()
|
||||
+
|
||||
+ max_release2 = changelog2[0]['release-complete']
|
||||
+ max_version2 = changelog2[0]['epoch-version']
|
||||
+
|
||||
+ for entry in changelog1:
|
||||
+ key = (entry['epoch-version'], entry['release-complete'], entry['almalinux-release-complete'])
|
||||
+ if (entry['epoch-version'], entry['release-complete']) == (max_version2, max_release2):
|
||||
+ break
|
||||
+ new_changelog.append(entry)
|
||||
+ added_entries.add(key)
|
||||
+
|
||||
+ add_unique_entries(changelog2, new_changelog, added_entries)
|
||||
+
|
||||
+ add_unique_entries(changelog1, new_changelog, added_entries)
|
||||
+
|
||||
+ return tuple(new_changelog)
|
||||
+
|
||||
@staticmethod
|
||||
def _merge_info(f1: dict[str, Any], f2: dict[str, Any]) -> dict[str, Any]:
|
||||
"""Merge dicts containing info of previously run visitors."""
|
||||
diff --git a/rpmautospec/subcommands/process_distgit.py b/rpmautospec/subcommands/process_distgit.py
|
||||
index 25a03f4..55b0fd1 100644
|
||||
--- a/rpmautospec/subcommands/process_distgit.py
|
||||
+++ b/rpmautospec/subcommands/process_distgit.py
|
||||
@@ -24,7 +24,7 @@ AUTORELEASE_TEMPLATE = """
|
||||
release_number = {autorelease_number:d};
|
||||
base_release_number = tonumber(rpm.expand("%{{?-b*}}%{{!?-b:1}}"));
|
||||
print(release_number + base_release_number - 1);
|
||||
-}}%{{?-e:.%{{-e*}}}}%{{?-s:.%{{-s*}}}}%{{!?-n:%{{?dist}}}}""" # noqa: E501
|
||||
+}}%{{?-e:.%{{-e*}}}}%{{?-s:.%{{-s*}}}}%{{!?-n:%{{?dist}}}}{almalinux_suffix}""" # noqa: E501
|
||||
|
||||
|
||||
def register_subcommand(subparsers):
|
||||
@@ -112,9 +112,14 @@ def process_distgit(
|
||||
# Process the spec file into a temporary file...
|
||||
used_features = []
|
||||
|
||||
+ almalinux_suffix = ""
|
||||
+ if result["almalinux-release-complete"]:
|
||||
+ almalinux_suffix = f'.{result["almalinux-release-complete"]}'
|
||||
+
|
||||
if features.has_autorelease:
|
||||
autorelease_blurb_if_needed = AUTORELEASE_TEMPLATE.format(
|
||||
- autorelease_number=autorelease_number
|
||||
+ autorelease_number=autorelease_number,
|
||||
+ almalinux_suffix=almalinux_suffix
|
||||
)
|
||||
used_features.append("autorelease")
|
||||
else:
|
||||
--
|
||||
2.39.5 (Apple Git-154)
|
||||
|
@ -1,3 +0,0 @@
|
||||
# python3.11-rpmautospec
|
||||
|
||||
The python3.11-rpmautospec package
|
@ -1,9 +0,0 @@
|
||||
diff -up rpmautospec-0.6.5/pyproject.toml.no-pytest-cov rpmautospec-0.6.5/pyproject.toml
|
||||
--- rpmautospec-0.6.5/pyproject.toml.no-pytest-cov 2024-06-18 14:25:58.620784500 +0200
|
||||
+++ rpmautospec-0.6.5/pyproject.toml 2024-06-26 18:05:30.891827296 +0200
|
||||
@@ -76,5 +76,4 @@ select = ["E", "F", "W", "I"]
|
||||
allowed-confusables = ["’"]
|
||||
|
||||
[tool.pytest.ini_options]
|
||||
-addopts = "--cov --cov-config .coveragerc --cov-report term --cov-report xml --cov-report html"
|
||||
tmp_path_retention_policy = "failed"
|
@ -1,64 +0,0 @@
|
||||
%global python3_pkgversion 3.11
|
||||
|
||||
%global srcname rpmautospec
|
||||
|
||||
Name: python%{python3_pkgversion}-%{srcname}
|
||||
Version: 0.6.5
|
||||
Release: 0.1%{?dist}
|
||||
Summary: Package and CLI tool to generate release fields and changelogs
|
||||
License: MIT
|
||||
URL: https://github.com/fedora-infra/%{srcname}
|
||||
Source0: https://github.com/fedora-infra/%{srcname}/releases/download/%{version}/%{srcname}-%{version}.tar.gz
|
||||
Patch0: python3.11-rpmautospec-0.6.5-no-pytest-cov.patch
|
||||
|
||||
|
||||
Patch1000: 0001-Added-AlmaLinux-change-identifier-0.6.5.patch
|
||||
|
||||
BuildArch: noarch
|
||||
BuildRequires: git
|
||||
# the langpacks are needed for tests
|
||||
BuildRequires: glibc-langpack-de
|
||||
BuildRequires: glibc-langpack-en
|
||||
BuildRequires: python%{python3_pkgversion}-devel
|
||||
BuildRequires: python%{python3_pkgversion}dist(babel)
|
||||
BuildRequires: python%{python3_pkgversion}dist(pygit2)
|
||||
BuildRequires: python%{python3_pkgversion}dist(pytest)
|
||||
BuildRequires: python%{python3_pkgversion}dist(pyyaml)
|
||||
BuildRequires: python%{python3_pkgversion}dist(rpm)
|
||||
BuildRequires: python%{python3_pkgversion}dist(rpmautospec-core)
|
||||
BuildRequires: python%{python3_pkgversion}dist(setuptools)
|
||||
%{?python_provide:%python_provide python%{python3_pkgversion}-%{srcname}}
|
||||
|
||||
%description
|
||||
A package and CLI tool to generate RPM release fields and changelogs.
|
||||
|
||||
%package -n %{srcname}
|
||||
Summary: CLI tool for generating RPM releases and changelogs
|
||||
Requires: python%{python3_pkgversion}-%{srcname} = %{version}-%{release}
|
||||
|
||||
%description -n %{srcname}
|
||||
CLI tool for generating RPM releases and changelogs
|
||||
|
||||
%prep
|
||||
%autosetup -n %{srcname}-%{version} -p1
|
||||
|
||||
%build
|
||||
%py3_build
|
||||
|
||||
%install
|
||||
%py3_install
|
||||
|
||||
# The macro file is contained in epel-rpm-macros
|
||||
# mkdir -p %%{buildroot}%%{rpmmacrodir}
|
||||
# install -m 644 rpm/macros.d/macros.rpmautospec %%{buildroot}%%{rpmmacrodir}/
|
||||
|
||||
%check
|
||||
%pytest -v
|
||||
|
||||
%files
|
||||
%doc README.rst
|
||||
%{python3_sitelib}/%{srcname}/
|
||||
%{python3_sitelib}/*.egg-info/
|
||||
|
||||
%files -n %{srcname}
|
||||
%{_bindir}/rpmautospec
|
142
changelog
Normal file
142
changelog
Normal file
@ -0,0 +1,142 @@
|
||||
* Wed Jul 27 2022 Nils Philippsen <nils@redhat.com> - 0.3.0-1
|
||||
- Update to 0.3.0
|
||||
|
||||
* Wed Jun 08 2022 Nils Philippsen <nils@redhat.com>
|
||||
- Generally BR: python3-pytest-xdist, also on EL9
|
||||
|
||||
* Mon May 16 2022 Nils Philippsen <nils@redhat.com> - 0.2.8-1
|
||||
- Update to 0.2.8
|
||||
- Don't require python3-pytest-xdist for building on EL9
|
||||
|
||||
* Mon May 16 2022 Nils Philippsen <nils@redhat.com> - 0.2.7-1
|
||||
- Update to 0.2.7
|
||||
|
||||
* Mon Apr 25 2022 Nils Philippsen <nils@redhat.com> - 0.2.6-1
|
||||
- Update to 0.2.6
|
||||
- Require python3-pytest-xdist for building
|
||||
- Remove EL7 quirks, pkg isn't built there
|
||||
|
||||
* Fri Mar 04 2022 Nils Philippsen <nils@redhat.com>
|
||||
- require python3-pyyaml for building
|
||||
|
||||
* Sun Nov 07 2021 Nils Philippsen <nils@redhat.com>
|
||||
- require python3-babel and glibc langpacks (the latter for testing)
|
||||
|
||||
* Fri Aug 06 2021 Nils Philippsen <nils@redhat.com> - 0.2.5-1
|
||||
- Update to 0.2.5
|
||||
|
||||
* Thu Aug 05 2021 Nils Philippsen <nils@redhat.com> - 0.2.4-1
|
||||
- Update to 0.2.4
|
||||
|
||||
* Wed Jun 16 2021 Nils Philippsen <nils@redhat.com> - 0.2.3-1
|
||||
- Update to 0.2.3
|
||||
|
||||
* Fri Jun 04 2021 Nils Philippsen <nils@redhat.com> - 0.2.2-1
|
||||
- Update to 0.2.2
|
||||
|
||||
* Thu May 27 2021 Nils Philippsen <nils@redhat.com> - 0.2.1-1
|
||||
- Update to 0.2.1
|
||||
|
||||
* Thu May 27 2021 Stephen Coady <scoady@redhat.com> - 0.2.0-1
|
||||
- Update to 0.2.0
|
||||
|
||||
* Thu May 27 2021 Nils Philippsen <nils@redhat.com>
|
||||
- don't ship obsolete Koji configuration snippet
|
||||
|
||||
* Wed May 19 2021 Nils Philippsen <nils@redhat.com>
|
||||
- remove git-core, fix RPM related dependencies
|
||||
|
||||
* Wed May 12 2021 Nils Philippsen <nils@redhat.com>
|
||||
- depend on python3-pygit2
|
||||
|
||||
* Thu Apr 22 2021 Nils Philippsen <nils@redhat.com>
|
||||
- remove the hub plugin
|
||||
|
||||
* Thu Apr 15 2021 Nils Philippsen <nils@redhat.com> - 0.1.5-1
|
||||
- Update to 0.1.5
|
||||
- Have lowercase URLs, because Pagure d'oh
|
||||
|
||||
* Thu Apr 15 2021 Nils Philippsen <nils@redhat.com> - 0.1.4-1
|
||||
- Update to 0.1.4
|
||||
- explicitly BR: python3-setuptools
|
||||
|
||||
* Thu Apr 09 2020 Pierre-Yves Chibon <pingou@pingoured.fr> - 0.1.3-1
|
||||
- Update to 0.1.3
|
||||
|
||||
* Thu Apr 09 2020 Pierre-Yves Chibon <pingou@pingoured.fr> - 0.1.2-1
|
||||
- Update to 0.1.2
|
||||
|
||||
* Thu Apr 09 2020 Pierre-Yves Chibon <pingou@pingoured.fr> - 0.1.1-1
|
||||
- Update to 0.1.1
|
||||
|
||||
* Thu Apr 09 2020 Pierre-Yves Chibon <pingou@pingoured.fr> - 0.1.0-1
|
||||
- Update to 0.1.0
|
||||
|
||||
* Wed Apr 08 2020 Pierre-Yves Chibon <pingou@pingoured.fr> - 0.0.23-1
|
||||
- Update to 0.023
|
||||
|
||||
* Wed Apr 08 2020 Pierre-Yves Chibon <pingou@pingoured.fr> - 0.0.22-1
|
||||
- Update to 0.0.22
|
||||
|
||||
* Wed Apr 08 2020 Pierre-Yves Chibon <pingou@pingoured.fr> - 0.0.21-1
|
||||
- Update to 0.0.21
|
||||
|
||||
* Wed Apr 08 2020 Pierre-Yves Chibon <pingou@pingoured.fr> - 0.0.20-1
|
||||
- Update to 0.0.20
|
||||
|
||||
* Wed Apr 08 2020 Pierre-Yves Chibon <pingou@pingoured.fr> - 0.0.19-1
|
||||
- Update to 0.0.19
|
||||
|
||||
* Wed Apr 08 2020 Pierre-Yves Chibon <pingou@pingoured.fr> - 0.0.18-1
|
||||
- Update to 0.0.18
|
||||
|
||||
* Tue Apr 07 2020 Pierre-Yves Chibon <pingou@pingoured.fr> - 0.0.17-1
|
||||
- Update to 0.0.17
|
||||
|
||||
* Tue Apr 07 2020 Pierre-Yves Chibon <pingou@pingoured.fr> - 0.0.16-1
|
||||
- Update to 0.0.16
|
||||
|
||||
* Tue Apr 07 2020 Pierre-Yves Chibon <pingou@pingoured.fr> - 0.0.15-1
|
||||
- Update to 0.0.15
|
||||
|
||||
* Tue Apr 07 2020 Pierre-Yves Chibon <pingou@pingoured.fr> - 0.0.14-1
|
||||
- Update to 0.0.14
|
||||
|
||||
* Tue Apr 07 2020 Pierre-Yves Chibon <pingou@pingoured.fr> - 0.0.13-1
|
||||
- Update to 0.0.13
|
||||
|
||||
* Tue Apr 07 2020 Pierre-Yves Chibon <pingou@pingoured.fr> - 0.0.12-1
|
||||
- Update to 0.0.12
|
||||
|
||||
* Mon Apr 06 2020 Pierre-Yves Chibon <pingou@pingoured.fr> - 0.0.11-1
|
||||
- Update to 0.0.11
|
||||
|
||||
* Fri Apr 03 2020 Nils Philippsen <nils@redhat.com> - 0.0.10-1
|
||||
- Update to 0.0.10
|
||||
|
||||
* Fri Apr 03 2020 Pierre-Yves Chibon <pingou@pingoured.fr> - 0.0.9-1
|
||||
- Update to 0.0.9
|
||||
|
||||
* Fri Apr 03 2020 Pierre-Yves Chibon <pingou@pingoured.fr> - 0.0.8-1
|
||||
- Update to 0.0.8
|
||||
|
||||
* Fri Apr 03 2020 Pierre-Yves Chibon <pingou@pingoured.fr> - 0.0.7-1
|
||||
- Update to 0.0.7
|
||||
|
||||
* Thu Apr 02 2020 Pierre-Yves Chibon <pingou@pingoured.fr> - 0.0.6-1
|
||||
- Update to 0.0.6
|
||||
|
||||
* Tue Mar 31 2020 Pierre-Yves Chibon <pingou@pingoured.fr> - 0.0.5-1
|
||||
- Update to 0.0.5
|
||||
|
||||
* Tue Mar 31 2020 Pierre-Yves Chibon <pingou@pingoured.fr> - 0.0.4-1
|
||||
- Update to 0.0.4
|
||||
|
||||
* Tue Mar 31 2020 Pierre-Yves Chibon <pingou@pingoured.fr> - 0.0.3-1
|
||||
- Update to 0.0.3
|
||||
|
||||
* Tue Mar 31 2020 Pierre-Yves Chibon <pingou@pingoured.fr> - 0.0.2-1
|
||||
- Update to 0.0.2
|
||||
|
||||
* Wed Mar 18 2020 Adam Saleh <asaleh@redhat.com> - 0.0.1-1
|
||||
- initial package for Fedora
|
173
python-rpmautospec.spec
Normal file
173
python-rpmautospec.spec
Normal file
@ -0,0 +1,173 @@
|
||||
# Polyfill %%bcond() macro for platforms without it
|
||||
%if 0%{!?bcond:1}
|
||||
%define bcond() %[ (%2)\
|
||||
? "%{expand:%%{!?_without_%{1}:%%global with_%{1} 1}}"\
|
||||
: "%{expand:%%{?_with_%{1}:%%global with_%{1} 1}}"\
|
||||
]
|
||||
%endif
|
||||
|
||||
# The pytest-xdist package is not available when bootstrapping or for EL builds
|
||||
%bcond xdist %{undefined rhel}
|
||||
|
||||
# Package the placeholder rpm-macros (moved to redhat-rpm-config in F40)
|
||||
%if ! (0%{?fedora} >= 40 || 0%{?rhel} >= 10)
|
||||
%bcond rpmmacropkg 1
|
||||
%else
|
||||
%bcond rpmmacropkg 0
|
||||
%endif
|
||||
|
||||
%if ! 0%{?fedora}%{?rhel} || 0%{?fedora} || 0%{?epel} >= 9
|
||||
%bcond poetry 1
|
||||
# Appease old Poetry versions (<1.2.0a2)
|
||||
%if ! 0%{?fedora}%{?rhel} || 0%{?fedora} >= 38 || 0%{?rhel} >= 10
|
||||
%bcond old_poetry 0
|
||||
%else
|
||||
%bcond old_poetry 1
|
||||
%endif
|
||||
%else
|
||||
%bcond poetry 0
|
||||
%endif
|
||||
|
||||
%if ! 0%{?fedora}%{?rhel} || 0%{?fedora} || 0%{?epel} >= 9 || 0%{?rhel} >= 10
|
||||
%bcond manpage_manual_title 1
|
||||
%else
|
||||
%bcond manpage_manual_title 0
|
||||
%endif
|
||||
|
||||
%global srcname rpmautospec
|
||||
|
||||
Name: python-%{srcname}
|
||||
Version: 0.6.5
|
||||
Release: %autorelease
|
||||
Summary: Package and CLI tool to generate release fields and changelogs
|
||||
License: MIT
|
||||
URL: https://github.com/fedora-infra/%{srcname}
|
||||
Source0: https://github.com/fedora-infra/%{srcname}/releases/download/%{version}/%{srcname}-%{version}.tar.gz
|
||||
|
||||
%if 0%{!?pyproject_files:1}
|
||||
%global pyproject_files %{_builddir}/%{name}-%{version}-%{release}.%{_arch}-pyproject-files
|
||||
%endif
|
||||
|
||||
BuildArch: noarch
|
||||
BuildRequires: argparse-manpage
|
||||
BuildRequires: git
|
||||
# the langpacks are needed for tests
|
||||
BuildRequires: glibc-langpack-de
|
||||
BuildRequires: glibc-langpack-en
|
||||
BuildRequires: python3-devel >= 3.9.0
|
||||
# The dependencies needed for testing don’t get auto-generated.
|
||||
BuildRequires: python3dist(pytest)
|
||||
%if %{with xdist}
|
||||
BuildRequires: python3dist(pytest-xdist)
|
||||
%endif
|
||||
BuildRequires: python3dist(pyyaml)
|
||||
BuildRequires: sed
|
||||
|
||||
%if %{without poetry}
|
||||
BuildRequires: python3dist(babel)
|
||||
BuildRequires: python3dist(pygit2)
|
||||
BuildRequires: python3dist(rpm)
|
||||
BuildRequires: python3dist(rpmautospec-core)
|
||||
BuildRequires: python3dist(setuptools)
|
||||
%{?python_provide:%python_provide python3-%{srcname}}
|
||||
%endif
|
||||
|
||||
%global _description %{expand:
|
||||
A package and CLI tool to generate RPM release fields and changelogs.}
|
||||
|
||||
%description %_description
|
||||
|
||||
%package -n python3-%{srcname}
|
||||
Summary: %{summary}
|
||||
%{?python_provide:%python_provide python3-%{srcname}}
|
||||
|
||||
%description -n python3-%{srcname} %_description
|
||||
|
||||
%package -n %{srcname}
|
||||
Summary: CLI tool for generating RPM releases and changelogs
|
||||
Requires: python3-%{srcname} = %{version}-%{release}
|
||||
|
||||
%description -n %{srcname}
|
||||
CLI tool for generating RPM releases and changelogs
|
||||
|
||||
%if %{with rpmmacropkg}
|
||||
%package -n rpmautospec-rpm-macros
|
||||
Summary: Rpmautospec RPM macros for local rpmbuild
|
||||
Requires: rpm
|
||||
|
||||
%description -n rpmautospec-rpm-macros
|
||||
This package contains RPM macros with placeholders for building rpmautospec
|
||||
enabled packages locally.
|
||||
%endif
|
||||
|
||||
%generate_buildrequires
|
||||
%if %{with poetry}
|
||||
%pyproject_buildrequires
|
||||
%endif
|
||||
|
||||
%prep
|
||||
%autosetup -n %{srcname}-%{version}
|
||||
%if %{with old_poetry}
|
||||
sed -i \
|
||||
-e 's/\[tool\.poetry\.group\.dev\.dependencies\]/[tool.poetry.dev-dependencies]/g' \
|
||||
pyproject.toml
|
||||
%endif
|
||||
|
||||
# https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/#_linters
|
||||
sed -i -e '/pytest-cov/d; /addopts.*--cov/d' pyproject.toml
|
||||
|
||||
%build
|
||||
%if %{with poetry}
|
||||
%pyproject_wheel
|
||||
%else
|
||||
%py3_build
|
||||
%endif
|
||||
|
||||
%install
|
||||
%if %{with poetry}
|
||||
%pyproject_install
|
||||
%pyproject_save_files %{srcname}
|
||||
# Work around poetry not listing license files as such in package metadata.
|
||||
sed -i -e 's|^\(.*/LICENSE\)|%%license \1|g' %{pyproject_files}
|
||||
%else
|
||||
%py3_install
|
||||
cat << EOF > %{pyproject_files}
|
||||
%{python3_sitelib}/%{srcname}/
|
||||
%{python3_sitelib}/*.egg-info/
|
||||
EOF
|
||||
%endif
|
||||
|
||||
install -d %{buildroot}%{_mandir}/man1
|
||||
PYTHONPATH=%{buildroot}%{python3_sitelib} argparse-manpage \
|
||||
%if %{with manpage_manual_title}
|
||||
--manual-title "User Commands" \
|
||||
%endif
|
||||
--project-name rpmautospec \
|
||||
--module rpmautospec.cli \
|
||||
--function get_arg_parser > %{buildroot}%{_mandir}/man1/rpmautospec.1
|
||||
|
||||
%if %{with rpmmacropkg}
|
||||
mkdir -p %{buildroot}%{rpmmacrodir}
|
||||
install -m 644 rpm/macros.d/macros.rpmautospec %{buildroot}%{rpmmacrodir}/
|
||||
%endif
|
||||
|
||||
%check
|
||||
%pytest -v \
|
||||
%if %{with xdist}
|
||||
--numprocesses=auto
|
||||
%endif
|
||||
|
||||
%files -n python3-%{srcname} -f %{pyproject_files}
|
||||
%doc README.rst
|
||||
|
||||
%files -n %{srcname}
|
||||
%{_bindir}/rpmautospec
|
||||
%{_mandir}/man1/rpmautospec.1*
|
||||
|
||||
%if %{with rpmmacropkg}
|
||||
%files -n rpmautospec-rpm-macros
|
||||
%{rpmmacrodir}/macros.rpmautospec
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
%autochangelog
|
Loading…
Reference in New Issue
Block a user