[csw-devel] SF.net SVN: gar:[9785] csw/mgar/gar/v2-bwalton

bdwalton at users.sourceforge.net bdwalton at users.sourceforge.net
Wed Apr 28 02:06:40 CEST 2010


Revision: 9785
          http://gar.svn.sourceforge.net/gar/?rev=9785&view=rev
Author:   bdwalton
Date:     2010-04-28 00:06:40 +0000 (Wed, 28 Apr 2010)

Log Message:
-----------
gar/v2-bwalton: convert makepatch to use git (and work again)

Modified Paths:
--------------
    csw/mgar/gar/v2-bwalton/gar.conf.mk
    csw/mgar/gar/v2-bwalton/gar.lib.mk
    csw/mgar/gar/v2-bwalton/gar.mk

Modified: csw/mgar/gar/v2-bwalton/gar.conf.mk
===================================================================
--- csw/mgar/gar/v2-bwalton/gar.conf.mk	2010-04-28 00:01:57 UTC (rev 9784)
+++ csw/mgar/gar/v2-bwalton/gar.conf.mk	2010-04-28 00:06:40 UTC (rev 9785)
@@ -184,10 +184,11 @@
 DEF_BASE_PKGS += CSWpython
 DEF_BASE_PKGS += CSWtextutils
 DEF_BASE_PKGS += CSWwget
+DEF_BASE_PKGS += CSWgit
 
 ifdef GIT_REPOS
 # netcat and bash are for the gitproxy script.
-DEF_BASE_PKGS += CSWgit CSWnetcat
+DEF_BASE_PKGS += CSWnetcat
 endif
 
 PREREQUISITE_BASE_PKGS ?= $(DEF_BASE_PKGS)

Modified: csw/mgar/gar/v2-bwalton/gar.lib.mk
===================================================================
--- csw/mgar/gar/v2-bwalton/gar.lib.mk	2010-04-28 00:01:57 UTC (rev 9784)
+++ csw/mgar/gar/v2-bwalton/gar.lib.mk	2010-04-28 00:06:40 UTC (rev 9785)
@@ -236,7 +236,7 @@
 				echo "upstream notification job"; } | $(GARBIN)/mail2maintainer -s '[svn] $(GARNAME) upstream update notification' $(GARNAME); \
 		fi; \
 	fi
-		
+
 check-upstream: FILES2CHECK = $(call files2check)
 check-upstream: 
 	@if [ -n '$(FILES2CHECK)' ]; then \
@@ -477,18 +477,6 @@
 	$(GARPATCH) < $(DOWNLOADDIR)/$*
 	@$(MAKECOOKIE)
 
-# This is used by makepatch
-%/gar-base.diff:
-	@echo " ==> Creating patch $@"
-	@EXTRACTDIR=$(SCRATCHDIR) COOKIEDIR=$(SCRATCHDIR)-$(COOKIEDIR) $(MAKE) extract
-	@PATCHDIR=$(SCRATCHDIR)/$(BASEWORKSRC) COOKIEDIR=$(SCRATCHDIR)-$(COOKIEDIR) $(MAKE) patch
-	@mv $(SCRATCHDIR)/$(BASEWORKSRC) $(WORKSRC_FIRSTMOD).orig
-	@( cd $(WORKDIR_FIRSTMOD); \
-		if gdiff --speed-large-files --minimal -Nru $(BASEWORKSRC).orig $(BASEWORKSRC) > gar-base.diff; then :; else \
-			cd $(CURDIR); \
-			mv -f $(WORKDIR_FIRSTMOD)/gar-base.diff $@; \
-		fi )
-
 ### PATCH FILE TYPE MAPPINGS ###
 # These rules specify which of the above patch action rules to use for a given
 # file extension.  Often support for a given patch format can be handled by

