-
Notifications
You must be signed in to change notification settings - Fork 33
Add version substitution support #106
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
base: master
Are you sure you want to change the base?
Conversation
src/it/test21-modifyversion/pom.xml
Outdated
| <version>1.0.1.redhat-00001</version> | ||
| <packaging>jar</packaging> | ||
|
|
||
| <name>Test Package #20</name> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be Test 21, not 20.
| String text = log() | ||
| return text.contains("Version : 1.0.1.redhat_00001") && | ||
| text.contains("Source RPM : test21-modifyversion-1.0.1.redhat_00001-1.src.rpm") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works OK, but you could pull out just the text you need to make the comparison a little easier with
Process proc = ['rpm', '-q', '--queryformat', '"%{VERSION} %{SOURCERPM}"' ]then check
text == "1.0.1.redhat_00001 test21-modifyversion-1.0.1.redhat_00001-1.src.rpm"| version = version.replaceAll(versionSubstitution.search, versionSubstitution.replace); | ||
| } | ||
| } | ||
| return new RpmVersion(this.epoch, version, this.release); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the version is invalid, it could eventually be detected here. Technically, the output filename doesn't have to be a valid RpmVersion, which means we would have to change RpmFileNameProvider to use String instead of RpmVersion, or it would fail at that point with using the non-transformed version (since makeVersion called with false there).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't want to change the output file name as that is what is used in maven storage (and is legal). I'm guessing you're referring to eclipse/packager#76 which would break rpm-builder here if an invalid version is used ; I'm beginning to think the validation might actually cause more problems that it solves. Note also RpmFileNameProvider uses the RpmVersion to extract the release as well as the version.
The reason for this enhancement is that if we have a typical RH version e.g.
1.1.0.redhat-00001then that utilises illegal characters in the version string - so this PR allows for an optional set of user-defined replacements for such characters.