summaryrefslogtreecommitdiff
path: root/scripts/package/mkspec
diff options
context:
space:
mode:
authorMasahiro Yamada <masahiroy@kernel.org>2023-04-10 15:09:07 +0300
committerMasahiro Yamada <masahiroy@kernel.org>2023-04-11 02:58:45 +0300
commitaa7d233f45b4c549750044c9921f7afcbe50925b (patch)
treeb987d6ad1b3ece19a9d7144705c80d3c5905a5d3 /scripts/package/mkspec
parentdcc11ac9dcaffdce428794f282c100a736244b55 (diff)
downloadlinux-aa7d233f45b4c549750044c9921f7afcbe50925b.tar.xz
kbuild: give up untracked files for source package builds
When the source tree is dirty and contains untracked files, package builds may fail, for example, when a broken symlink exists, a file path contains whitespaces, etc. Since commit 05e96e96a315 ("kbuild: use git-archive for source package creation"), the source tarball only contains committed files because it is created by 'git archive'. scripts/package/gen-diff-patch tries to address the diff from HEAD, but including untracked files by the hand-crafted script introduces more complexity. I wrote a patch [1] to make it work in most cases, but still wonder if this is what we should aim for. To simplify the code, this patch just gives up untracked files. Going forward, it is your responsibility to do 'git add' for what you want in the source package. The script shows a warning just in case you forgot to do so. It should be checked only when building source packages. [1]: https://lore.kernel.org/all/CAK7LNAShbZ56gSh9PrbLnBDYKnjtTkHMoCXeGrhcxMvqXGq9=g@mail.gmail.com/2-0001-kbuild-make-package-builds-more-robust.patch Fixes: 05e96e96a315 ("kbuild: use git-archive for source package creation") Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>
Diffstat (limited to 'scripts/package/mkspec')
-rwxr-xr-xscripts/package/mkspec11
1 files changed, 2 insertions, 9 deletions
diff --git a/scripts/package/mkspec b/scripts/package/mkspec
index b7d1dc28a5d6..fc8ad3fbc0a9 100755
--- a/scripts/package/mkspec
+++ b/scripts/package/mkspec
@@ -19,8 +19,7 @@ else
mkdir -p rpmbuild/SOURCES
cp linux.tar.gz rpmbuild/SOURCES
cp "${KCONFIG_CONFIG}" rpmbuild/SOURCES/config
- $(dirname $0)/gen-diff-patch rpmbuild/SOURCES/diff.patch rpmbuild/SOURCES/untracked.patch
- touch rpmbuild/SOURCES/diff.patch rpmbuild/SOURCES/untracked.patch
+ "${srctree}/scripts/package/gen-diff-patch" rpmbuild/SOURCES/diff.patch
fi
if grep -q CONFIG_MODULES=y include/config/auto.conf; then
@@ -56,7 +55,6 @@ sed -e '/^DEL/d' -e 's/^\t*//' <<EOF
$S Source0: linux.tar.gz
$S Source1: config
$S Source2: diff.patch
-$S Source3: untracked.patch
Provides: $PROVIDES
$S BuildRequires: bc binutils bison dwarves
$S BuildRequires: (elfutils-libelf-devel or libelf-devel) flex
@@ -94,12 +92,7 @@ $S$M
$S %prep
$S %setup -q -n linux
$S cp %{SOURCE1} .config
-$S if [ -s %{SOURCE2} ]; then
-$S patch -p1 < %{SOURCE2}
-$S fi
-$S if [ -s %{SOURCE3} ]; then
-$S patch -p1 < %{SOURCE3}
-$S fi
+$S patch -p1 < %{SOURCE2}
$S
$S %build
$S $MAKE %{?_smp_mflags} KERNELRELEASE=$KERNELRELEASE KBUILD_BUILD_VERSION=%{release}