Skip to content

Commit 2680382

Browse files
Riku VoipioMichal Marek
authored andcommitted
package/Makefile: move source tar creation to a function
Split source tarball creation from rpm-pkg target so it can be used from deb-pkg target as well. As added bonus, we can now pretty print TAR the name of tarball created in quiet mode This patch prepares the groundwork for deb-pkg source package adding bit. Signed-off-by: Riku Voipio <riku.voipio@linaro.org> Signed-off-by: Michal Marek <mmarek@suse.com>
1 parent 5bbb9f7 commit 2680382

1 file changed

Lines changed: 16 additions & 13 deletions

File tree

‎scripts/package/Makefile‎

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,27 +24,30 @@
2424
# Remove hyphens since they have special meaning in RPM filenames
2525
KERNELPATH := kernel-$(subst -,_,$(KERNELRELEASE))
2626
# Include only those top-level files that are needed by make, plus the GPL copy
27-
TAR_CONTENT := $(KBUILD_ALLDIRS) kernel.spec .config .scmversion Makefile \
27+
TAR_CONTENT := $(KBUILD_ALLDIRS) .config .scmversion Makefile \
2828
Kbuild Kconfig COPYING $(wildcard localversion*)
29-
TAR_CONTENT := $(addprefix $(KERNELPATH)/,$(TAR_CONTENT))
3029
MKSPEC := $(srctree)/scripts/package/mkspec
3130

31+
quiet_cmd_src_tar = TAR $(2).tar.gz
32+
cmd_src_tar = \
33+
if test "$(objtree)" != "$(srctree)"; then \
34+
echo "Building source tarball is not possible outside the"; \
35+
echo "kernel source tree. Don't set KBUILD_OUTPUT, or use the"; \
36+
echo "binrpm-pkg or bindeb-pkg target instead."; \
37+
false; \
38+
fi ; \
39+
$(srctree)/scripts/setlocalversion --save-scmversion; \
40+
ln -sf $(srctree) $(2); \
41+
tar -cz $(RCS_TAR_IGNORE) -f $(2).tar.gz \
42+
$(addprefix $(2)/,$(TAR_CONTENT) $(3)); \
43+
rm -f $(2) $(objtree)/.scmversion
44+
3245
# rpm-pkg
3346
# ---------------------------------------------------------------------------
3447
rpm-pkg rpm: FORCE
35-
@if test "$(objtree)" != "$(srctree)"; then \
36-
echo "Building source + binary RPM is not possible outside the"; \
37-
echo "kernel source tree. Don't set KBUILD_OUTPUT, or use the"; \
38-
echo "binrpm-pkg target instead."; \
39-
false; \
40-
fi
4148
$(MAKE) clean
42-
ln -sf $(srctree) $(KERNELPATH)
4349
$(CONFIG_SHELL) $(MKSPEC) >$(objtree)/kernel.spec
44-
$(CONFIG_SHELL) $(srctree)/scripts/setlocalversion --save-scmversion
45-
tar -cz $(RCS_TAR_IGNORE) -f $(KERNELPATH).tar.gz $(TAR_CONTENT)
46-
rm $(KERNELPATH)
47-
rm -f $(objtree)/.scmversion
50+
$(call cmd,src_tar,$(KERNELPATH),kernel.spec)
4851
$(CONFIG_SHELL) $(srctree)/scripts/mkversion > $(objtree)/.tmp_version
4952
mv -f $(objtree)/.tmp_version $(objtree)/.version
5053
rpmbuild --target $(UTS_MACHINE) -ta $(KERNELPATH).tar.gz

0 commit comments

Comments
 (0)