dracut icon indicating copy to clipboard operation
dracut copied to clipboard

refactor: maintain dracut version in dracut.sh

Open bdrung opened this issue 2 years ago • 6 comments

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

  • [x] 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

bdrung avatar Aug 24 '23 09:08 bdrung

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

LaszloGombos avatar Aug 24 '23 14:08 LaszloGombos

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!

ahesford avatar Aug 25 '23 14:08 ahesford

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.

LaszloGombos avatar Aug 26 '23 23:08 LaszloGombos

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[bot] avatar Oct 15 '23 07:10 stale[bot]

Changed fix to refactor.

bdrung avatar Oct 16 '23 10:10 bdrung

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[bot] avatar Apr 22 '24 09:04 stale[bot]