Skip to content

Commit 5455747

Browse files
committed
Fixes #2
1 parent 37fbcf7 commit 5455747

File tree

1 file changed

+24
-8
lines changed

1 file changed

+24
-8
lines changed

spinach

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -282,11 +282,27 @@ get_all() {
282282
while ! (( finished )) ; do
283283
finished=1
284284

285-
local depends
286-
local makedepends
287-
288-
source <(tr '\n' ' ' < "$name/PKGBUILD" | grep -Eo ' (make)?depends=\([^)]*\)' | \
289-
sed -r "s/(['\"])([^><='\"]*)[><=]+[^'\"]*\1/\1\2\1/g" | str_clean)
285+
local depends=()
286+
local makedepends=()
287+
local checkdepends=()
288+
289+
if [[ -e "$name"/.SRCINFO ]]; then
290+
while read -r key _ value _; do
291+
[[ $key == depends ]] && depends+=("$value")
292+
[[ $key == makedepends ]] && makedepends+=("$value")
293+
[[ $key == checkdepends ]] && checkdepends+=("$value")
294+
[[ $key == '' ]] && break
295+
done < "$name"/.SRCINFO
296+
else
297+
# e.g. when using a local repository which you probably trust anyway
298+
if ask "No .SRCINFO, source $name/PKGBUILD?"; then
299+
source <(tr '\n' ' ' < "$name/PKGBUILD" | grep -Eo ' (make|check)?depends=\([^)]*\)' | \
300+
sed -r "s/(['\"])([^><='\"]*)[><=]+[^'\"]*\1/\1\2\1/g" | str_clean)
301+
else
302+
msg e "Must get depends from $name, inspect manually and rerun"
303+
return 1
304+
fi
305+
fi
290306

291307
local deps="$(pacman -T ${depends[*]} ${makedepends[*]} | tr '\n' ' ')"
292308

@@ -300,8 +316,8 @@ get_all() {
300316
if ! get_all "$dep" 0; then
301317
finished=0
302318

303-
if ask "Modify PKGBUILD for $pkg?"; then
304-
"$EDITOR" "$pkg/PKGBUILD"
319+
if ask "Modify PKGBUILD for $name?"; then
320+
"$EDITOR" "$name/PKGBUILD"
305321
break 1
306322
else
307323
msg e "Must download dependencies."
@@ -499,7 +515,7 @@ build() {
499515
local pkg i PKGEXT
500516
501517
for pkg; do
502-
get_all "$pkg"
518+
get_all "$pkg" || return 1
503519
done
504520
505521
(( $# == 0 )) && return 0 # no packages to install

0 commit comments

Comments
 (0)