From 5c408ede6ce4fe37f9b659f2c3420912e1e2bd9b Mon Sep 17 00:00:00 2001
From: John Crispin <john@openwrt.org>
Date: Sat, 9 Apr 2016 10:25:34 +0000
Subject: [PATCH] download: add @GITHUB download facility
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Define a new alias (@GITHUB) for downloading raw github repository files

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>

SVN-Revision: 49138
---
 include/download.mk | 2 +-
 scripts/download.pl | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/include/download.mk b/include/download.mk
index 63af908114..a359514002 100644
--- a/include/download.mk
+++ b/include/download.mk
@@ -13,7 +13,7 @@ DOWNLOAD_RDEP=$(STAMP_PREPARED) $(HOST_STAMP_PREPARED)
 define dl_method
 $(strip \
   $(if $(2),$(2), \
-    $(if $(filter @APACHE/% @GNOME/% @GNU/% @KERNEL/% @SF/% @SAVANNAH/% ftp://% http://% https://% file://%,$(1)),default, \
+    $(if $(filter @APACHE/% @GITHUB/% @GNOME/% @GNU/% @KERNEL/% @SF/% @SAVANNAH/% ftp://% http://% https://% file://%,$(1)),default, \
       $(if $(filter git://%,$(1)),git, \
         $(if $(filter svn://%,$(1)),svn, \
           $(if $(filter cvs://%,$(1)),cvs, \
diff --git a/scripts/download.pl b/scripts/download.pl
index 20f38f17e6..a1bd0133ca 100755
--- a/scripts/download.pl
+++ b/scripts/download.pl
@@ -182,6 +182,11 @@ foreach my $mirror (@ARGV) {
 		push @mirrors, "http://mirrors.ocf.berkeley.edu/apache/$1";
 		push @mirrors, "http://mirror.cc.columbia.edu/pub/software/apache/$1";
 		push @mirrors, "http://ftp.jaist.ac.jp/pub/apache/$1";
+	} elsif ($mirror =~ /^\@GITHUB\/(.+)$/) {
+		# give github a few more tries (different mirrors)
+		for (1 .. 5) {
+			push @mirrors, "https://raw.githubusercontent.com/$1";
+		}
 	} elsif ($mirror =~ /^\@GNU\/(.+)$/) {
 		push @mirrors, "http://ftpmirror.gnu.org/$1";
 		push @mirrors, "http://ftp.gnu.org/pub/gnu/$1";
-- 
GitLab