From b8348dfa67401403d279fff526c991a9dda0568f Mon Sep 17 00:00:00 2001 From: Dipta Biswas <73038615+hazel-bunny@users.noreply.github.com> Date: Fri, 12 Apr 2024 13:24:20 +0600 Subject: [PATCH 1/3] Create python-git-versioner.spec Fixes #1064 Signed-off-by: Dipta Biswas <73038615+hazel-bunny@users.noreply.github.com> --- .../git-versioner/python-git-versioner.spec | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 anda/langs/python/git-versioner/python-git-versioner.spec diff --git a/anda/langs/python/git-versioner/python-git-versioner.spec b/anda/langs/python/git-versioner/python-git-versioner.spec new file mode 100644 index 0000000000..b11e600900 --- /dev/null +++ b/anda/langs/python/git-versioner/python-git-versioner.spec @@ -0,0 +1,60 @@ +%global module git-versioner +%global upstream __version__ + +Name: python-%{module} +Version: 7.1 +Release: %autorelease +Summary: Manage current / next version for project +License: MIT +URL: https://gitlab.com/alelec/%{upstream} +Source: %{url}/-/archive/v%{version}/%{upstream}-v%{version}.tar.gz + +BuildArch: noarch +BuildRequires: python3-devel + +%global _description %{expand: +Manages the version number for the project based on git tags. The goal +of this packages versioning scheme is to avoid ever needing to manually +create versions numbers or update version details in files that need to +be committed to the repository. + +The general rule is: +- If on a tag, report that as-is. +- When changes are made / git commits added, auto-increment the +appropriate level of the semantic version.} + +%description %_description + +%package -n python3-%{module} +Summary: %{summary} + +%description -n python3-%{module} %_description + + +%prep +%setup -qn %{upstream}-v%{version} +sed -i 's,0.0.0,%{version},' %{upstream}.py +sed -i 's,0.0-new,%{version},' %{upstream}.py +sed -i 's,0.0+new,%{version},' %{upstream}.py +sed -i 's,0.0,%{version},' %{upstream}.py +sed -i 's,on_tag = False,on_tag = True,' %{upstream}.py +sed -i 's,dirty = True,dirty = False,' %{upstream}.py + +%generate_buildrequires +%pyproject_buildrequires + +%build +%pyproject_wheel + +%install +%pyproject_install +%pyproject_save_files %{upstream} + +%check +%pyproject_check_import %{upstream} + +%files -n python3-%{module} -f %{pyproject_files} +%{_bindir}/%{module} + +%changelog +%autochangelog From d76181caaa0c5a8f39b97a393c54dfec1086e040 Mon Sep 17 00:00:00 2001 From: Dipta Biswas <73038615+hazel-bunny@users.noreply.github.com> Date: Fri, 12 Apr 2024 13:27:42 +0600 Subject: [PATCH 2/3] Create anda.hcl Signed-off-by: Dipta Biswas <73038615+hazel-bunny@users.noreply.github.com> --- anda/langs/python/git-versioner/anda.hcl | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 anda/langs/python/git-versioner/anda.hcl diff --git a/anda/langs/python/git-versioner/anda.hcl b/anda/langs/python/git-versioner/anda.hcl new file mode 100644 index 0000000000..d42cacf362 --- /dev/null +++ b/anda/langs/python/git-versioner/anda.hcl @@ -0,0 +1,5 @@ +project pkg { + rpm { + spec = "python-git-versioner.spec" + } +} From f4dbeaa6855c4cc4deb4bf2482158705cb706d16 Mon Sep 17 00:00:00 2001 From: Dipta Biswas <73038615+hazel-bunny@users.noreply.github.com> Date: Fri, 12 Apr 2024 13:29:01 +0600 Subject: [PATCH 3/3] Create update.rhai Signed-off-by: Dipta Biswas <73038615+hazel-bunny@users.noreply.github.com> --- anda/langs/python/git-versioner/update.rhai | 1 + 1 file changed, 1 insertion(+) create mode 100644 anda/langs/python/git-versioner/update.rhai diff --git a/anda/langs/python/git-versioner/update.rhai b/anda/langs/python/git-versioner/update.rhai new file mode 100644 index 0000000000..70e7311966 --- /dev/null +++ b/anda/langs/python/git-versioner/update.rhai @@ -0,0 +1 @@ +rpm.version(gh_tag("alelec/__version__"));