blob: 03924616fff394e9a3eba9639c1938b9a579ad39 (
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
|
#!/usr/bin/env build
# FIXME find this dynamically
WIDTH="${WIDTH:-80}"
build_usage() { printf 'usage: build [options] <command> [command-opts] [all|<category>/<package|all> ...]\n\n'; }
build_commands()
{
BUILDER_COMMANDS=
BUILDER_CMD_WIDTH='0'
build_usage
echo "available builder commands from '${BUILDER_LIBDIR}':"
for cmd in $(cd "${BUILDER_LIBDIR}" && echo build-*); do
test -e "${BUILDER_LIBDIR}/${cmd}" || continue
cmd="${cmd#build-}"
BUILDER_COMMANDS="${BUILDER_COMMANDS} ${cmd#make-}"
length="$(echo "${cmd#build-}"|wc -c)"
if test "${length}" -gt "${BUILDER_CMD_WIDTH}"; then
BUILDER_CMD_WIDTH="${length}"
fi
done
BUILDER_COMMANDS="$(for cmd in ${BUILDER_COMMANDS}; do echo "${cmd}"; done|sort|uniq)"
length='0'
for cmd in ${BUILDER_COMMANDS}; do
printf " %-${BUILDER_CMD_WIDTH}s" "${cmd}"
length="$((${length} + ${BUILDER_CMD_WIDTH} + 2))"
if test "${length}" -gt "${WIDTH}"; then
printf '\n'
length='0'
fi
done
printf '\n'
# Find commands from ${PATH}
BUILDER_COMMANDS=
BUILDER_CMD_LENGTH='0'
IFS=':'
set -- ${PATH}
for dir; do
test -d "${dir}" || continue
for cmd in $(cd "${dir}" && echo build-*); do
test -e "${dir}/${cmd}" || continue
BUILDER_COMMANDS="${BUILDER_COMMANDS} ${cmd#build-}"
length="$(echo "${cmd#build-}"|wc -c)"
if test "${length}" -gt "${BUILDER_CMD_WIDTH}"; then
length="${BUILDER_CMD_WIDTH}"
fi
done
done
unset dir
BUILDER_COMMANDS="$(for cmd in ${BUILDER_COMMANDS}; do echo "${cmd}"; done|sort|uniq)"
test -z "${BUILDER_COMMANDS}" && return
echo "available builder commands from '${BUILDER_LIBDIR}':"
length='0'
for cmd in ${BUILDER_COMMANDS}; do
printf " %-${BUILDER_CMD_WIDTH}s" "${cmd}"
length="$((${length} + ${BUILDER_CMD_WIDTH} + 2))"
if test "${length}" -gt "${WIDTH}"; then
printf '\n'
length='0'
fi
done
printf '\n'
}
build_help()
{
build_usage
## usage
# Simply display the builder usage. Though it would be nice if some of this
# information was pushed down into the sub-commands.
cat<<EOF
Options
-------
-v, --version Display the builder version.
-d, --debug Enable debug logging.
-h, --help Display the builder help and exit (may appear anywhere on the
command line).
Commands
--------
query The query is used internally by builder, while allowing
one to query various packages from the builder repository.
source Create a copy/checkout of the package sources inside of
packages/<category>/<name>/source. The source/ directory
within a package takes precendences over the SOURCE_URI,
allowing in-place development of various packages. This is
particularly useful if the SOURCE_URI is an SCM.
fetch Fetch the sources for a package from the SOURCE_URI and store
them into the sources/ top-level directory. This is done
automatically for all commands which depend on it.
prep Prepare a package for compilation. This command is performed
automatically for all commands which depend on it.
compile Compile a package. This command is performed automatically for
all commands which depend on it.
package Construct a binary "artifact" file from a compiled package.
This command is performed automatically for all commands which
depend on it.
install Install a binary artifact into the sysroot. This action is
performed automatically for any packages which the current
target depends on. If necessary produce binary artifacts for
all package deps.
clean Clean specified package from sysroot and artifacts.
distclean Clean up specified package from sysroot, artifacts, and sources.
export Export the binary package to an rpm.
help Display this help. Try 'help --all' to list all commands'.
EOF
}
if test "${BUILDER_CALL_STACK}" = '__main__'; then
while test "$#" -gt '0'; do
case "${1}" in
(--all) build_commands; exit 0;;
(--) shift; break;;
(-*) die "unknown option '${1}'";;
(*) if test -x "${BUILDER_LIBDIR}/build-make-${1}"; then
exec build "make-${1}" --help
fi
exec build "${1}" --help;;
esac
done
build_help
fi
# vim: filetype=sh
|