#52 rpkg not setting version from git tag
Closed by frostyx. Opened by ipilcher.

I cannot get rpkg to set the RPM version from a git tag.

I have created the tag.

$ rpkg tag --version 0.0.0 --skip-edit
Created tag libsht-0.0.0-1
$ git tag
libsht-0.0.0-1

But it's still not being recognized.

$ rpkg nvr
libsht-0.0.git.48.1dc6f8d9.dirty.3frpxp-1.fc42

I have tried setting the version in the SPEC template to all of the following, with exactly the same result.

  • {{{ git_cwd_version }}}
  • {{{ git_cwd_version lead= }}}
  • {{{ git_cwd_version lead=0 }}}
  • {{{ git_dir_version }}}
  • {{{ git_dir_version lead= }}}
  • {{{ git_dir_version lead=0 }}}

I am using rpkg-3.3-2.fc42.noarch.

Here is the complete SPEC template, which lives at rpm/libsht.spec.rpkg in my repository. (It's still a work in progress; I'll need to figure out how to set the shared object file name and soname once I get the version figured out.)

Name:       libsht
Summary:    Simple hash table for C programs
Version:    {{{ git_cwd_version }}}
Release:    1%{?dist}
License:    GPL-3.0-or-later
URL:        https://github.com/ipilcher/sht
Source:     {{{ git_cwd_pack }}}
BuildRequires:  gcc
%description
A simple hash table library for C programs.
%package devel
Summary:    Development files for libsht
Requires:   %{name}%{?_isa} = %{version}-%{release}
%description devel
Header file for libsht development.
%prep
{{{ git_cwd_setup_macro }}}
%build
cd src
%__cc %optflags -Wextra -Wcast-qual -Wcast-align=strict -fPIC -shared \
    -Wl,-soname,libsht.so.0.1 -o libsht.so.0.1.0 sht.c
%install
%__mkdir_p %{buildroot}%{_libdir}
%__cp src/libsht.so.0.1.0 %{buildroot}%{_libdir}/
%__ln_s libsht.so.0.1.0 %{buildroot}%{_libdir}/libsht.so.0.1
%__mkdir_p %{buildroot}%{_includedir}
%__cp src/sht.h %{buildroot}%{_includedir}/
%__ln_s libsht.so.0.1.0 %{buildroot}%{_libdir}/libsht.so
%files
%license LICENSE
%attr(0755, root, root) %{_libdir}/libsht.so.0.1.0
%attr(-, root, root) %{_libdir}/libsht.so.0.1
%files devel
%attr(0644, root, root) %{_includedir}/sht.h
%attr(-, root, root) %{_libdir}/libsht.so
%changelog
* Sat Nov 8 2025 Ian Pilcher <arequipeno@gmail.com>
* Initial SPEC file

Hello @ipilcher, thank you for the report.
This project is no longer being developed, so I cannot promise anyone will investigate and fix the issue. PRs are most definitely welcome, so if you fix the issue, we can make a new upstream release for you.

This issue has been migrated to GitHub: https://github.com/fedora-copr/rpkg-util/issues/52
Don't forget to subscribe for notifications about new comments.

Metadata Update from @frostyx:
- Issue status updated to: Closed (was: Open)

Metadata