[csw-devel] SF.net SVN: gar:[12267] csw/mgar/gar/v2-uwatch2/gar.lib.mk

wbonnet at users.sourceforge.net wbonnet at users.sourceforge.net
Sun Jan 9 00:00:23 CET 2011


Revision: 12267
          http://gar.svn.sourceforge.net/gar/?rev=12267&view=rev
Author:   wbonnet
Date:     2011-01-08 23:00:23 +0000 (Sat, 08 Jan 2011)

Log Message:
-----------
Add target 
	gmake upgrade-to-latest-upstream

This target create a new branch based upon trunk code and modify VERSION variable in the Makefile. The new VERSION value is retrieved from the upstream site.

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

Modified: csw/mgar/gar/v2-uwatch2/gar.lib.mk
===================================================================
--- csw/mgar/gar/v2-uwatch2/gar.lib.mk	2011-01-08 21:54:32 UTC (rev 12266)
+++ csw/mgar/gar/v2-uwatch2/gar.lib.mk	2011-01-08 23:00:23 UTC (rev 12267)
@@ -189,7 +189,7 @@
 REGEXP_ARGS = $(addsuffix ',$(addprefix --regexp=',$(UFILES_REGEX)))
 VERSION_ARGS = $(addsuffix ',$(addprefix --current-version=',$(VERSION)))
 define versionlist
-	$(if $(UFILES_REGEX),$(shell htp_proxy=$(http_proxy) ftp_proxy=$(ftp_proxy) $(GARBIN)/upstream_watch get-upstream-version-list $(UW_ARGS) $(REGEXP_ARGS)))
+	$(if $(UFILES_REGEX),$(shell http_proxy=$(http_proxy) ftp_proxy=$(ftp_proxy) $(GARBIN)/upstream_watch get-upstream-version-list $(UW_ARGS) $(REGEXP_ARGS)))
 endef
 
 ########################################################
@@ -218,17 +218,6 @@
 	fi ; 
 
 ########################################################
-# Retrieve the current version
-#
-get-current-version:
-	@if [ ! -n '$(VERSION)' ]; then \
-		echo "$(NAME) - VERSION is not defined" ; \
-		false; \
-	else \
-		echo "$(NAME) - Current version is $(VERSION)" ; \
-	fi ;
-
-########################################################
 # Retrieve the list of upstream versions
 #
 get-upstream-version-list:VERSIONLIST = $(call versionlist)
@@ -276,7 +265,7 @@
 			echo "$(NAME) - Error VERSION is not set" ; \
 			false; \
 		fi; \
-		LATESTVERSION=$(shell http_proxy=$(http_proxy) ftp_proxy=$(ftp_proxy) $(GARBIN)/upstream_watch get-upstream-latest-version $(UW_ARGS) $(REGEXP_ARGS)); \
+		LATESTVERSION:=$(shell http_proxy=$(http_proxy) ftp_proxy=$(ftp_proxy) $(GARBIN)/upstream_watch get-upstream-latest-version $(UW_ARGS) $(REGEXP_ARGS)); \
 		if [ -n "$$LATESTVERSION" ] ; then \
 			echo $$LATESTVERSION ; \
 		else \
@@ -287,6 +276,7 @@
 ########################################################
 # Compare local and upstream versions
 #
+CHECKUPSTREAMVERSION=$(shell http_proxy=$(http_proxy) ftp_proxy=$(ftp_proxy) $(GARBIN)/upstream_watch check-upstream $(UW_ARGS) $(REGEXP_ARGS) $(VERSION_ARGS) )
 check-upstream:
 	@if [ '$(ENABLE_UPSTREAM_WATCH)' -ne '1' ] ; then \
 		echo "$(NAME) - Upstream Watch is disabled" ; \
@@ -303,21 +293,67 @@
 			echo "$(NAME) - Error VERSION is not set" ; \
 			false; \
 		fi; \
