summaryrefslogtreecommitdiff
path: root/mk/pkgformat/pkg/list-dependencies
blob: 81b926670f4b168e1702aa9d1da9c47fa86c48c0 (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
#!/bin/sh
#
######################################################################
#
# NAME
#	list-dependencies -- build package dependencies list
#
# SYNOPSIS
#	list-dependencies bootstrap build full
#
# DESCRIPTION
#	For each (reduced) dependency a line of the following format is
#	printed:
#
#		<depends_type>	<pattern>	<directory>
#
#	Valid dependency types are "bootstrap", "build" and "full".
#
# ENVIRONMENT
#	AWK
#		Path to the awk interpreter.
#
#	PKGSRCDIR
#		Root directory of the pkgsrc tree.
#
#	SED
#		Path to the sed command.
#
# The following variables are used by the reduce-depends.awk script:
#
#	PKG_ADMIN
#		Path to the pkg_admin command.
#
#	PWD_CMD
#		Path to the pwd command.
#
######################################################################

: ${ECHO:=echo}

set -e

trap "exit 1" USR1

reduce_depends() {
	${AWK} -f ${PKGSRCDIR}/mk/pkgformat/pkg/reduce-depends.awk "$1" \
	|| kill -USR1 $$
}

print_entries() {
	reduce_depends "$2" | while read dep; do
		pattern=`${ECHO} "$dep" | ${SED} -e "s,:.*,,"`
		dir=`${ECHO} "$dep" | ${SED} -e "s,.*:,,"`
		[ "$pattern" ]
		[ "$dir" ]
		${ECHO} "$1	$pattern	$dir"
	done
}

if [ $# != 4 ]; then
	echo "usage: list-dependencies bootstrap_depends tool_depends build_depends depends" 1>&2
	exit 1
fi

print_entries bootstrap "$1"
print_entries tool "$2"
print_entries build "$3"
print_entries full "$4"