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

bdwalton at users.sourceforge.net bdwalton at users.sourceforge.net
Thu May 27 04:09:28 CEST 2010


Revision: 10012
          http://gar.svn.sourceforge.net/gar/?rev=10012&view=rev
Author:   bdwalton
Date:     2010-05-27 02:09:28 +0000 (Thu, 27 May 2010)

Log Message:
-----------
gar/v2: integrate v2-bwalton to add git based makepatch support

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

Property Changed:
----------------
    csw/mgar/gar/v2/
    csw/mgar/gar/v2/pkglib/csw/depend


Property changes on: csw/mgar/gar/v2
___________________________________________________________________
Modified: svn:mergeinfo
   - /csw/mgar/gar/v2:4936-6678
/csw/mgar/gar/v2-checkpkg:7722-7855
/csw/mgar/gar/v2-checkpkg-stats:8454-8649
/csw/mgar/gar/v2-collapsed-modulations:6895
/csw/mgar/gar/v2-dirpackage:8125-8180
/csw/mgar/gar/v2-migrateconf:7082-7211
/csw/mgar/gar/v2-skayser:6087-6132
   + /csw/mgar/gar/v2:4936-6678
/csw/mgar/gar/v2-bwalton:9784-10011
/csw/mgar/gar/v2-checkpkg:7722-7855
/csw/mgar/gar/v2-checkpkg-stats:8454-8649
/csw/mgar/gar/v2-collapsed-modulations:6895
/csw/mgar/gar/v2-dirpackage:8125-8180
/csw/mgar/gar/v2-migrateconf:7082-7211
/csw/mgar/gar/v2-skayser:6087-6132

Modified: csw/mgar/gar/v2/gar.conf.mk
===================================================================
--- csw/mgar/gar/v2/gar.conf.mk	2010-05-26 21:26:24 UTC (rev 10011)
+++ csw/mgar/gar/v2/gar.conf.mk	2010-05-27 02:09:28 UTC (rev 10012)
@@ -50,6 +50,10 @@
 GIT_PROXY_SCRIPT ?= $(abspath $(GARBIN))/gitproxy
 GIT_DEFAULT_TRACK = +refs/heads/master:refs/remotes/origin/master
 
+# if a user always wants --signoff, for example.  used in makepatch
+# by default, the -v will show the diff being committed...
+GIT_COMMIT_OPTS ?= -v
+
 # For parallel builds
 PARALLELMODULATIONS ?= 
 MULTITAIL ?= /opt/csw/bin/multitail
@@ -184,10 +188,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/gar.lib.mk
===================================================================
--- csw/mgar/gar/v2/gar.lib.mk	2010-05-26 21:26:24 UTC (rev 10011)
+++ csw/mgar/gar/v2/gar.lib.mk	2010-05-27 02:09:28 UTC (rev 10012)
@@ -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 \
@@ -471,24 +471,19 @@
 	@gzip -dc $(DOWNLOADDIR)/$* | $(GARPATCH)
 	@$(MAKECOOKIE)
 
-# apply normal patches
+# apply normal patches (git format-patch output or old-style diff -r)
 normal-patch-%:
 	@echo " ==> Applying patch $(DOWNLOADDIR)/$*"
-	$(GARPATCH) < $(DOWNLOADDIR)/$*
+	@( if ggrep -q 'Subject:' $(abspath $(DOWNLOADDIR)/$*); then \
+		cd $(WORKSRC); git am $(abspath $(DOWNLOADDIR)/$*); \
+	   else \
+		echo Adding old-style patch...; \
+		$(GARPATCH) < $(DOWNLOADDIR)/$*; \
+		cd $(WORKSRC); git add -A; \
+		git commit -am "old style patch: $*"; \
+	   fi )
 	@$(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/gar.mk
===================================================================
--- csw/mgar/gar/v2/gar.mk	2010-05-26 21:26:24 UTC (rev 10011)
+++ csw/mgar/gar/v2/gar.mk	2010-05-27 02:09:28 UTC (rev 10012)
@@ -1,4 +1,3 @@
-
 #
 # $Id$
 #
@@ -145,6 +144,7 @@
 define _modulate_do
 $(call _modulate_target,extract,$(2),$(4))
 $(call _modulate_target,patch,$(2),$(4))
+$(call _modulate_target_nocookie,makepatch,$(2),$(4))
 $(call _modulate_target,configure,$(2),$(4))
 $(call _modulate_target_nocookie,reset-configure,$(2),$(4))
 $(call _modulate_target,build,$(2),$(4))
@@ -380,7 +380,7 @@
 
 # We call an additional extract-modulated without resetting any variables so
 # a complete unpacked set goes to the global dir for packaging (like gspec)
-extract: checksum $(COOKIEDIR) pre-extract extract-modulated $(addprefix extract-,$(MODULATIONS)) post-extract
+extract: checksum $(COOKIEDIR) pre-extract pre-extract-git-check extract-modulated $(addprefix extract-,$(MODULATIONS)) post-extract
 	@$(DONADA)
 
 extract-global: $(if $(filter global,$(MODULATION)),extract-modulated)
@@ -390,9 +390,48 @@
 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 global,$(MODULATION)),,post-extract-gitsnap) post-extract-$(MODULATION) post-extract-modulated
 	@$(DONADA)
 
