Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

It is possible to get version-release from multiple lines (rpm spec)? #43

Open
vooon opened this issue Nov 15, 2018 · 2 comments
Open

Comments

@vooon
Copy link

vooon commented Nov 15, 2018

I want to also bump release number of spec file, but it was on separate line. e.g.

Version: 0.5.0
Release: 1{?%dist}

My .bumpversion.cfg

[bumpversion]
current_version = 0.5.0
commit = True
tag = True

[bumpversion:file:mysrv/__init__.py]

[bumpversion:file:spec/mysrv.spec]
@c4urself
Copy link
Owner

Hmm, that would require a re.MULTILINE regex matching, maybe try a local dev version and change this line: https://github.com/c4urself/bump2version/blob/master/bumpversion/version_part.py#L137 to see if it works and send a PR?

@florisla
Copy link
Collaborator

florisla commented Jan 6, 2020

Perhaps you can work around this limitation using a trick.

Version-bump the file twice -- which you can do as long as the INI headers are not identical, e.g. if the file name is written differently the second time.

Employ different parse, serialize, search and replace like this:

[bumpversion]
current_version = 0.5.0.1
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+).(?P<build>\d+)
serialize = {major}.{minor}.{patch}.{build}

[bumpversion:file:rpm.spec]
search = Version: {current_version}
replace = Version: {new_version}
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)
serialize = {major}.{minor}.{patch}

[bumpversion:file:./rpm.spec]
search = Release: {current_version}
replace= Release: {new_version}
parse = (?P<build>\d+)
serialize = {build}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants