OpenWrt/LEDE Project

  • Status Unconfirmed
  • Percent Complete
    0%
  • Task Type Bug Report
  • Category Base system
  • Assigned To No-one
  • Operating System All
  • Severity Low
  • Priority Very Low
  • Reported Version Trunk
  • Due in Version Undecided
  • Due Date Undecided
  • Private
Attached to Project: OpenWrt/LEDE Project
Opened by Michael Jones - 12.03.2020

FS#2898 - Add support for git reference repositories

If OpenWRT added support for git reference repositories when fetching feeds, builds can be conducted with less bandwidth usage.

https://git-scm.com/docs/git-clone#Documentation/git-clone.txt---reference-if-ableltrepositorygt

For example, I’ve modified the feeds script to allow this, but the modification is pretty rough.

From 44b08ccb6abbcffc8566312b8d92d729e9b09e15 Mon Sep 17 00:00:00 2001
From: Michael Jones <mike@meshplusplus.com>
Date: Tue, 10 Mar 2020 20:09:15 -0500
Subject: [PATCH] Make git clones happen via a reference repository to save
 bandwidth

---
 scripts/feeds | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/scripts/feeds b/scripts/feeds
index 304ef6cbaf..31a61b230c 100755
--- a/scripts/feeds
+++ b/scripts/feeds
@@ -133,18 +133,18 @@ my %update_method = (
 	        'update'	=> "",
 	        'revision'	=> "echo -n 'dummy'"},
 	'src-git' => {
-	        'init'          => "git clone --depth 1 '%s' '%s'",
-	        'init_branch'   => "git clone --depth 1 --branch '%s' '%s' '%s'",
-	        'init_commit'   => "git clone '%s' '%s' && cd '%s' && git checkout -b '%s' '%s' && cd -",
+	        'init'          => "(export URL='%s' ; export NAME='%s' ; GIT_DIR=../../../../../../.gitcache git remote add -f `echo \$NAME | md5sum | cut -d' ' -f 1` \$URL ; git clone --reference ../../../../../../.gitcache --depth 1 \$URL \$NAME)",
+	        'init_branch'   => "(export BRANCH='%s' ; export URL='%s' ; export NAME='%s' ; GIT_DIR=../../../../../../.gitcache git remote add -t \$BRANCH -f `echo \$NAME-\$BRANCH | md5sum | cut -d' ' -f 1` \$URL ; git clone --reference ../../../../../../.gitcache --depth 1 --branch \$BRANCH \$URL \$NAME)",
+	        'init_commit'   => "(export URL='%s' ; export NAME='%s' ; GIT_DIR=../../../../../../.gitcache git remote add -f `echo \$NAME | md5sum | cut -d' ' -f 1` \$URL ; git clone --reference ../../../../../../.gitcache \$URL \$NAME && cd '%s' && git checkout -b '%s' '%s' && cd -)",
 	        'update'	=> "git pull --ff",
 	        'update_force'	=> "git pull --ff || (git reset --hard HEAD; git pull --ff; exit 1)",
 	        'post_update'	=> "git submodule update --init --recursive",
 	        'controldir'	=> ".git",
 	        'revision'	=> "git rev-parse --short HEAD | tr -d '\n'"},
 	'src-git-full' => {
-	        'init'          => "git clone '%s' '%s'",
-	        'init_branch'   => "git clone --branch '%s' '%s' '%s'",
-	        'init_commit'   => "git clone '%s' '%s' && cd '%s' && git checkout -b '%s' '%s' && cd -",
+	        'init'          => "(export URL='%s' ; export NAME='%s' ; GIT_DIR=../../../../../../.gitcache git remote add -f `echo \$NAME | md5sum | cut -d' ' -f 1` \$URL ; git clone --reference ../../../../../../.gitcache \$URL \$NAME)",
+	        'init_branch'   => "(export BRANCH='%s' ; export URL='%s' ; export NAME='%s' ; GIT_DIR=../../../../../../.gitcache git remote add -t \$BRANCH -f `echo \$NAME-\$BRANCH | md5sum | cut -d' ' -f 1` \$URL ; git clone --reference ../../../../../../.gitcache --branch \$BRANCH \$URL \$NAME)",
+	        'init_commit'   => "(export URL='%s' ; export NAME='%s' ; GIT_DIR=../../../../../../.gitcache git remote add -f `echo \$NAME | md5sum | cut -d' ' -f 1` \$URL ; git clone --reference ../../../../../../.gitcache \$URL \$NAME && cd '%s' && git checkout -b '%s' '%s' && cd -)",
 	        'update'	=> "git pull --ff",
 	        'update_force'	=> "git pull --ff || (git reset --hard HEAD; git pull --ff; exit 1)",
 	        'post_update'	=> "git submodule update --init --recursive",
--
2.24.1

Loading...

Available keyboard shortcuts

Tasklist

Task Details

Task Editing