blob: b646dc3fa74866a336be642b57d178a8c74d6f04 (
plain)
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
57
58
59
60
61
62
63
64
65
66
67
68
69
|
#!/hint/bash
#
# SPDX-License-Identifier: GPL-3.0-or-later
[[ -z ${DEVTOOLS_INCLUDE_UTIL_SRCINFO_SH:-} ]] || return 0
DEVTOOLS_INCLUDE_UTIL_SRCINFO_SH=1
_DEVTOOLS_LIBRARY_DIR=${_DEVTOOLS_LIBRARY_DIR:-@pkgdatadir@}
# shellcheck source=src/lib/common.sh
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/common.sh
source /usr/share/makepkg/util/util.sh
source /usr/share/makepkg/srcinfo.sh
set -eo pipefail
print_srcinfo() {
local pkgpath=${1:-.}
local outdir pkg pid
local pids=()
# source the PKGBUILD
# shellcheck source=contrib/makepkg/PKGBUILD.proto
. "${pkgpath}"/PKGBUILD
# run without parallelization for single packages
if (( ${#pkgname[@]} == 1 )); then
write_srcinfo_content
return 0
fi
[[ -z ${WORKDIR:-} ]] && setup_workdir
outdir=$(mktemp --directory --tmpdir="${WORKDIR}" pkgctl-srcinfo.XXXXXXXXXX)
# fork workload for each split pkgname
for pkg in "${pkgname[@]}"; do
(
# deactivate errexit to avoid makepkg abort on grep_function
set +e
srcinfo_write_package "$pkg" > "${outdir}/${pkg}"
)&
pids+=($!)
done
# join workload
for pid in "${pids[@]}"; do
if ! wait "${pid}"; then
return 1
fi
done
# collect output
srcinfo_write_global
for pkg in "${pkgname[@]}"; do
srcinfo_separate_section
cat "${outdir}/${pkg}"
done
}
write_srcinfo_file() {
local pkgpath=${1:-.}
stat_busy 'Generating .SRCINFO'
if ! print_srcinfo "${pkgpath}" > "${pkgpath}"/.SRCINFO; then
error 'Failed to write .SRCINFO file'
return 1
fi
stat_done
}
|