forked from LibreELEC/LibreELEC.tv
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpkgjson
More file actions
executable file
·56 lines (44 loc) · 1.4 KB
/
Copy pathpkgjson
File metadata and controls
executable file
·56 lines (44 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0-only
# Copyright (C) 2019-present Team LibreELEC (https://libreelec.tv)
. config/options ""
# This function is passed a list of package.mk paths to be processed.
# Each package.mk is sourced with relevant variables output in JSON format.
json_worker() {
local packages="$@"
local pkgpath hierarchy exited
exit() { exited=1; }
for pkgpath in ${packages}; do
pkgpath="${pkgpath%%@*}"
exited=0
if ! source_package "${pkgpath}/package.mk" &>/dev/null; then
unset -f exit
die "$(print_color CLR_ERROR "FAILURE: sourcing package ${pkgpath}/package.mk")"
fi
[ ${exited} -eq 1 ] && continue
[[ ${pkgpath} =~ ^${ROOT}/${PACKAGES}/ ]] && hierarchy="global" || hierarchy="local"
cat <<EOF
{
"name": "${PKG_NAME}",
"hierarchy": "${hierarchy}",
"section": "${PKG_SECTION}",
"bootstrap": "${PKG_DEPENDS_BOOTSTRAP}",
"init": "${PKG_DEPENDS_INIT}",
"host": "${PKG_DEPENDS_HOST}",
"target": "${PKG_DEPENDS_TARGET}",
"unpack": "${PKG_DEPENDS_UNPACK}"
},
EOF
done
unset -f exit
}
if [ "$1" = "--worker" ]; then
shift
json_worker "$*"
exit $?
fi
# pipefail: return value of a pipeline is the value of the last (rightmost) command to exit with a non-zero status
set -o pipefail
cat ${_CACHE_PACKAGE_GLOBAL} ${_CACHE_PACKAGE_LOCAL} |
xargs --max-args=64 --max-procs="$(nproc)" "$0" --worker
exit $?