diff --git a/scripts/generate-patched-kernel b/scripts/generate-patched-kernel index fa10f2135..94d139b77 100755 --- a/scripts/generate-patched-kernel +++ b/scripts/generate-patched-kernel @@ -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 diff --git a/scripts/list-source-files b/scripts/list-source-files new file mode 100755 index 000000000..768a9fdfe --- /dev/null +++ b/scripts/list-source-files @@ -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 diff --git a/scripts/run-regression-tests b/scripts/run-regression-tests index f0f3dde25..5466c4ccf 100755 --- a/scripts/run-regression-tests +++ b/scripts/run-regression-tests @@ -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.