public inbox for linux-kbuild@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kbuild: fix package build error due to broken symlinks
@ 2023-03-25 14:19 Masahiro Yamada
  2023-03-29 20:02 ` Nicolas Schier
  0 siblings, 1 reply; 5+ messages in thread
From: Masahiro Yamada @ 2023-03-25 14:19 UTC (permalink / raw)
  To: linux-kbuild
  Cc: linux-kernel, Masahiro Yamada, Nathan Chancellor,
	Nick Desaulniers, Nicolas Schier

'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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-04-02  2:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-25 14:19 [PATCH] kbuild: fix package build error due to broken symlinks Masahiro Yamada
2023-03-29 20:02 ` Nicolas Schier
2023-04-01 14:55   ` Masahiro Yamada
2023-04-01 17:53     ` Nicolas Schier
2023-04-02  2:13       ` Masahiro Yamada

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox