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

Version generation for PRs does not guarantee increasing values #693

Closed
sgallagher opened this issue Jan 30, 2020 · 11 comments · Fixed by #748
Closed

Version generation for PRs does not guarantee increasing values #693

sgallagher opened this issue Jan 30, 2020 · 11 comments · Fixed by #748
Assignees
Labels
area/user-experience Usability issue kind/feature New feature or a request for enhancement. triaged This issue was already processed by the team.

Comments

@sgallagher
Copy link
Contributor

If a pull request involves a rebase (such as to squash in some fixup commits or drop some unneeded changes), there is no guarantee that the NEVRA of the resulting RPM will sort higher than the previous push. This is because the version logic uses git describe, which adds a new version section based on the number of commits since the most recent tag. If we squash the patches, this number goes down.

For example, I build the following two libmodulemd builds from the same PR, the first with a number of patches and the second with them all squashed in together:

  • libmodulemd.2.8.3.39.g7b928e6-0.fc30.20200130141552
  • libmodulemd.2.8.3.32.gdd69720-0.fc30.20200130144520

Using git describe is useful for uniqueness, but it should not be part of the Version: field in RPM. That should be reserved for the output of git describe --abbrev=0 which would result in libmodulemd-2.8.3. The remainder of the git description should be moved to the Release: field in RPM. For maximum effect, it should probably be something like: `Release: 0.%{current_time}.%{git_desc_suffix}.

The result would be something that looks like libmodulemd-2.8.3-0.20200130144520.32.gdd69720.fc30. Because the timestamp precedes the description, it will be preferred when doing NEVRA comparisons.

@lachmanfrantisek lachmanfrantisek added the area/user-experience Usability issue label Feb 11, 2020
@lachmanfrantisek
Copy link
Member

lachmanfrantisek commented Feb 11, 2020

@sgallagher

Thanks for the detailed description. The example format is pretty long but solves the problem without losing the git info. What do others think?


Note for us: We need to take into consideration also the custom version commands.

@sgallagher
Copy link
Contributor Author

A more complete analysis of the problem is documented for Fedora packaging guidelines at https://docs.fedoraproject.org/en-US/packaging-guidelines/Versioning/#_snapshots

@dhodovsk
Copy link
Contributor

Related to: oamg/convert2rhel#11

@sturivny
Copy link

Hi, guys do you have any updates?

@TomasTomecek TomasTomecek added the kind/feature New feature or a request for enhancement. label Feb 27, 2020
@TomasTomecek
Copy link
Member

Good idea, we should do that. @sgallagher very nice write-up.

@TomasTomecek TomasTomecek added the triaged This issue was already processed by the team. label Feb 27, 2020
@dmach
Copy link

dmach commented Mar 2, 2020

I have a bad feeling about packit touching the version.
The best practice is that downstream packaging (packit falls into this category) never touches version and uses the release fields for increasing the build numbers.

That's why I'd prefer:
Name: libmodulemd
Version: 2.8.3 (equal to upstream version)
Release: <original release number>.git.39.g7b928e6%{?dist} (+ eventually any additional details such as build time as @sgallagher suggested)

Pre-release versioning with tilde should also work, but I'm not sure if it's possible to fully automate it. And as I understand it, it's primarily meant for Alphas, Betas, RCs and other named milestones, not for generic pre-release builds.

@sgallagher
Copy link
Contributor Author

@dmach You've described almost the same solution I provided, except that your approach doesn't solve the specific problem of "squashed patches means the NEVRA goes backwards". That's why the build time needs to be ahead of the git.39.<hash> portion.

@TomasTomecek TomasTomecek self-assigned this Mar 5, 2020
@TomasTomecek
Copy link
Member

I'd say this is not that hard to do on packit's side. I'm gonna give it a shot.

@TomasTomecek
Copy link
Member

TomasTomecek commented Mar 5, 2020

@sgallagher

0.%{current_time}...

The zero is static right? It's the "basic release number" - we probably don't want to start with the current time number since it's too big. Is that correct?

Edit: okay, Dan suggests original release number, that makes sense, gonna do that

TomasTomecek added a commit to TomasTomecek/packit that referenced this issue Mar 5, 2020
Fixes packit#693

Signed-off-by: Tomas Tomecek <ttomecek@redhat.com>
@TomasTomecek
Copy link
Member

This is now getting to be really complicated: I agree to use release for tracibility. But it means this is solved on the RPM-level and not on the upstream level (or ecosystem-specific packaging level).

Example: we are using setuptools scm for packit which uses git describe style of versions. Hence our tarballs are expected to use git-describe style of naming - should this be reflected in the spec file?

The way I am planning to solve this:

  1. Implement the proposed solution to not tamper version by default and stuff git-desc into release
  2. change default get latest upstream version to git describe --abbrev=0 which people can override and get the old behaviour (which packit itself needs actually)

@sgallagher
Copy link
Contributor Author

@sgallagher

0.%{current_time}...

The zero is static right? It's the "basic release number" - we probably don't want to start with the current time number since it's too big. Is that correct?

Edit: okay, Dan suggests original release number, that makes sense, gonna do that

Right, the purpose there is to ensure a "real" release sorts higher.

TomasTomecek added a commit to TomasTomecek/packit that referenced this issue Mar 6, 2020
Fixes packit#693

Read that issue for more info (and get a coffee).

Signed-off-by: Tomas Tomecek <ttomecek@redhat.com>
TomasTomecek added a commit to TomasTomecek/packit that referenced this issue Mar 9, 2020
Fixes packit#693

Read that issue for more info (and get a coffee).

Signed-off-by: Tomas Tomecek <ttomecek@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/user-experience Usability issue kind/feature New feature or a request for enhancement. triaged This issue was already processed by the team.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants