Exclude .tox folder when checking file ages

The content of a .tox folder should not be considered when building
srpms. Additionally, as this folder can be fairly large and include
tens of thousands of files, a find listing can take some time. This
commit updates these find commands to exclude the .tox folder from the
search in order to save time if a user has run tox tests prior to the
build.

Change-Id: I035d730af8cdd443487f6ead3eec9e1e54f28709
Related-Bug: 1908940
Signed-off-by: Don Penney <don.penney@windriver.com>
This commit is contained in:
Don Penney 2020-12-21 15:25:27 -05:00
parent df11011fce
commit 427193dd6c
3 changed files with 10 additions and 10 deletions

View File

@ -768,7 +768,7 @@ build_dir_srpm () {
# Find age of youngest input file.
# We will apply this as the creation/modification timestamp of the src.rpm we produce.
#
AGE=$(find $PKG_BASE $ORIG_SRPM_PATH -type f -exec stat --format '%Y' "{}" \; | grep -v '[/][.]git$' | grep -v '[/][.]git[/]' | sort -nr | head -n 1)
AGE=$(find $PKG_BASE $ORIG_SRPM_PATH ! -path '*/.git/*' ! -path '*/.tox/*' -type f -exec stat --format '%Y' "{}" \; | sort -nr | head -n 1)
if [ -f $PKG_BASE/$DATA ]; then
AGE2=$(
cd $PKG_BASE
@ -787,7 +787,7 @@ build_dir_srpm () {
if [ "x$PATH_LIST" == "x" ]; then
echo "0"
else
AGE2=$(find -L $PATH_LIST -type f -exec stat --format '%Y' "{}" \; | grep -v '[/][.]git$' | grep -v '[/][.]git[/]' | sort -nr | head -n 1)
AGE2=$(find -L $PATH_LIST ! -path '*/.git/*' ! -path '*/.tox/*' -type f -exec stat --format '%Y' "{}" \; | sort -nr | head -n 1)
echo "$AGE2"
fi
)
@ -1115,7 +1115,7 @@ build_dir_spec () {
# Find age of youngest input file.
# We will apply this as the creation/modification timestamp of the src.rpm we produce.
#
AGE=$(find $PKG_BASE -type f -exec stat --format '%Y' "{}" \; | grep -v '[/][.]git$' | grep -v '[/][.]git[/]' | sort -nr | head -n 1)
AGE=$(find $PKG_BASE ! -path '*/.git/*' ! -path '*/.tox/*' -type f -exec stat --format '%Y' "{}" \; | sort -nr | head -n 1)
if [ -f $PKG_BASE/$DATA ]; then
AGE2=$(
cd $PKG_BASE
@ -1138,7 +1138,7 @@ build_dir_spec () {
if [ "x$PATH_LIST" == "x" ]; then
echo "0"
else
AGE2=$(find -L $PATH_LIST -type f -exec stat --format '%Y' "{}" \; | grep -v '[/][.]git$' | grep -v '[/][.]git[/]' | sort -nr | head -n 1)
AGE2=$(find -L $PATH_LIST ! -path '*/.git/*' ! -path '*/.tox/*' -type f -exec stat --format '%Y' "{}" \; | sort -nr | head -n 1)
echo "$AGE2"
fi
)

View File

@ -747,7 +747,7 @@ build_dir_srpm () {
# Find age of youngest input file.
# We will apply this as the creation/modification timestamp of the src.rpm we produce.
#
AGE=$(find $PKG_BASE $ORIG_SRPM_PATH -type f -exec stat --format '%Y' "{}" \; | grep -v '[/][.]git$' | grep -v '[/][.]git[/]' | sort -nr | head -n 1)
AGE=$(find $PKG_BASE $ORIG_SRPM_PATH ! -path '*/.git/*' ! -path '*/.tox/*' -type f -exec stat --format '%Y' "{}" \; | sort -nr | head -n 1)
if [ -f $PKG_BASE/$DATA ]; then
AGE2=$(
cd $PKG_BASE
@ -765,7 +765,7 @@ build_dir_srpm () {
if [ "x$PATH_LIST" == "x" ]; then
echo "0"
else
AGE2=$(find -L $PATH_LIST -type f -exec stat --format '%Y' "{}" \; | grep -v '[/][.]git$' | grep -v '[/][.]git[/]' | sort -nr | head -n 1)
AGE2=$(find -L $PATH_LIST ! -path '*/.git/*' ! -path '*/.tox/*' -type f -exec stat --format '%Y' "{}" \; | sort -nr | head -n 1)
echo "$AGE2"
fi
)
@ -1093,7 +1093,7 @@ build_dir_spec () {
# Find age of youngest input file.
# We will apply this as the creation/modification timestamp of the src.rpm we produce.
#
AGE=$(find $PKG_BASE -type f -exec stat --format '%Y' "{}" \; | grep -v '[/][.]git$' | grep -v '[/][.]git[/]' | sort -nr | head -n 1)
AGE=$(find $PKG_BASE ! -path '*/.git/*' ! -path '*/.tox/*' -type f -exec stat --format '%Y' "{}" \; | sort -nr | head -n 1)
if [ -f $PKG_BASE/$DATA ]; then
AGE2=$(
cd $PKG_BASE
@ -1115,7 +1115,7 @@ build_dir_spec () {
if [ "x$PATH_LIST" == "x" ]; then
echo "0"
else
AGE2=$(find -L $PATH_LIST -type f -exec stat --format '%Y' "{}" \; | grep -v '[/][.]git$' | grep -v '[/][.]git[/]' | sort -nr | head -n 1)
AGE2=$(find -L $PATH_LIST ! -path '*/.git/*' ! -path '*/.tox/*' -type f -exec stat --format '%Y' "{}" \; | sort -nr | head -n 1)
echo "$AGE2"
fi
)

View File

@ -3411,8 +3411,8 @@ srpm_source_file_list () {
# Create lists of input files (INPUT_FILES) and symlinks (INPUT_LINKS).
# First elements are absolute paths...
while read path; do
find "${path}" -type f | grep -v -e '[/][.]git$' -e '[/][.]git[/]' -e '[/][.]tox[/]' >> $INPUT_FILES
find "${path}" -type l | grep -v -e '[/][.]git$' -e '[/][.]git[/]' -e '[/][.]tox[/]' >> $INPUT_LINKS
find "${path}" ! -path '*/.git/*' ! -path '*/.tox/*' -type f >> $INPUT_FILES
find "${path}" ! -path '*/.git/*' ! -path '*/.tox/*' -type l >> $INPUT_LINKS
done < "${INPUT_SOURCES}"
# Create sorted, unique list of canonical paths