File tree 1 file changed +45
-0
lines changed
1 file changed +45
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ # SPDX-License-Identifier: GPL-2.0
4
+ # Copyright (C) 2019-present Team LibreELEC (https://libreelec.tv)
5
+
6
+ # Download all packages listed in the build plan to SOURCES_DIR
7
+
8
+ unset _CACHE_PACKAGE_LOCAL _CACHE_PACKAGE_GLOBAL _DEBUG_DEPENDS_LIST _DEBUG_PACKAGE_LIST
9
+
10
+ . config/options " "
11
+
12
+ THREADCOUNT=" ${THREADCOUNT:- $(nproc)} "
13
+
14
+ # function to enable use of parallel
15
+ download_package_tarball () {
16
+ local package_name=" ${1} "
17
+
18
+ " ${SCRIPTS} /get" " ${package_name} "
19
+ }
20
+
21
+ # Packages listed in the build plan
22
+ PACKAGE_LIST=$( \
23
+ " ${SCRIPTS} /pkgjson" | \
24
+ " ${SCRIPTS} /genbuildplan.py" --hide-header --list-packages --build ${@:- image} ${GENFLAGS} || \
25
+ die " FAILURE: Unable to generate plan"
26
+ )
27
+
28
+ # drop :target, :host, :init, and now repeated package entries
29
+ UNIQUE_PACKAGES=$(
30
+ for package in ${PACKAGE_LIST} ; do
31
+ echo " ${package} " | cut -d " :" -f 1
32
+ done | awk ' !seen[$0]++'
33
+ )
34
+
35
+ # Package downloading
36
+ if command -v parallel > /dev/null; then
37
+ export -f download_package_tarball
38
+ export SCRIPTS
39
+
40
+ parallel --jobs " ${THREADCOUNT} " download_package_tarball <<< " ${UNIQUE_PACKAGES}"
41
+ else
42
+ for package in ${UNIQUE_PACKAGES} ; do
43
+ download_package_tarball " ${package} "
44
+ done
45
+ fi
You can’t perform that action at this time.
0 commit comments