Modified: csw/mgar/gar/v2-bwalton/gar.mk
===================================================================
--- csw/mgar/gar/v2-bwalton/gar.mk	2010-04-28 00:01:57 UTC (rev 9784)
+++ csw/mgar/gar/v2-bwalton/gar.mk	2010-04-28 00:06:40 UTC (rev 9785)
@@ -1,4 +1,3 @@
-
 #
 # $Id$
 #
@@ -390,9 +389,16 @@
 extract-modulated: checksum-modulated $(EXTRACTDIR) $(COOKIEDIR) \
 		$(addprefix dep-$(GARDIR)/,$(EXTRACTDEPS)) \
 		announce-modulation \
-		pre-extract-modulated pre-extract-$(MODULATION) $(EXTRACT_TARGETS) post-extract-$(MODULATION) post-extract-modulated
+		pre-extract-modulated pre-extract-$(MODULATION) $(EXTRACT_TARGETS) $(if $(filter $(firstword $(MODULATIONS)),$(MODULATION)),post-extract-gitsnap) post-extract-$(MODULATION) post-extract-modulated
 	@$(DONADA)
 
+post-extract-gitsnap: $(EXTRACT_TARGETS)
+	@echo Snapshotting extracted source tree with git...
+	@( cd $(WORKSRC); git init; git add .; \
+		git commit -m "Upstream $(GARVERSION)"; \
+		git tag -a -m "Upstream $(GARVERSION)" upstream-$(GARVERSION) )
+	@$(MAKECOOKIE)
+
 # returns true if extract has completed successfully, false
 # otherwise
 extract-p:
@@ -411,19 +417,36 @@
 patch: pre-patch $(addprefix patch-,$(MODULATIONS)) post-patch
 	@$(DONADA)
 
-patch-modulated: extract-modulated $(WORKSRC) pre-patch-modulated pre-patch-$(MODULATION) $(PATCH_TARGETS) post-patch-$(MODULATION) post-patch-modulated
+patch-modulated: extract-modulated $(WORKSRC) pre-patch-modulated pre-patch-$(MODULATION) $(PATCH_TARGETS) $(if $(filter $(firstword $(MODULATIONS)),$(MODULATION)),post-patch-gitsnap) post-patch-$(MODULATION) post-patch-modulated
 	@$(DONADA)
 
+post-patch-gitsnap: $(PATCH_TARGETS)
+	@echo Snapshotting patched source tree with git...
+	@( cd $(WORKSRC); \
+	  git checkout -b csw-$(GARVERSION) upstream-$(GARVERSION); \
+	  git add -A; git commit -m "CSW patches for $(GARVERSION)" )
+	@$(MAKECOOKIE)
+
 # returns true if patch has completed successfully, false
 # otherwise
 patch-p:
 	@$(foreach COOKIEFILE,$(PATCH_TARGETS), test -e $(COOKIEDIR)/$(COOKIEFILE) ;)
 
-# makepatch		- Grab the upstream source and diff against $(WORKSRC).  Since
-# 				  diff returns 1 if there are differences, we remove the patch
-# 				  file on "success".  Goofy diff.
-makepatch: $(SCRATCHDIR) $(FILEDIR) $(FILEDIR)/gar-base.diff
-	$(DONADA)
+# Allow generation of patches from modified work source.
+makepatch: $(FILEDIR)
+	@echo Makepatch: Checking for changes in work tree...
+	@( cd $(WORKSRC_FIRSTMOD); \
+		git add -A; \
+		git diff --cached --quiet; \
+		if test $$? -eq 0; then echo "No changes."; exit 1; fi )
+	@echo Makepatch: Capturing changes...
+	@(cd $(WORKSRC_FIRSTMOD); \
+		git commit; \
+		git format-patch HEAD~1; \
+		echo Add the following to your recipe and then; \
+		echo rerun: gmake makesums; \
+		echo PATCHFILES +=  0001*; \
+		mv 0001* $(abspath $(FILEDIR)) )
 
 # XXX: Allow patching of pristine sources separate from ISA directories
 # XXX: Use makepatch on global/


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.


More information about the devel mailing list