nightly build: Move shell code for listing files under source control into a separate file

git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4449 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Bart Van Assche
2012-08-07 11:40:09 +00:00
parent 2df95bda26
commit 8df49947fa
3 changed files with 52 additions and 6 deletions

View File

@@ -60,9 +60,7 @@ extract_kernel_tree "$1" || exit $?
cd "${target}" || exit $?
svn status -v "$(dirname "$(dirname "$scriptname")")" \
| grep -vE '^\?|^Performing' \
| cut -c41- \
list-source-files "$(dirname "$(dirname "$scriptname")")" \
| grep -- "-${kernel_version}.*.patch$" \
| grep -v /in-tree/ \
| while read p

45
scripts/list-source-files Executable file
View File

@@ -0,0 +1,45 @@
#!/bin/bash
list_source_files() {
local r
r="$1"
while [ "$r" != "/" -a ! -e "$r/.svn" -a ! -e "$r/.git" -a ! -e "$r/.hg" ]; do
r="$(dirname "$r")"
done
if [ -e "$r/.svn" ]; then
(
cd "$1"
svn status -v | \
grep -vE '^[D?]|^Performing|^$' | \
cut -c41- | \
while read f; do
if [ -f "$f" ]; then
echo "$f"
fi
done
)
elif [ -e "$r/.git" ]; then
git_dir="$PWD"
while [ "$git_dir" != "" -a ! -e "$git_dir/.git" ]; do
git_dir="$(dirname "$git_dir")"
done
subdir="${PWD#${git_dir}}"
if [ "$git_dir" != "" ]; then
git ls-tree --name-only -r HEAD | sed "s|^$subdir/||"
else
echo "Ignored directory $PWD" >&2
fi
elif [ -e "$r/.hg" ]; then
hg manifest
else
echo "Not under source control: $PWD ?" >&2
fi
}
if [ $# = 0 ]; then
list_source_files "$PWD"
else
for d in "$@"; do list_source_files "$d"; done
fi

View File

@@ -88,9 +88,9 @@ function test_scst_tree_patches {
# Only copy those files which are administered by Subversion.
function duplicate_scst_source_tree {
if [ -e "$1/AskingQuestions" ]; then
( cd "$1" && svn status -v | grep -v '^[D?]' | cut -c3- | awk '{print $4}' \
| while read f; do [ ! -d "$f" ] && echo "$f"; done ) \
| tar -C "$1" --files-from=- -c -f - | tar -x -f -
"${scriptsdir}"/list-source-files "$1" |
tar -C "$1" --files-from=- -c -f - |
tar -x -f -
else
return 1
fi
@@ -473,6 +473,9 @@ if [ ! -e scst -o ! -e iscsi-scst -o ! -e srpt ]; then
fi
scriptsdir="$(dirname $0)"
if [ "${scriptsdir:0:1}" != "/" ]; then
scriptsdir="$PWD/${scriptsdir}"
fi
# Where to store persistenly downloaded kernel tarballs and kernel patches.
kernel_sources="$HOME/software/downloads"
# URL for downloading kernel tarballs and kernel patches.