#41 rpmdev-bumpspec --new concatenates version twice
Opened by nicoulaj. Modified

Using rpmdev-bumpspec 1.0.13 from rpmdevtools 8.10, on this spec file:

# Turn off the brp-python-bytecompile script
%global __os_install_post %(echo '%{__os_install_post}' | sed -e 's!/usr/lib[^[:space:]]*/brp-python-bytecompile[[:space:]].*$!!g')
%global debug_package %{nil}
Name:     zsh-completions    
Version:  0.28.0
Release:  1%{?dist}
Summary:  Additional completion definitions for Zsh.
Group:    Development/Tools
License:  MIT
URL:      https://github.com/zsh-users/%{name}
Source0:  https://github.com/zsh-users/%{name}/archive/%{version}.tar.gz
Requires: zsh
%description
Additional completion definitions for Zsh.
%prep
%setup -q
%build
%install
rm -rf %{buildroot}
install -d 755 %{buildroot}/usr/share/zsh/site-functions
install -pm 755 src/_* %{buildroot}/usr/share/zsh/site-functions/
%files
%defattr(-,root,root,-)
/usr/share/zsh/
%changelog
* Sun Oct 14 2018 Julien Nicoulaud <julien.nicoulaud@gmail.com> - 0.28.0-1
- Version 0.28.0
* Thu Oct 19 2017 Julien Nicoulaud <julien.nicoulaud@gmail.com> - 0.27.0-1
- Version 0.27.0
* Tue Jul 18 2017 Julien Nicoulaud <julien.nicoulaud@gmail.com> - 0.26.0-1
- Version 0.26.0
* Fri May 12 2017 Julien Nicoulaud <julien.nicoulaud@gmail.com> - 0.25.0-1
- Version 0.25.0
* Fri Apr 14 2017 Julien Nicoulaud <julien.nicoulaud@gmail.com> - 0.24.0-1
- Version 0.24.0
* Tue Feb 28 2017 Julien Nicoulaud <julien.nicoulaud@gmail.com> - 0.23.0-1
- Version 0.23.0
* Tue Dec 27 2016 Julien Nicoulaud <julien.nicoulaud@gmail.com> 0.22.0-1
- Version 0.22.0

When I run:

rpmdev-bumpspec --comment "Version 0.29.0" --new '0.29.0' zsh-completions.spec

Version, Release and changelog are updated with wrong values:

Version:  0.29.00.29.0
Release:  1%{?dist}1%{?dist}
%changelog
* Sun Oct 14 2018 Julien Nicoulaud <julien.nicoulaud@gmail.com> - 0.29.00.29.0-11
- Version 0.29.0

Note: using rpmdevtools package on Arch Linux, which uses python 3.7.0 by default...

If I manually change the shebang of /usr/bin/rpmdev-bumpspec to /usr/bin/python2 (which is python 2.7.15), it works as expected.

I also encountered this going from Fedora 28 (python 3.6) to F29 (py3.7).

I found the substitutions in SpecFile.newVersion which use the pattern r'[^: \t]*$'. I believe they're affected by this change to re.sub:

Changed in version 3.7: Unknown escapes in repl consisting of '\' and an ASCII letter now are errors.

Empty matches for the pattern are replaced when adjacent to a previous non-empty match.

So I think now we're getting one non-empty match up to the end of the line, then an adjacent empty match where * matches zero characters. It feels like this might be a Python bug that the first match doesn't "consume" $ to prevent more matches though.

Should be fixed by #42.

42 fixes it for me. Any chance we could get a point release with this fix?

Metadata