Kaynağa Gözat

implement 2 function that allows to fetch Portage tree from either git or rsync; downloaded tree is ready for further use and for distribution as a tarball

master
belliash 7 yıl önce
ebeveyn
işleme
db4f141f24
1 değiştirilmiş dosya ile 34 ekleme ve 0 silme
  1. 34
    0
      libraries/repositories

+ 34
- 0
libraries/repositories Dosyayı Görüntüle

@@ -76,6 +76,40 @@ function mirrorRsync() {
76 76
 	return ${?}
77 77
 }
78 78
 
79
+#-------------------------------------------------------------------------------
80
+# Downloads Portage tree ready for use at production using GIT protocol
81
+# Parameters: %dest_directory% %address%
82
+#-------------------------------------------------------------------------------
83
+function originGitPortage() {
84
+	local DST="${1}"
85
+	local SRC="${2}"
86
+	if [ -e ${DST} ]; then
87
+		return 1
88
+	fi
89
+	run "git clone --depth 1 ${SRC} ${DST}" || return 1
90
+	cd ${DST}
91
+	run "git config core.compression 0" || return 1
92
+	run "git gc --aggressive" || return 1
93
+	return 0
94
+}
95
+
96
+#-------------------------------------------------------------------------------
97
+# Downloads Portage tree ready for use at production using RSYNC protocol
98
+# Parameters: %dest_directory% %address%
99
+#-------------------------------------------------------------------------------
100
+function originRsyncPortage() {
101
+	local DST="${1}"
102
+	local SRC="${2}"
103
+	if [ -e ${DST} ]; then
104
+		return 1
105
+	fi
106
+	run "rsync --compress --delete --delete-after --devices --force --links \
107
+		--partial --perms --recursive --safe-links --stats --times \
108
+		--timeout=${FETCHTIMEOUT} --whole-file --exclude=/distfiles \
109
+		--exclude=/local --exclude=/packages ${SRC}/ ${DST}" || return 1
110
+	return 0
111
+}
112
+
79 113
 #-------------------------------------------------------------------------------
80 114
 # Prepares SSH Wrappers for use with unknown hosts (requires key authentication)
81 115
 #-------------------------------------------------------------------------------

Loading…
İptal
Kaydet