-
Notifications
You must be signed in to change notification settings - Fork 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
Remove code which corrupts versions #388
Conversation
"""Automatic detection of version number for checked-out repository.""" | ||
|
||
version = self.scm_object.detect_version(self.args.__dict__).strip() | ||
version = self.scm_object.detect_version(self.args.__dict__, truncate_at_hyphen).strip() |
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.
line too long (96 > 79 characters)
A _service file which intends to use @PARENT_TAG@ for the package version, and which uses versionrewrite-pattern to process the tag further, will be unable to process the full tag name to extract the desired parts of it via versionrewrite-replacement. The reason is the forced removal of all hyphens. It is up to the author of the _service file how the final package version is assembled. versionrewrite-pattern and versionrewrite-replacement give control how this needs to be done. Adjust detect_version to keep hyphens if the _service file uses versionrewrite-pattern, which should have been done along with the changes that introduced versionrewrite in commit 960d0ce. Fixes issue #367 Signed-off-by: Olaf Hering <[email protected]>
Any progress here? The failing test is python2 based. Is it even maintained? The failure looks like test setup problem. |
I can probably fix this by passing the property not as argument, but stuffing it somewhere else so that the actual consumers can grab it. Any idea what place that would be? |
short answer: yes.
Why? Because of pyhton2 support? |
I`m wondering if this should be something which the user should be able to configure, in this case a new parameter would be needed. @adrianschroeter : What do you think. BTW: test cases would be useful to understand the problem better. |
Also it does not work. I applied the patch and I get version with a hyphen:
|
Also it breaks vesionrewrite-pattern
|
What does it break? What is the input, what is the expected output? The goal is to pass the tag verbatim into |
Nevermind, the tag was previously butchered by removing hyphens and now it is not so the pattern must be amended to also contain the hyphens. |
You mean a |
Could you please explain the input and the expected output, in best case by a test case? I think I didn`t get the point of your commit. |
It must be possible to extract the individual parts of the verbatim tag. It is not up to tar_scm to decide if a hyphen is bad or not. That is entirely the responsibility of the |
Indeed, it works with this service file:
Nonetheless, removing hyphens was done to prevent invalid version, and it does not happen automatically anymore. This could be seen as a regression. Maybe an error should be reported when the resulting version contains a hyphen? |
rpm will report an error on bogus input. |
The problem is that upstream uses Debian style release tags such as 1.1-6 but does not adhere to the Debian policy to include only packaging changes in release (-n) and general changes in version (1.1). Hence the -n is significant. tar_scm further slaps the number of commits since the tag at the end 1.1-6.11 (as requested) and silently removes hyphens without any user control -> 1.16.11. This is clearly bogus. Trivially replacing the hyphen with dot gives valid version 1.1.6.11 but there is no way to achieve that with tar_scm. |
|
I opened another PR how I would solve the problem without the risk of tons of broken packages comments are welcome |
superseded by 2fdf897 |
A _service file which intends to use @PARENT_TAG@ for the package
version, and which uses versionrewrite-pattern to process the tag
further, will be unable to process the full tag name to extract the
desired parts of it via versionrewrite-replacement. The reason is the
forced removal of all hyphens.
It is up to the author of the _service file how the final package
version is assembled. versionrewrite-pattern and
versionrewrite-replacement give control how this needs to be done.
Remove all of the offending code, which should have been removed along
with the changes that introduced versionrewrite in commit
960d0ce.
Fixes issue #367
Signed-off-by: Olaf Hering [email protected]