Permalink
Browse files

Automatically generate ChangeLog from git commits

We now have a ChangeLog automatically generated from the Git history, so users who do not
follow the proceedings in the Git repository itself can see what has changed between each
version. The ChangeLog is built whenever a source distribution archive is generated. It
can also be explicitly built by using "make ChangeLog".
  • Loading branch information...
1 parent b394bde commit c54fc95c4f7ba3f26c776871d418df54abe704d7 @pief committed Feb 26, 2013
Showing with 30 additions and 2 deletions.
  1. +2 −1 .gitignore
  2. +1 −0 MANIFEST.in
  3. +27 −1 Makefile
View
@@ -1,5 +1,6 @@
+setup.py
+ChangeLog
MANIFEST
build
dist
-setup.py
*.pyc
View
@@ -1,3 +1,4 @@
+include ChangeLog
include LICENSE
include EXAMPLE-MIB.txt
include example_agent.py
View
@@ -39,10 +39,35 @@ setup.py: setup.py.in
sed 's/@NETSNMPAGENT_VERSION@/$(VERSION)/' setup.py.in >setup.py
chmod u+x setup.py
+.PHONY: ChangeLog
+ChangeLog:
+ @[ -e ChangeLog ] && rm ChangeLog || true
+ @CURRENT=`git describe`; \
+ set -- `git tag -l | egrep ^[[:digit:]]+.[[:digit:]]+\(.[[:digit:]]+\)?$ | sort -r`; \
+ until [ -z "$$CURRENT" ] ; do \
+ if [ -n "$$1" ] ; then \
+ LINE="Changes from v$$1 to v$$CURRENT"; \
+ PREV="$$1.."; \
+ else \
+ LINE="Initial version $$CURRENT"; \
+ PREV=""; \
+ fi; \
+ echo >>ChangeLog; \
+ echo $$LINE >>ChangeLog; \
+ printf "%*s\n" $${#LINE} | tr ' ' '=' >>ChangeLog; \
+ echo >>ChangeLog; \
+ git log \
+ --no-merges \
+ --format="* %ad - %aN <%ae>%n%n%+w(75,2,2)%s%n%+b%n(Git commit %H)%n" \
+ $$PREV$$CURRENT >>ChangeLog; \
+ CURRENT=$$1; \
+ shift || true; \
+ done
+
install: setup.py
python setup.py install
-srcdist: setup.py
+srcdist: setup.py ChangeLog
python setup.py sdist
upload: setup.py
@@ -64,6 +89,7 @@ rpms: srcdist
clean:
@[ -e setup.py ] && (python setup.py clean; rm setup.py) || true
+ @[ -e ChangeLog ] && rm ChangeLog || true
@[ -e "*.pyc" ] && rm *.pyc || true
@[ -e build ] && rm -rf build || true
@[ -e dist ] && rm -rf dist || true

0 comments on commit c54fc95

Please sign in to comment.