From 427193dd6c5bae371e6191916edbdc36f6332b66 Mon Sep 17 00:00:00 2001 From: Don Penney Date: Mon, 21 Dec 2020 15:25:27 -0500 Subject: [PATCH] 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 --- build-tools/build-srpms-parallel | 8 ++++---- build-tools/build-srpms-serial | 8 ++++---- build-tools/srpm-utils | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/build-tools/build-srpms-parallel b/build-tools/build-srpms-parallel index 3e667986..f8e59e01 100755 --- a/build-tools/build-srpms-parallel +++ b/build-tools/build-srpms-parallel @@ -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 ) diff --git a/build-tools/build-srpms-serial b/build-tools/build-srpms-serial index 37d4e4bb..a9cceeab 100755 --- a/build-tools/build-srpms-serial +++ b/build-tools/build-srpms-serial @@ -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 ) diff --git a/build-tools/srpm-utils b/build-tools/srpm-utils index d035f346..e9299af8 100644 --- a/build-tools/srpm-utils +++ b/build-tools/srpm-utils @@ -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