build.sh: Add [--help] {build|missing} support
authorW. Trevor King <wking@tremily.us>
Wed, 29 Jan 2014 20:31:26 +0000 (12:31 -0800)
committerW. Trevor King <wking@tremily.us>
Wed, 29 Jan 2014 20:31:26 +0000 (12:31 -0800)
The 'missing' command show which repos remain unbuilt.  I use this to
setup the REPOS environtment variable for subsequent build calls, if
on of the repos is giving me trouble.

build.sh

index ecb77b613c0d34466eaa6942c9f3ffdcbf6ce133..78eb33bda18736702894acdc5a23bda2850bfc13 100755 (executable)
--- a/build.sh
+++ b/build.sh
@@ -199,10 +199,31 @@ build_repo()
        "${DOCKER}" tag -f "${NAMESPACE}/${REPO}:${DATE}" "${NAMESPACE}/${REPO}:latest" || die "failed to tag"
 }
 
-import_stage3
-import_portage
-extract_busybox
+build()
+{
+       import_stage3
+       import_portage
+       extract_busybox
+
+       for REPO in ${REPOS}; do
+               build_repo "${REPO}"
+       done
+}
+
+missing()
+{
+       for REPO in gentoo portage-import ${REPOS}; do
+               if ! repo_exists "${REPO}"; then
+                       msg "${REPO}"
+               fi
+       done
+}
+
+ACTION="${1:-build}"
 
-for REPO in ${REPOS}; do
-       build_repo "${REPO}"
-done
+case "${ACTION}" in
+build) build ;;
+missing) missing ;;
+--help) msg "usage: ${0} [--help] {build|missing}" ;;
+*) die "invalid action '${ACTION}'" ;;
+esac