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

refactor: maintain dracut version in dracut.sh #2500

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bdrung
Copy link
Contributor

@bdrung bdrung commented Aug 24, 2023

Changes

The git release tag does not contain the dracut-version.sh file and therefore git archive will lack this file as well. The Makefile attempts to populate version information from git tags (which is impossible in an unpacked release tarball) and, failing that, reverts to whatever would be encoded in that file if it were sourced.

Maintain the dracut version directly in dracut.sh and call dracut.sh --version to get the version number. The version can be changed with a simple sed command to a new version (for releases or for distributors that want to include the packaging version):

sed -i "s/^DRACUT_VERSION=.*$/DRACUT_VERSION=\"${NEW_VERSION}\"/" dracut.sh

Checklist

  • I have tested it locally
  • I have reviewed and updated any documentation if relevant
  • I am providing new code and test(s) for it

Fixes #2169

@LaszloGombos
Copy link
Collaborator

@ahesford - do you have any thoughts on the approach in this PR ?

Copy link
Member

@aafeijoo-suse aafeijoo-suse left a 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 mean this in #2450 (comment), I was thinking of just setting DRACUT_VERSION at the beginning of dracut.sh and leave the rest of the code untouched.

If we have to sed any .sh script, I prefer #2450 and do it on the dedicated dracut-version.sh.

@ahesford
Copy link
Contributor

I don't have strong opinions on how to handle versioning in project repositories. It's a hard enough problem that, in Python, a million different packages exist to try to divine the version from various markers.

That said, the approach in this PR is pretty much how we handle versioning for ZFSBootMenu. A releng/tag-release.sh script does some git magic to extract release notes, prepare the branch for tagging, and overwrites the version of the one script that requires it. It works well enough for us!

@LaszloGombos
Copy link
Collaborator

Just a nit, but this PR no longer a fix, it is more of a refactor. Just mentioning this to prioritize and help with reviews.

@stale
Copy link

stale bot commented Oct 15, 2023

This issue is being marked as stale because it has not had any recent activity. It will be closed if no further activity occurs. If this is still an issue in the latest release of Dracut and you would like to keep it open please comment on this issue within the next 7 days. Thank you for your contributions.

@stale stale bot added the stale communication is stuck label Oct 15, 2023
@stale stale bot removed the stale communication is stuck label Oct 16, 2023
Maintain the dracut version directly in `dracut.sh` and call
`dracut.sh --version` to get the version number. The version can be
changed with a simple sed command to a new version (for releases or for
distributors that want to include the packaging version):

```
sed -i "s/^DRACUT_VERSION=.*$/DRACUT_VERSION=\"${NEW_VERSION}\"/" dracut.sh
```

Fixes dracutdevs#2169
Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
@bdrung
Copy link
Contributor Author

bdrung commented Oct 16, 2023

Changed fix to refactor.

@bdrung bdrung changed the title fix: maintain dracut version in dracut.sh refactor: maintain dracut version in dracut.sh Oct 16, 2023
Copy link

stale bot commented Apr 22, 2024

This issue is being marked as stale because it has not had any recent activity. It will be closed if no further activity occurs. If this is still an issue in the latest release of Dracut and you would like to keep it open please comment on this issue within the next 7 days. Thank you for your contributions.

@stale stale bot added the stale communication is stuck label Apr 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale communication is stuck
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Release tarballs do not include dracut-version.sh
4 participants