Skip to content

Commit 9a92eee

Browse files
committed
builddeb: avoid invoking sub-shells where possible
The commands surrounded by ( ... ) is run in a sub-shell, but you do not have to spawn a sub-shell for every single line. Use just one ( ... ) for creating debian/hdrsrcfiles. For tar, use -C option instead. Signed-off-by: Masahiro Yamada <[email protected]>
1 parent f9a4711 commit 9a92eee

File tree

1 file changed

+22
-13
lines changed

1 file changed

+22
-13
lines changed

scripts/package/builddeb

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -165,21 +165,30 @@ EOF
165165
done
166166

167167
# Build kernel header package
168-
(cd $srctree; find . arch/$SRCARCH -maxdepth 1 -name Makefile\*) > debian/hdrsrcfiles
169-
(cd $srctree; find include scripts -type f -o -type l) >> debian/hdrsrcfiles
170-
(cd $srctree; find arch/$SRCARCH -name module.lds -o -name Kbuild.platforms -o -name Platform) >> debian/hdrsrcfiles
171-
(cd $srctree; find $(find arch/$SRCARCH -name include -o -name scripts -type d) -type f) >> debian/hdrsrcfiles
172-
if is_enabled CONFIG_STACK_VALIDATION; then
173-
echo tools/objtool/objtool >> debian/hdrobjfiles
174-
fi
175-
find arch/$SRCARCH/include Module.symvers include scripts -type f >> debian/hdrobjfiles
176-
if is_enabled CONFIG_GCC_PLUGINS; then
177-
find scripts/gcc-plugins -name \*.so >> debian/hdrobjfiles
178-
fi
168+
(
169+
cd $srctree
170+
find . arch/$SRCARCH -maxdepth 1 -name Makefile\*
171+
find include scripts -type f -o -type l
172+
find arch/$SRCARCH -name module.lds -o -name Kbuild.platforms -o -name Platform
173+
find $(find arch/$SRCARCH -name include -o -name scripts -type d) -type f
174+
) > debian/hdrsrcfiles
175+
176+
{
177+
if is_enabled CONFIG_STACK_VALIDATION; then
178+
echo tools/objtool/objtool
179+
fi
180+
181+
find arch/$SRCARCH/include Module.symvers include scripts -type f
182+
183+
if is_enabled CONFIG_GCC_PLUGINS; then
184+
find scripts/gcc-plugins -name \*.so
185+
fi
186+
} > debian/hdrobjfiles
187+
179188
destdir=$kernel_headers_dir/usr/src/linux-headers-$version
180189
mkdir -p "$destdir"
181-
(cd $srctree; tar -c -f - -T -) < debian/hdrsrcfiles | (cd $destdir; tar -xf -)
182-
tar -c -f - -T - < debian/hdrobjfiles | (cd $destdir; tar -xf -)
190+
tar -c -f - -C $srctree -T debian/hdrsrcfiles | tar -xf - -C $destdir
191+
tar -c -f - -T debian/hdrobjfiles | tar -xf - -C $destdir
183192
cp $KCONFIG_CONFIG $destdir/.config # copy .config manually to be where it's expected to be
184193
ln -sf "/usr/src/linux-headers-$version" "$kernel_headers_dir/lib/modules/$version/build"
185194
rm -f debian/hdrsrcfiles debian/hdrobjfiles

0 commit comments

Comments
 (0)