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

pfelecan at users.sourceforge.net pfelecan at users.sourceforge.net
Sat Jun 1 11:05:51 CEST 2013


Revision: 21236
          http://gar.svn.sourceforge.net/gar/?rev=21236&view=rev
Author:   pfelecan
Date:     2013-06-01 09:05:51 +0000 (Sat, 01 Jun 2013)
Log Message:
-----------
.buildsys/v2: add support for GitHub hosted repositories; for the
documentation, see: https://sourceforge.net/apps/trac/gar/wiki/GAR%20Variable%20Reference#DownloadSettings

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

Modified: csw/mgar/gar/v2/gar.conf.mk
===================================================================
--- csw/mgar/gar/v2/gar.conf.mk	2013-06-01 08:47:58 UTC (rev 21235)
+++ csw/mgar/gar/v2/gar.conf.mk	2013-06-01 09:05:51 UTC (rev 21236)
@@ -760,6 +760,21 @@
 SF_PROJECT_SHOWFILE ?= http://sourceforge.net/project/showfiles.php?group_id
 UPSTREAM_USE_SF	?= 0
 
+# Git Hub (only if GIHUB_USER variable is defined)
+# see http://developer.github.com/v3/repos/contents/#get-archive-link
+# and https://help.github.com/articles/downloading-files-from-the-command-line
+GITHUB_HOST		=	api.github.com
+ifdef GITHUB_USER
+GITHUB_PROJECT	?=	$(NAME)
+GITHUB_BALL		?=	tar
+GITHUB_BRANCH	?=	master
+GITHUB_MIRROR	?=	https://$(GITHUB_HOST)/repos/$(GITHUB_USER)/$(GITHUB_PROJECT)/$(GITHUB_BALL)ball/$(GITHUB_BRANCH)
+GITHUB_BALL_EXT	:=	.$(GITHUB_BALL)
+ifeq ($(GITHUB_BALL),tar)
+GITHUB_BALL_EXT	:=	$(GITHUB_BALL_EXT).gz
+endif
+endif
+
 # Google Code
 GOOGLE_PROJECT ?= $(NAME)
 GOOGLE_MIRROR  ?= http://$(GOOGLE_PROJECT).googlecode.com/files/

Modified: csw/mgar/gar/v2/gar.lib.mk
===================================================================
--- csw/mgar/gar/v2/gar.lib.mk	2013-06-01 08:47:58 UTC (rev 21235)
+++ csw/mgar/gar/v2/gar.lib.mk	2013-06-01 09:05:51 UTC (rev 21236)
@@ -31,9 +31,9 @@
 # add these 'dynamic script' targets to our fetch list
 DYNURLS := $(foreach DYN,$(DYNSCRIPTS),dynscr://$(DYN))
 
-$(foreach M,$(MASTER_SITES),$(if $(filter %/,$M),,$(error MASTER_SITES must contain only URLs ending in a / wheres this did not: $M)))
+$(foreach M,$(MASTER_SITES),$(if $(findstring $(GITHUB_HOST),$(M)),,$(if $(filter %/,$M),,$(error MASTER_SITES must contain only URLs ending in a / wheres this did not: $M))))
 
-URLS := $(foreach SITE,$(FILE_SITES) $(MASTER_SITES),$(addprefix $(SITE),$(DISTFILES))) $(foreach SITE,$(FILE_SITES) $(PATCH_SITES) $(MASTER_SITES),$(addprefix $(SITE),$(ALLFILES_PATCHFILES))) $(DYNURLS)
+URLS := $(foreach SITE,$(FILE_SITES) $(MASTER_SITES),$(if $(findstring $(GITHUB_HOST),$(SITE)),$(SITE),$(addprefix $(SITE),$(DISTFILES)))) $(foreach SITE,$(FILE_SITES) $(PATCH_SITES) $(MASTER_SITES),$(if $(findstring $(GITHUB_HOST),$(SITE)),$(SITE),$(addprefix $(SITE),$(ALLFILES_PATCHFILES)))) $(DYNURLS)
 
 define gitsubst
 $(subst git-git,git,$(if $(findstring $(1)://,$(2)),$(patsubst $(1)%,git-$(1)%,$(call URLSTRIP,$(2)))))
@@ -50,14 +50,18 @@
 # 1) we have to strip the colon from the URLs
 # 2) the download is very costly with bigger Makefiles as they will be
 #    re-evaluated for every URL (nested gmake invocation, room for improvement)
-$(DOWNLOADDIR)/%: _FLIST=$(filter %/$*,$(URLS))
+$(DOWNLOADDIR)/%: _FLIST=$(filter %/$*,$(URLS)) $(foreach URL,$(URLS),$(if $(findstring $(GITHUB_HOST),$(URL)),$(URL),))
 $(DOWNLOADDIR)/%:  
 	$(if $(_FLIST),,$(error INTERNAL ERROR: The file $* is requested but not in the list of generated URLs))
 	@if test -f $(COOKIEDIR)/checksum-$*; then : ; else \
 		echo " ==> Grabbing $@"; \
-		( for i in $(filter %/$*,$(URLS)); do  \
+		( for i in $(filter %/$*,$(URLS)) $(foreach URL,$(URLS),$(if $(findstring $(GITHUB_HOST),$(URL)),$(URL),)); do  \
 			echo " 	==> Trying $$i"; \
 			$(MAKE) -s `echo $$i | tr -d :` || continue; \
+			case $$i in \
+				*$(GITHUB_HOST)*) \
+				mv $(PARTIALDIR)/$(GITHUB_BRANCH) $(PARTIALDIR)/$(DISTNAME)$(GITHUB_BALL_EXT) ;; \
+			esac; \
 			mv $(PARTIALDIR)/$* $@; \
 			break; \
 		done; ) 2>&1 | grep -v '^$(MAKE)'; \

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