aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorFrederic Crozat <fcrozat@mandriva.com>2010-03-18 16:27:26 +0000
committerFrederic Crozat <fcrozat@mandriva.com>2010-03-18 16:27:26 +0000
commit9419889adb5689b5f51f1454e0bb628a67a9d2a6 (patch)
tree347ac4622ea8ac777cbbf1f1e78262fb431830bd /Makefile
parent037d5a646b4188df319789f237a9c96a901d4bf0 (diff)
downloadcommon-data-9419889adb5689b5f51f1454e0bb628a67a9d2a6.tar
common-data-9419889adb5689b5f51f1454e0bb628a67a9d2a6.tar.gz
common-data-9419889adb5689b5f51f1454e0bb628a67a9d2a6.tar.bz2
common-data-9419889adb5689b5f51f1454e0bb628a67a9d2a6.tar.xz
common-data-9419889adb5689b5f51f1454e0bb628a67a9d2a6.zip
add support for git / git svn
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile76
1 files changed, 50 insertions, 26 deletions
diff --git a/Makefile b/Makefile
index 7e19970..3355f0f 100644
--- a/Makefile
+++ b/Makefile
@@ -22,6 +22,18 @@ kde-applications.menu: menu/validated-menu
@echo " OK"
checktag:
+ @if [ -e ".git" ]; then \
+ if ! git diff --quiet ; then \
+ echo not all changes are committed, aborting ; \
+ exit 1 ; \
+ fi ; \
+ if [ -e ".git/svn" ]; then \
+ if ! git diff --quiet HEAD..trunk ; then \
+ echo not all changes were pushed to SVN repository ; \
+ exit 1 ; \
+ fi ; \
+ fi ; \
+ fi
@if [ "x$(VERSION)" == "x" -o "x$(RELEASE)" = "x" ]; then \
echo usage is "make VERSION=version_number RELEASE=release_number dist" ; \
exit 1 ; \
@@ -31,38 +43,50 @@ clean:
find . -type d -name '.xvpics' -o -name '*~' |xargs rm -rf
rm -f applications.menu kde-applications.menu
-# rules to build a test rpm
-
-localdist: menus cleandist dir localcopy tar
-
-cleandist: checktag
- rm -rf $(PACKAGE)-$(VERSION) $(PACKAGE)-$(VERSION).tar.bz2
- rm -f applications.menu kde-applications.menu
-
-dir: checktag
- mkdir $(PACKAGE)-$(VERSION)
+# rules to build a distributable rpm
-localcopy: checktag
- find . -not -name "$(PACKAGE)-$(VERSION)"|cpio -pd $(PACKAGE)-$(VERSION)/
- find $(PACKAGE)-$(VERSION) -type d -name CVS -o -type d -name '.svn' -o -name .cvsignore -o -name '*~' |xargs rm -rf
+dist: menus checktag clean changelog tag
+ rm -rf ../$(NAME)-$(VERSION)*.tar* $(NAME)-$(VERSION)
+ @if [ -e ".svn" ]; then \
+ $(MAKE) dist-svn; \
+ elif [ -e ".git" ]; then \
+ $(MAKE) dist-git; \
+ else \
+ echo "Unknown SCM (not SVN nor GIT)";\
+ exit 1; \
+ fi;
+ $(info $(NAME)-$(VERSION).tar.bz2 is ready)
-tar: checktag
- tar cjvf $(PACKAGE)-$(VERSION).tar.bz2 $(PACKAGE)-$(VERSION)
- rm -rf $(PACKAGE)-$(VERSION)
+dist-git:
+ @git archive --prefix=$(NAME)-$(VERSION)/ HEAD | bzip2 -9 -c >../$(NAME)-$(VERSION).tar.bz2;
-# rules to build a distributable rpm
+dist-svn:
+ svn export -q -rBASE . $(NAME)-$(VERSION)
+ tar cfj ../$(NAME)-$(VERSION).tar.bz2 $(NAME)-$(VERSION)
+ rm -rf $(NAME)-$(VERSION)
-dist: menus checktag cleandist changelog svntag export tar
+tag: checktag
+ @if [ -e ".svn" ]; then \
+ svn copy $(SVNROOT)/trunk $(SVNROOT)/tags/$(TAG) -m "$(TAG)"; \
+ elif [ -e ".git" -a -e ".git/svn" ]; then \
+ git svn tag $(TAG); \
+ fi;
+.PHONY: ChangeLog log changelog
-export: checktag
- svn export $(SVNROOT)/tags/$(TAG) $(PACKAGE)-$(VERSION)
+log: ChangeLog
-svntag: checktag
- svn copy $(SVNROOT)/trunk $(SVNROOT)/tags/$(TAG) -m "$(TAG)"
+changelog: ChangeLog
-changelog: ../common/username
#svn2cl is available in our contrib.
- svn2cl --authors ../common/username.xml --accum
- rm -f ChangeLog.bak
- svn commit -m "Generated by svn2cl the `date '+%c'`" ChangeLog
+ChangeLog: ../common/username.xml
+ @if test -d "$$PWD/.git"; then \
+ ../common/gitlog-to-changelog | sed -e '/\tgit-svn-id:.*/d' > $@.tmp \
+ && mv -f $@.tmp $@ \
+ || (rm -f $@.tmp; \
+ echo Failed to generate ChangeLog, your ChangeLog may be outdated >&2; \
+ (test -f $@ || echo git-log is required to generate this file >> $@)); \
+ else \
+ svn2cl --accum --authors ../../soft/common/username.xml; \
+ rm -f *.bak; \
+ fi;