-		LATESTVERSION=$(shell http_proxy=$(http_proxy) ftp_proxy=$(ftp_proxy) $(GARBIN)/upstream_watch check-upstream $(UW_ARGS) $(REGEXP_ARGS) $(VERSION_ARGS)); \
-		if [ -n "$$LATESTVERSION" ] ; then \
-			if test ! -f $(COOKIEDIR)/checknew-$$LATESTVERSION ; then \
-				echo "$(NAME) : a new version of upstream files is available : $$LATESTVERSION"; \
-				$(MAKE) checknew-$$LATESTVERSION > /dev/null ; \
+		LATEST=$(CHECKUPSTREAMVERSION) ; \
+		if [ -n "$$LATEST" ] ; then \
+			echo "$(NAME) : a new version of upstream files is available : $$LATEST"; \
+		else \
+			echo "$(NAME) : Package is up-to-date. Current version is $(VERSION)" ; \
+		fi ; \
+	fi
+
+
+########################################################
+# Create upgrade branch from current to latest upstream
+#
+upgrade-to-latest-upstream:
+	if [ '$(ENABLE_UPSTREAM_WATCH)' -ne '1' ] ; then \
+		echo "$(NAME) - Upstream Watch is disabled" ; \
+	else \
+		if [ ! -n '$(UFILES_REGEX)' ]; then \
+			echo "$(NAME) - Error UFILES_REGEX is not set" ; \
+			false; \
+		fi; \
+		if [ ! -n '$(UPSTREAM_MASTER_SITES)' ]; then \
+			echo "$(NAME) - Error UPSTREAM_MASTER_SITES is not set" ; \
+			false; \
+		fi; \
+		if [ ! -n '$(VERSION)' ]; then \
+			echo "$(NAME) - Error VERSION is not set" ; \
+			false; \
+		fi; \
+		LATEST=$(CHECKUPSTREAMVERSION) ; \
+		if [ ! -f "$(COOKIEDIR)/upgrade-to-latest-upstream-$$LATEST" ] ; then \
+			if [ ! -d "../branches/upgrade_from_$(VERSION)_to_$$LATEST" ] ; then \
+				echo "Not a dir : ../branches/upgrade_from_$(VERSION)_to_$$LATEST" ; \
+				if [ -n "$$LATEST" ] ; then \
+					echo "$(NAME) : a new version of upstream files is available. Creating upgrade branch from version $(VERSION) to $$LATEST"; \
+					VERSIONUPGRADE="$(shell http_proxy=$(http_proxy) ftp_proxy=$(ftp_proxy) $(GARBIN)/upstream_watch upgrade-to-version --current-version=$(VERSION) --target-version=$(CHECKUPSTREAMVERSION))" ; \
+					if [ -n "$$VERSIONUPGRADE" ] ; then \
+						echo $$VERSIONUPGRADE ; \
+					fi ; \
+				else \
+					echo "$(NAME) : Package is up-to-date. Upstream site has no version newer than $(VERSION)" ; \
+				fi ; \
+			else \
+				echo "Upgrade branch from version $(VERSION) to version $$LATEST already exist" ; \
 			fi ; \
+			$(MAKE) upgrade-to-latest-upstream-$$LATEST >/dev/null; \
 		else \
-			if test ! -f $(COOKIEDIR)/checknew-$(VERSION) ; then \
-				echo "$(NAME) : Package is up-to-date. Current version is $(VERSION)" ; \
-				$(MAKE) checknew-$(VERSION) > /dev/null ; \
-			fi ; \
+			echo "Upgrade branch to version $$LATEST already created by upstream_watch" ; \
 		fi ; \
 	fi
 
-checknew-%:
+########################################################
+#
+get-current-version:
+	@if [ ! -n '$(VERSION)' ]; then \
+		echo "$(NAME) - VERSION is not defined" ; \
+		false; \
+	else \
+		echo "$(NAME) - Current version is $(VERSION)" ; \
+	fi ;
+
+upgrade-to-latest-upstream-%:
 	@$(MAKECOOKIE)
 
 


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