From 5b109ffb18d1790557594c149056971c98b6c625 Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Mon, 21 May 2012 23:54:52 -0400 Subject: Support '-S' and '-b' options. --- 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 <&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 -- cgit v0.9.1