+pre-extract-git-check:
+	@( if [ ! -f $(HOME)/.gitconfig ]; then \
+		name=`getent passwd $$USER | awk -F: '{print $$5}'`; \
+		echo "===================================================="; \
+		echo "You need to create a basic ~/.gitconfig."; \
+		echo "Try: "; \
+		echo "	git config --global user.email $$USER at opencsw.org"; \
+		echo "	git config --global user.name \"$$name\""; \
+		echo "===================================================="; \
+		exit 1; \
+	  else \
+		g_email=`git config --global user.email`; \
+		g_name=`git config --global user.name`; \
+		email=$$USER at opencsw.org; \
+		name=`getent passwd $$USER | awk -F: '{print $$5}'`; \
+		if [ -z "$$g_email" ]; then \
+		  echo "==================================================="; \
+		  echo "Your ~/.gitconfig doesn't define user.email.  Try:"; \
+		  echo "  git config --global user.email $$email"; \
+		  echo "==================================================="; \
+		  exit 1; \
+		elif [ -z "$$g_name" ]; then \
+		  echo "==================================================="; \
+		  echo "Your ~/.gitconfig doesn't define user.name.  Try:"; \
+		  echo "  git config --global user.name '$$name'"; \
+		  echo "==================================================="; \
+		  exit 1; \
+		fi; \
+	  fi )
+	@$(MAKECOOKIE)
+
+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 -am "Upstream $(GARVERSION)" upstream-$(GARVERSION); \
+		git checkout -b csw )
+	@$(MAKECOOKIE)
+
 # returns true if extract has completed successfully, false
 # otherwise
 extract-p:
@@ -411,7 +450,7 @@
 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 global,$(MODULATION)),,post-patch-gitsnap) post-patch-$(MODULATION) post-patch-modulated
 	@$(DONADA)
 
 # returns true if patch has completed successfully, false
@@ -419,12 +458,34 @@
 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)
+post-patch-gitsnap: $(PATCH_TARGETS)
+	@echo "Tagging top of current csw patch stack..."
+	@( cd $(WORKSRC); git tag -am "CSW $(GARVERSION)" csw-$(GARVERSION) )
+	@$(MAKECOOKIE)
 
+makepatch: $(addprefix patch-,$(MODULATIONS)) $(addprefix makepatch-,$(MODULATIONS))
+	@$(DONADA)
+
+# Allow generation of patches from modified work source.
+makepatch-modulated: $(FILEDIR)
+	@echo " ==> Makepatch: Looking for changes in modulation $(MODULATION)"
+	@( cd $(WORKSRC); \
+		git add -A; \
+		git diff --cached --quiet; \
+		if test $$? -eq 0; then \
+			echo "No changes."; \
+		else \
+			echo "Capturing changes..."; \
+			git commit $(GIT_COMMIT_OPTS) && \
+			( git format-patch csw-$(GARVERSION); \
+			echo Add the following to your recipe and then; \
+			echo rerun: gmake makesums; \
+			echo PATCHFILES +=  0001*; \
+			echo "(or maybe PATCHFILES_$(MODULATION) ??)"; \
+			mv 0001* $(abspath $(FILEDIR)); ) \
+		fi )
+
+
 # XXX: Allow patching of pristine sources separate from ISA directories
 # XXX: Use makepatch on global/
 


Property changes on: csw/mgar/gar/v2/pkglib/csw/depend
___________________________________________________________________
Modified: svn:mergeinfo
   - /csw/mgar/gar/v2/pkglib/csw/depend:4936-6678
/csw/mgar/gar/v2-checkpkg/pkglib/csw/depend:7722-7855
/csw/mgar/gar/v2-checkpkg-stats/pkglib/csw/depend:8454-8649
/csw/mgar/gar/v2-collapsed-modulations/pkglib/csw/depend:6895
/csw/mgar/gar/v2-dirpackage/pkglib/csw/depend:8125-8180
/csw/mgar/gar/v2-skayser/pkglib/csw/depend:6087-6132
   + /csw/mgar/gar/v2/pkglib/csw/depend:4936-6678
/csw/mgar/gar/v2-bwalton/pkglib/csw/depend:9784-10011
/csw/mgar/gar/v2-checkpkg/pkglib/csw/depend:7722-7855
/csw/mgar/gar/v2-checkpkg-stats/pkglib/csw/depend:8454-8649
/csw/mgar/gar/v2-collapsed-modulations/pkglib/csw/depend:6895
/csw/mgar/gar/v2-dirpackage/pkglib/csw/depend:8125-8180
/csw/mgar/gar/v2-skayser/pkglib/csw/depend:6087-6132


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