summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rwxr-xr-xtools/make-tarball29
-rwxr-xr-xtools/read-dependencies23
-rwxr-xr-xtools/read-version24
-rwxr-xr-xtools/run-pylint10
4 files changed, 44 insertions, 42 deletions
diff --git a/tools/make-tarball b/tools/make-tarball
index 7fce5e28..7fdeb7df 100755
--- a/tools/make-tarball
+++ b/tools/make-tarball
@@ -1,22 +1,24 @@
#!/bin/sh
-
set -e
-ROOT_DIR=""
-if [ -e "setup.py" ]
-then
- ROOT_DIR="$PWD"
-elif [ -e "../setup.py" ]
-then
- ROOT_DIR="$PWD/../"
-else
+find_root() {
+ local topd
+ if [ -z "${CLOUD_INIT_TOP_D}" ]; then
+ topd=$(cd "$(dirname "${0}")" && cd .. && pwd)
+ else
+ topd=$(cd "${CLOUD_INIT_TOP_D}" && pwd)
+ fi
+ [ $? -eq 0 -a -f "${topd}/setup.py" ] || return
+ ROOT_DIR="$topd"
+}
+
+if ! find_root; then
echo "Unable to locate 'setup.py' file that should" \
- "exist in the cloud-init root directory."
- exit 1
+ "exist in the cloud-init root directory." 1>&2
+ exit 1;
fi
-if [ ! -z "$1" ]
-then
+if [ ! -z "$1" ]; then
ARCHIVE_FN="$1"
else
REVNO=$(bzr revno $ROOT_DIR)
@@ -30,4 +32,3 @@ echo "$FILES" | tar czf $ARCHIVE_FN \
--no-recursion --files-from -
echo "$ARCHIVE_FN"
-
diff --git a/tools/read-dependencies b/tools/read-dependencies
index 3aa6e286..4c88aa87 100755
--- a/tools/read-dependencies
+++ b/tools/read-dependencies
@@ -2,16 +2,21 @@
set -e
-if [ -e "setup.py" ]
-then
- ROOT_DIR="$PWD"
-elif [ -e "../setup.py" ]
-then
- ROOT_DIR="$PWD/../"
-else
+find_root() {
+ local topd
+ if [ -z "${CLOUD_INIT_TOP_D}" ]; then
+ topd=$(cd "$(dirname "${0}")" && cd .. && pwd)
+ else
+ topd=$(cd "${CLOUD_INIT_TOP_D}" && pwd)
+ fi
+ [ $? -eq 0 -a -f "${topd}/setup.py" ] || return
+ ROOT_DIR="$topd"
+}
+
+if ! find_root; then
echo "Unable to locate 'setup.py' file that should" \
- "exist in the cloud-init root directory."
- exit 1
+ "exist in the cloud-init root directory." 1>&2
+ exit 1;
fi
REQUIRES="$ROOT_DIR/Requires"
diff --git a/tools/read-version b/tools/read-version
index 690666b5..323357fe 100755
--- a/tools/read-version
+++ b/tools/read-version
@@ -2,16 +2,21 @@
set -e
-if [ -e "setup.py" ]
-then
- ROOT_DIR="$PWD"
-elif [ -e "../setup.py" ]
-then
- ROOT_DIR="$PWD/../"
-else
+find_root() {
+ local topd
+ if [ -z "${CLOUD_INIT_TOP_D}" ]; then
+ topd=$(cd "$(dirname "${0}")" && cd .. && pwd)
+ else
+ topd=$(cd "${CLOUD_INIT_TOP_D}" && pwd)
+ fi
+ [ $? -eq 0 -a -f "${topd}/setup.py" ] || return
+ ROOT_DIR="$topd"
+}
+
+if ! find_root; then
echo "Unable to locate 'setup.py' file that should" \
- "exist in the cloud-init root directory."
- exit 1
+ "exist in the cloud-init root directory." 1>&2
+ exit 1;
fi
CHNG_LOG="$ROOT_DIR/ChangeLog"
@@ -24,4 +29,3 @@ fi
VERSION=$(grep -P "\d+.\d+.\d+:" $CHNG_LOG | cut -f1 -d ":" | head -n 1)
echo $VERSION
-
diff --git a/tools/run-pylint b/tools/run-pylint
index dd6369aa..7ef44ac5 100755
--- a/tools/run-pylint
+++ b/tools/run-pylint
@@ -1,15 +1,7 @@
#!/bin/bash
-ci_files='cloud*.py cloudinit/*.py cloudinit/config/*.py'
-test_files=$(find tests -name "*.py")
-def_files="$ci_files $test_files"
-
if [ $# -eq 0 ]; then
- files=( )
- for f in $def_files; do
- [ -f "$f" ] || { echo "failed, $f not a file" 1>&2; exit 1; }
- files[${#files[@]}]=${f}
- done
+ files=( $(find * -name "*.py" -type f) )
else
files=( "$@" );
fi