#46 I'm unable to create a tag that rpkg can use for versioning
Closed by derisis13. Opened by derisis13.

I'm trying to get rpkg's versioning to work, but I can't make it pick up on my tag.
I ran rpkg tag --version=3.2 (I want to package an existing project) and edited the annotation, then saved it.

[lacko@ipad-100 ani-cli]$ rpkg tag --version=3.2
Created tag ani-cli-3.2-1

Then I checked my tags, and sure, there it is:

[lacko@ipad-100 ani-cli]$ git tag
ani-cli-3.2-1
v1.5
v1.6
v1.7
v1.8
v1.9
v2.0
v2.1
v2.2
v3.0
v3.2

But then if I run rpkg nvrI get this:

[lacko@ipad-100 ani-cli]$ rpkg nvr
ani-cli-0.0.git.557.7154cead-1.fc36

I checked #26 which had similar symptoms, but I haven't touched the Name and Version variables. For further context, here's my spec file:

# vim: syntax=spec
# git_dir_name returns repository name derived from remote Git repository URL
Name:       {{{ git_dir_name }}}
# git_dir_version returns version based on commit and tag history of the Git project
Version:    {{{ git_dir_version }}}
# This can be useful later for adding downstream patches
Release:    1%{?dist}
Summary:    A cli to browse and watch anime. Only mpv.
License:   GPLv3
# Home page of the project. Can also point to the public Git repository page.
URL:        https://github.com/pystardust/ani-cli
# Detailed information about the source Git repository and the source commit
# for the created rpm package
VCS:        {{{ git_dir_vcs }}}
# git_dir_pack macro places the repository content (the source files) into a tarball
# and returns its filename. The tarball will be used to build the rpm.
Source:     {{{ git_dir_pack }}}
Requires: grep, sed, gawk, curl, openssl, mpv
Conflicts: ani-cli-full
BuildArch: noarch
# More detailed description of the package
%description
A cli to browse and watch anime (alone AND with friends). This tool scrapes the site https://animixplay.to 
This package of ani-cli only includes playing via mpv.
# https://superuser.com/questions/1091529/rpm-build-error-empty-files-file-debugfiles-list
%global debug_package %{nil}
# The following four sections already describe the rpm build process itself.
# prep will extract the tarball defined as Source above and descend into it.
%prep
{{{ git_dir_setup_macro }}}
# This will invoke `make` command in the directory with the extracted sources.
%build
chmod +x "bin/ani-cli"
# Copying all files except iina player because iina is OSX only
%install
mkdir -p %{buildroot}/usr/bin %{buildroot}/usr/lib/ani-cli
cp "bin/ani-cli" %{buildroot}/usr/bin
cp -a "lib/ani-cli/UI" "lib/ani-cli/player_mpv" %{buildroot}/usr/lib/ani-cli
# This lists all the files that are included in the rpm package and that
# are going to be installed into target system where the rpm is installed.
%files
/usr/bin/ani-cli
/usr/lib/ani-cli/UI
/usr/lib/ani-cli/player_*
# Finally, changes from the latest release of your application are generated from
# your project's Git history. It will be empty until you make first annotated Git tag.
%changelog
{{{ git_dir_changelog }}}

I must be missing something, but I have no idea what.
Alternatively it might be that rpkg can't process the name because it has a - inside the name. If this is the case, what can I do?


Hello,

it might be that you need:

Version:    {{{ git_dir_version lead= }}}

By default lead (major version component) is 0, which means it won't match the tag you have created (ad. https://docs.pagure.org/rpkg-util/v3/macro_reference.html#git-version-v3).
I know it's a bit counter-intuitive to need to do that but there were certain reasons for the zero default :).

It worked, thank you very much! I kinda ignored the lead variable (option?) because I thought it was 0 as nothing, not as the 0 string. I should have been more observant and not waste your time

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

No problem. Glad that it worked!

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

Metadata