Skip to content

Commit

Permalink
kbuild: deb-pkg: make .orig tarball a hard link if possible
Browse files Browse the repository at this point in the history
If '..' belongs to the same filesystem, create a hard link instead of
a copy. In most cases, you can save disk space.

I do not want to use 'mv' because keeping linux.tar.gz is useful to
avoid unneeded rebuilding of the tarball.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>
  • Loading branch information
Masahiro Yamada committed Feb 26, 2023
1 parent 6eabebb commit b44aa8c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion scripts/Makefile.package
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,11 @@ debian-orig: private source = $(shell dpkg-parsechangelog -S Source)
debian-orig: private version = $(shell dpkg-parsechangelog -S Version | sed 's/-[^-]*$$//')
debian-orig: private orig-name = $(source)_$(version).orig.tar.gz
debian-orig: linux.tar.gz debian
$(Q)cp $< ../$(orig-name)
$(Q)if [ "$(df --output=target .. 2>/dev/null)" = "$(df --output=target $< 2>/dev/null)" ]; then \
ln -f $< ../$(orig-name); \
else \
cp $< ../$(orig-name); \
fi

PHONY += deb-pkg
deb-pkg: debian-orig
Expand Down

0 comments on commit b44aa8c

Please sign in to comment.