From: Masahiro Yamada <masahiroy@kernel.org>
To: linux-kbuild@vger.kernel.org
Cc: linux-kernel@vger.kernel.org,
Masahiro Yamada <masahiroy@kernel.org>,
Nathan Chancellor <nathan@kernel.org>,
Nick Desaulniers <ndesaulniers@google.com>,
Nicolas Schier <nicolas@fjasle.eu>
Subject: [PATCH] kbuild: fix package build error due to broken symlinks
Date: Sat, 25 Mar 2023 23:19:09 +0900 [thread overview]
Message-ID: <20230325141909.2512452-1-masahiroy@kernel.org> (raw)
'make deb-pkg' and 'make rpm-pkg' fail if a broken symlink exists in
a dirty source tree. Handle symlinks properly, and also, keep the
executable permission.
Fixes: 05e96e96a315 ("kbuild: use git-archive for source package creation")
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---
scripts/package/gen-diff-patch | 36 +++++++++++++++++++++++++---------
1 file changed, 27 insertions(+), 9 deletions(-)
diff --git a/scripts/package/gen-diff-patch b/scripts/package/gen-diff-patch
index f842ab50a780..23551de92e1b 100755
--- a/scripts/package/gen-diff-patch
+++ b/scripts/package/gen-diff-patch
@@ -23,16 +23,34 @@ fi
git -C ${srctree} status --porcelain --untracked-files=all |
while read stat path
do
- if [ "${stat}" = '??' ]; then
-
- if ! diff -u /dev/null "${srctree}/${path}" > .tmp_diff &&
- ! head -n1 .tmp_diff | grep -q "Binary files"; then
- {
- echo "--- /dev/null"
- echo "+++ linux/$path"
- cat .tmp_diff | tail -n +3
- } >> ${untracked_patch}
+ if [ "${stat}" != '??' ]; then
+ continue
+ fi
+
+ if [ -L "${path}" ]; then
+ {
+ echo "diff --git a/${path} b/${path}"
+ echo "new file mode 120000"
+ echo "--- /dev/null"
+ echo "+++ b/$path"
+ echo "@@ -0,0 +1 @@"
+ printf "+"; readlink ${path}
+ echo '\ No newline at end of file'
+ } >> ${untracked_patch}
+ elif ! diff -u /dev/null "${srctree}/${path}" > .tmp_diff &&
+ ! head -n1 .tmp_diff | grep -q "Binary files"; then
+ if [ -x ${path} ]; then
+ mode=100755
+ else
+ mode=100644
fi
+ {
+ echo "diff --git a/${path} b/${path}"
+ echo "new file mode ${mode}"
+ echo "--- /dev/null"
+ echo "+++ b/$path"
+ cat .tmp_diff | tail -n +3
+ } >> ${untracked_patch}
fi
done
--
2.34.1
next reply other threads:[~2023-03-25 14:19 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-25 14:19 Masahiro Yamada [this message]
2023-03-29 20:02 ` [PATCH] kbuild: fix package build error due to broken symlinks Nicolas Schier
2023-04-01 14:55 ` Masahiro Yamada
2023-04-01 17:53 ` Nicolas Schier
2023-04-02 2:13 ` Masahiro Yamada
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230325141909.2512452-1-masahiroy@kernel.org \
--to=masahiroy@kernel.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nathan@kernel.org \
--cc=ndesaulniers@google.com \
--cc=nicolas@fjasle.eu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox