dracutdevs / dracut

dracut the event driven initramfs infrastructure
https://github.com/dracutdevs/dracut/wiki
GNU General Public License v2.0
598 stars 397 forks source link

refactor: maintain dracut version in dracut.sh #2500

Open bdrung opened 1 year ago

bdrung commented 1 year ago

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

Fixes #2169

LaszloGombos commented 1 year ago

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

ahesford commented 1 year ago

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 commented 1 year ago

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[bot] commented 11 months ago

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.

bdrung commented 11 months ago

Changed fix to refactor.

stale[bot] commented 4 months ago

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.