Whamcloud - gitweb
generate debian/patches
authorBrian J. Murrell <brian.murrell@oracle.com>
Wed, 2 Jun 2010 21:56:58 +0000 (17:56 -0400)
committerJohann Lombardi <johann@sun.com>
Fri, 4 Jun 2010 10:02:38 +0000 (12:02 +0200)
If we are running from a git checkout and there are patches on the
branch, (not counting the always-present debian/changelog update
patch, which is always assumed to be at the top of the patch stack)
put them into debian/patches/ as dpatches and remove them from the
source so that what's put into the source tarball is pristine.

build/autoMakefile.am.toplevel

index fd961a9..877fd1d 100644 (file)
@@ -152,6 +152,23 @@ debs:
        cversion=$$(sed -ne '1s/^lustre (\(.*\)-[0-9][0-9]*).*$$/\1/p' debian/changelog); \
        if [ "$$lversion" != "$$cversion" ]; then \
                echo -e "1i\nlustre ($$lversion-1) unstable; urgency=low\n\n  * Automated changelog entry update\n\n -- Brian J. Murrell <brian@interlinx.bc.ca>  $$(date -R)\n\n.\nwq" | ed debian/changelog; \
+       fi; \
+       if [ -d .git ]; then \
+               pdir="debian/patches"; \
+               git format-patch -o $$pdir $$lversion..HEAD^; \
+               pushd $$pdir; \
+               rm -f 00list *.dpatch; \
+               for file in [0-9][0-9][0-9][0-9]-*.patch; do \
+                       desc=$$(cat $$file | sed -e '1,/^$$/d' -e '/^---$$/,$$d'); \
+                       dpatch_file=$${file/.patch/.dpatch}; \
+                       sed -e '1,/^---$$/d' $$file | \
+                         dpatch patch-template -p "$$file" "$$desc" > \
+                         $$dpatch_file; \
+                       echo "faked by make debs run from git" > \
+                         ../patched/$$dpatch_file; \
+                       echo $$dpatch_file >> 00list; \
+                       rm -f $$file; \
+               done; \
        fi
        dpkg-buildpackage || { \
                rc=$${PIPESTATUS[0]}; \