Move git/debian integration into gitdeb submodule
Stefan Bund [Mon, 16 Aug 2010 07:55:24 +0000 (09:55 +0200)]
.gitignore
.gitmodules [new file with mode: 0644]
Makefile
gitdeb [new submodule]

index a59d165..93d3fd1 100644 (file)
@@ -1,2 +1,4 @@
 /*-stamp
 /mapsectorsh
+*~
+.#*
diff --git a/.gitmodules b/.gitmodules
new file mode 100644 (file)
index 0000000..918cec5
--- /dev/null
@@ -0,0 +1,3 @@
+[submodule "gitdeb"]
+       path = gitdeb
+       url = gitosis@git.j32.de:gitdeb.git
index 7a8fec5..4f4c895 100644 (file)
--- a/Makefile
+++ b/Makefile
-default: mapsectorsh
-
-###########################################################################
-# Standard debian rules
-
-clean::
-       fakeroot debian/rules clean
-.PHONY: clean
-
-prepare::
-.PHONY: prepare
-
-deb: prepare
-       dpkg-buildpackage -us -uc -rfakeroot -I.git -I.gitignore -I.gitmodules
-.PHONY: deb
-
-###########################################################################
-# Generate debian/changelog from git log
-
-NAME       := $(shell awk '/^Source:/{print $$2}' debian/control)
-CLOGDIR    := .git/changelogs
-CHANGELOGS := $(shell lasttag=HEAD;                                            \
-                      (git tag -l 'v*'; echo)                                  \
-                          | while read tag; do                                 \
-                             echo $(CLOGDIR)/$${tag}$${tag:+-}$$lasttag;       \
-                              lasttag=$$tag;                                   \
-                          done)
+# -*- makefile -*-
 
-# Author/Date formating could as simple as  git log --format=' -- %an <%ae>  %cD'
-# however, we want the tagger not the author and  git log  doesn't show tags, only commits ...
-$(CHANGELOGS): %:
-       @echo "generating $@"
-       @mkdir -p "$(CLOGDIR)"
-       @(                                                                                       \
-            version="$@"; version="$${version#$(CLOGDIR)/}";                                    \
-           from="$${version%-*}"; version="$${version#*-}"; to="$$version";                     \
-           if [ "$$from" = "$$to" ]; then from=""; fi;                                  \
-           release="unstable";                                                                  \
-           if [ "$$version" = "HEAD" ]; then                                                    \
-               version="`git describe --tag --match='v*' | sed -e 's/-/~/' -e 's/-/./g'`";      \
-               release="UNRELEASED";                                                            \
-           fi;                                                                                  \
-           version="$${version#v}";                                                             \
-           echo "$(NAME) ($$version) $$release; urgency=low";                                   \
-           echo;                                                                                \
-           git log --format='  * [%h] %s' $$from$${from:+..}$$to;                               \
-           date="`echo $$to | git cat-file --batch                                              \
-                      | sed -n                                                                  \
-                             -e 's/^\(tagger\|committer\) \(.*\)00$$/\2/'                       \
-                             -eT -e 'y/+-/-+/' -ep`";                                           \
-           author="$${date% * *}"; date="$${date#$$author }"; zone="$${date#* }";               \
-            date="`TZ="UTC$$zone" date -d "1/1/1970 0:0 UTC + $${date% *} seconds" --rfc-2822`"; \
-           echo; echo " -- $$author  $$date"; echo;                                             \
-       ) >$@ || (rm -f $@; false)
-.PHONY: $(word 1,$(CHANGELOGS)) # The first changelog entry must be recreated on each call
+default: mapsectorsh
 
-debian/changelog: $(CHANGELOGS)
-       cat $^ > $@ || (rm -f $@; false)
+####################
+# debian package generation
 
-clean::
-       rm -f debian/changelog
-       rm -rf $(CLOGDIR)
+include gitdeb/Makefile.gitdeb
 
-prepare:: debian/changelog
+prepare:: lib/00_version.sh
 
-###########################################################################
-###########################################################################
+####################
+# Place version into lib/00_version.sh
+# Marked as phony so it is regenerated on each call to make
 
-prepare:: lib/00_version.sh
 lib/00_version.sh:
-       echo "version='`git describe --tag`'" >lib/00_version.sh
-.PHONY: lib/00_version.sh
+        echo "version='`git describe --tag`'" >lib/00_version.sh
 clean::
-       rm -f lib/00_version.sh
-
+        rm -f lib/00_version.sh
+.PHONY: lib/00_version.sh
 
+####################
+# Build combined 'mapsectorsh' script
 # The $(wildcard ...) return value is sorted and duplicates are
 # removed from the list of dependencies. I need to mention
 # lib/00_version.sh explicitly since it might not yet exist
+
 mapsectorsh: mapsector lib/00_version.sh $(wildcard lib/[0-9][0-9]_*.sh)
-       @echo "generating $@"
-       @(                                                      \
-           sed -n -e '1p' $<;                                  \
-           echo "#";                                           \
-           echo "# $@ automatically generated from";           \
-           for script in $^; do                                \
-               echo "#         $$script";                      \
-           done;                                               \
-           sed -n -e '2,/^load$$/p' $<;                        \
-           for script in $^; do                                \
-               if [ "$$script" = "$<" ]; then continue; fi;    \
-               echo "#### $$script";                           \
-               echo;                                           \
-               cat $$script;                                   \
-               echo;                                           \
-           done;                                               \
-           sed -n -e '/^load$$/,$$p' $<;                       \
-       ) >$@ || (rm -f $@; false)
-       @sed -i -e 's/^load$$/####/' -eT -eh -eG -eH -eG -eH -eG -e'y/\n/#/' $@
-       chmod ugo+rx $@
+        @echo "generating $@"
+        @(                                                     \
+            sed -n -e '1p' $<;                                 \
+            echo "#";                                          \
+            echo "# $@ automatically generated from";          \
+            for script in $^; do                               \
+                echo "#         $$script";                     \
+            done;                                              \
+            sed -n -e '2,/^load$$/p' $<;                       \
+            for script in $^; do                               \
+                if [ "$$script" = "$<" ]; then continue; fi;   \
+                echo "#### $$script";                          \
+                echo;                                          \
+                cat $$script;                                  \
+                echo;                                          \
+            done;                                              \
+            sed -n -e '/^load$$/,$$p' $<;                      \
+        ) >$@ || (rm -f $@; false)
+        @sed -i -e 's/^load$$/####/' -eT -eh -eG -eH -eG -eH -eG -e'y/\n/#/' $@
+        chmod ugo+rx $@
 clean::
-       rm -f mapsectorsh
+        rm -f mapsectorsh
diff --git a/gitdeb b/gitdeb
new file mode 160000 (submodule)
index 0000000..dbd5fd6
--- /dev/null
+++ b/gitdeb
@@ -0,0 +1 @@
+Subproject commit dbd5fd61f0881f7ecb030753af71598fd14210d1