From 5465022b6cd64674206e3eaa66578570f87156ca Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Wed, 18 Dec 2024 19:37:07 +0900 Subject: [PATCH] FROMGIT: kheaders: rename the 'cpio_dir' variable to 'tmpdir' The next commit will get rid of the use of 'cpio' command, as there is no strong reason to use it just for copying files. Before that, this commit renames the 'cpio_dir' variable to 'tmpdir'. No functional changes are intended. Signed-off-by: Masahiro Yamada Bug: 354775288 Bug: 368667510 Bug: 291611617 Change-Id: Ifccf20c43cefbed6eeecfec4eb12ca77ed2942bf (cherry picked from commit 28186b227b316f5be2a9d7343f32e0457ffdd953 https://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild.git for-next) [elsk: Resolve minor merge conflict due to 28fa7afc424f "FROMLIST: kheaders: dereferences the source tree".] Signed-off-by: HONG Yifan --- kernel/gen_kheaders.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/kernel/gen_kheaders.sh b/kernel/gen_kheaders.sh index 037a58e1c449..390cf5d55764 100755 --- a/kernel/gen_kheaders.sh +++ b/kernel/gen_kheaders.sh @@ -7,7 +7,7 @@ set -e sfile="$(readlink -f "$0")" outdir="$(pwd)" tarfile=$1 -cpio_dir=$outdir/${tarfile%/*}/.tmp_cpio_dir +tmpdir=$outdir/${tarfile%/*}/.tmp_dir dir_list=" include/ @@ -65,15 +65,15 @@ fi echo " GEN $tarfile" -rm -rf $cpio_dir -mkdir $cpio_dir +rm -rf "${tmpdir}" +mkdir "${tmpdir}" if [ "$building_out_of_srctree" ]; then ( cd $srctree for f in $dir_list do find "$f" -name "*.h"; - done | cpio --quiet -L -pd $cpio_dir + done | cpio --quiet -L -pd "${tmpdir}" ) fi @@ -81,19 +81,19 @@ fi # of tree builds having stale headers in srctree. Just silence CPIO for now. for f in $dir_list; do find "$f" -name "*.h"; -done | cpio --quiet -L -pdu $cpio_dir >/dev/null 2>&1 +done | cpio --quiet -L -pdu "${tmpdir}" >/dev/null 2>&1 # Remove comments except SDPX lines -find $cpio_dir -type f -print0 | +find "${tmpdir}" -type f -print0 | xargs -0 -P8 -n1 perl -pi -e 'BEGIN {undef $/;}; s/\/\*((?!SPDX).)*?\*\///smg;' # Create archive and try to normalize metadata for reproducibility. tar "${KBUILD_BUILD_TIMESTAMP:+--mtime=$KBUILD_BUILD_TIMESTAMP}" \ --owner=0 --group=0 --sort=name --numeric-owner --mode=u=rw,go=r,a+X \ - -I $XZ -cf $tarfile -C $cpio_dir/ . > /dev/null + -I $XZ -cf $tarfile -C "${tmpdir}/" . > /dev/null echo $headers_md5 > kernel/kheaders.md5 echo "$this_file_md5" >> kernel/kheaders.md5 echo "$(md5sum $tarfile | cut -d ' ' -f1)" >> kernel/kheaders.md5 -rm -rf $cpio_dir +rm -rf "${tmpdir}"