summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorP. J. McDermott <pjm@nac.net>2012-05-21 23:54:52 (EDT)
committer P. J. McDermott <pjm@nac.net>2012-05-22 00:07:16 (EDT)
commit5b109ffb18d1790557594c149056971c98b6c625 (patch)
tree61c8e0202fd8f8842e3145160e1cac770316d78f
parentcb9f794cc59ac058bcd1ad751c68a60a507c9bb9 (diff)
Support '-S' and '-b' options.
-rw-r--r--man/opkbuild.1.in9
-rw-r--r--src/opkbuild.sh31
2 files changed, 37 insertions, 3 deletions
diff --git a/man/opkbuild.1.in b/man/opkbuild.1.in
index dc6588f..59393f5 100644
--- a/man/opkbuild.1.in
+++ b/man/opkbuild.1.in
@@ -1,12 +1,13 @@
.\" Author: Patrick "P. J." McDermott
.TH opkbuild 1 \
-"2012-04-25" "@@PACKAGE@@-@@VERSION@@" "opkg Build Helper Tools"
+"2012-05-22" "@@PACKAGE@@-@@VERSION@@" "opkg Build Helper Tools"
.SH NAME
opkbuild \- Build opkg packages.
.SH SYNOPSIS
.B opkbuild
+.RB [ -S | -b ]
.RB [ -r
.IR assume-uid0-cmd ]
.RB [ -a
@@ -23,6 +24,12 @@ builds binary packages from a source package.
.SH OPTIONS
.TP
+.BI \-S
+Build only the source package (no binary packages).
+.TP
+.BI \-b
+Build only the binary packages (no source package).
+.TP
.BI \-r \ assume-uid0-cmd
Assume user ID 0 using the specified command (default is
.BR fakeroot ).
diff --git a/src/opkbuild.sh b/src/opkbuild.sh
index 7b53fa6..18991e7 100644
--- a/src/opkbuild.sh
+++ b/src/opkbuild.sh
@@ -26,7 +26,8 @@
print_usage()
{
cat <<EOF
-Usage: ${1} [-r assume-uid0-cmd] [-a host-architecture] [-p host-platform] \
+Usage: ${1} [-S|-b] [-r assume-uid0-cmd] \
+[-a host-architecture] [-p host-platform] \
[-s status-override] [-d]
EOF
}
@@ -56,7 +57,9 @@ error()
exit 1
}
-opts=$(getopt -n "${0}" -o 'r:a:p:ds:V' -- "${@}")
+source_only=true
+binary_only=true
+opts=$(getopt -n "${0}" -o 'Sbr:a:p:ds:V' -- "${@}")
if [ ${?} -ne 0 ]; then
print_usage "${0}" >&2
exit 1;
@@ -64,6 +67,14 @@ fi
eval set -- "${opts}"
while true; do
case "${1}" in
+ -S)
+ source_only=true
+ shift
+ ;;
+ -b)
+ binary_only=true
+ shift
+ ;;
-r)
uid0_cmd=${2}
shift 2
@@ -99,6 +110,10 @@ while true; do
esac
done
+if ${source_only} && ${binary_only}; then
+ printf 'opkbuild: Error: Cannot combine -S and -b\n' >&2
+ exit 1
+fi
if [ -z "${uid0_cmd}" ]; then
uid0_cmd=fakeroot
fi
@@ -284,6 +299,10 @@ oh-checkbuilddeps -s "${status_override}" || error "${srcpkg}-src"
printf '\n'
+# TODO: This should maybe go in the library.
+
+if ! ${binary_only}; then
+
# Build *-src package.
printf 'opkbuild: Attempting to build package "%s"...\n' "${srcpkg}-src"
printf 'opkbuild: Installing files for package "%s"...\n' "${srcpkg}-src"
@@ -305,6 +324,12 @@ done
( ${uid0_cmd} rm -Rf ${srcpkg}-src.data;) || error "${srcpkg}-src"
printf 'opkbuild: Package "%s" complete!\n\n' "${srcpkg}-src"
+fi
+
+# TODO: This should maybe go in the library.
+
+if ! ${source_only}; then
+
# Build other binary packages.
for binpkgdir in ../*.pkg/; do
binpkg=${binpkgdir#'../'}
@@ -381,6 +406,8 @@ for binpkgdir in ../*.pkg/; do
fi
done
+fi
+
# Clean up tmp.
cd ..
rm -Rf tmp