-
-
Save Killeroid/469dca12dad7f7162c140899bf1be93e to your computer and use it in GitHub Desktop.
Shell script to regenerate debian changelog from git log
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
sudo apt-get install -y moreutils git-buildpackage | |
>debian/changelog | |
prevtag=initial | |
pkgname=`cat debian/control | grep '^Package: ' | sed 's/^Package: //'` | |
git tag -l v* | sort -V | while read tag; do | |
(echo "$pkgname (${tag#v}) unstable; urgency=low\n"; git log --pretty=format:' * %s' $prevtag..$tag; git log --pretty='format:%n%n -- %aN <%aE> %aD%n%n' $tag^..$tag) | cat - debian/changelog | sponge debian/changelog | |
prevtag=$tag | |
done | |
tag=`git tag -l v* | sort -V | tail -1` | |
[ `git log --exit-code $tag..HEAD | wc -l` -ne 0 ] && git-dch -s $tag -S --no-multimaint --nmu --ignore-branch --snapshot-number="'{:%Y%m%d%H%M%S}'.format(__import__('datetime').datetime.fromtimestamp(`git log -1 --pretty=format:%at`))" | |
sed -i 's/UNRELEASED/unstable/' debian/changelog | |
git commit -a -m 'regenerated debian changelog' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment