Especially when it comes to application development, I’m a bit lazy and a general malcontent. I love solving the problem, but I hate dealing with the packaging and versioning and all of the stuff that makes something usable. One of the things I always have trouble with is keeping track of my spec file changelog when I am rolling something into an RPM.
To help ease that I put together a small script that will take a git repository’s log between any two tags and output it in a format that is acceptable in an RPM spec file.
To do this I started with the Fedora Packaging Guidelines for Changelogs. This gave me the proper formatting to adhere to for my script.
Next I used the changelog in the sosreport package for inspiration. It’s available in its spec file.
The script I wrote is designed to run inside of a git repository. If you can come up with a better way to collage this data from the .git directory then please feel free to share. So I’ve stuck it in a git repo so you can grab it if you want.
The output of my soscleaner app looks like this:
$ ./git2changelog -b 0.1-8 * Sat Jun 07 2014 Jamie Duncan <email@example.com> - HEAD:UNRELEASED - 2f78c26 =review - added comment in _skip_file to likely remove a now useless if clause - Merge pull request #11 from bmr-cymru/bmr-libmagic-fixes : Commit 4427b06 - Convert python to use native libmagic python-magic bindings : Commit 7db6a99 - Rename __init__ options argument for clarity : Commit f1353ea - cleaning up the magic import - fixes #10 : Commit 554af49 - removing shebang from py module : Commit f70b856 - more cleanup : Commit 6ee1339 * Wed Jun 04 2014 Jamie Duncan <firstname.lastname@example.org> - 0.1-12 - 47b3a47 =adding dist flag to spec file - clean up : Commit 400a74a - getting in with the guidelines : Commit ea1ad7c - more spec refinements : Commit 64eb638 - more spec refinements : Commit 34eadd4 - making source ref in spec file a URL : Commit aefdd9b - bringing spec file inline with Fedora standards : Commit 767e1d2 - updating macros in spec file for koji : Commit e4b46ea - adding spec file : Commit e6738c0 * Tue Jun 03 2014 Jamie Duncan <email@example.com> - 0.1-11 - ab0050b =updating changelog - packaging cleanup : Commit d4a3428 - tweaking for rhn-support-tool : Commit 06a151f - minor cleanup of an unused module and a repetitive line or 2 : Commit 7eb1726 - Update README.md : Commit 97f047f - cleaning up tarball paths. fixes #9 : Commit caa6536 - cleaning up tarball paths. fixes #9 : Commit e4e1cef - updated README.md : Commit f6c064a - updated README.md : Commit a070ebd - fixing issue where checking compression type could error out because of capital letters where i thought it would always be capitalized : Commit cbf0e7d - removing some cruft : Commit fdf82eb - removed some old chmod bits that became un-needed when it became required to run as root : Commit cb15d97 - removed xsos option that never existed in the first place. we should just use xsos for that. : Commit ed5992e - removed xsos option that never existed in the first place. we should just use xsos for that. : Commit 5c2dc32 - removed xsos option that never existed in the first place. we should just use xsos for that. : Commit 1df7e0d - Merge branch 'master' of github.com:jduncan-rva/soscleaner : Commit e462b7b - minor cleanup : Commit 5fc8ce2 - Updating README.md with better File Creation explanations : Commit bac8368 - Updating README.md with better usage examples : Commit 6589b4c - Updating README.md : Commit 7dce4a9 - disallowing octects > 3 digits - to help cut down on false positives : Commit 319591f - no longer matches IP addys starting with a 0 : Commit 0223d82
If you specify and ‘end tag’, then you won’t see the untagged commits in HEAD.