summaryrefslogtreecommitdiff
path: root/tools/read-dependencies
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2013-09-11 08:30:35 -0400
committerScott Moser <smoser@ubuntu.com>2013-09-11 08:30:35 -0400
commit89cc478ee56a3f05ee4b810f8c969af9367bd034 (patch)
treec99b7ca65d7fadd38701d4f68841395528248f8b /tools/read-dependencies
parentd3a341dc6e2fcb4efd00a44d8f5a4524e64c4d27 (diff)
parent2a07fcd6444c7deb09063dff6b2f2d6e5385f355 (diff)
downloadvyos-cloud-init-89cc478ee56a3f05ee4b810f8c969af9367bd034.tar.gz
vyos-cloud-init-89cc478ee56a3f05ee4b810f8c969af9367bd034.zip
merge from trunk
Diffstat (limited to 'tools/read-dependencies')
-rwxr-xr-xtools/read-dependencies14
1 files changed, 7 insertions, 7 deletions
diff --git a/tools/read-dependencies b/tools/read-dependencies
index cadb09a8..87db5d83 100755
--- a/tools/read-dependencies
+++ b/tools/read-dependencies
@@ -12,20 +12,20 @@ find_root() {
[ $? -eq 0 -a -f "${topd}/setup.py" ] || return
ROOT_DIR="$topd"
}
+fail() { echo "$0:" "$@" 1>&2; exit 1; }
if ! find_root; then
- echo "Unable to locate 'setup.py' file that should" \
- "exist in the cloud-init root directory." 1>&2
- exit 1;
+ fail "Unable to locate 'setup.py' file that should " \
+ "exist in the cloud-init root directory."
fi
REQUIRES="$ROOT_DIR/Requires"
if [ ! -e "$REQUIRES" ]; then
- echo "Unable to find 'Requires' file located at $REQUIRES"
- exit 1
+ fail "Unable to find 'Requires' file located at '$REQUIRES'"
fi
-# Filter out comments and empty liens
-DEPS=$(grep -Pv "^\s*#" "$REQUIRES" | grep -Pv '^\s*$')
+# Filter out comments and empty lines
+DEPS=$(sed -n -e 's,#.*,,' -e '/./p' "$REQUIRES") ||
+ fail "failed to read deps from '${REQUIRES}'"
echo "$DEPS" | sort -d -f