linux-kbuild.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] package/Makefile: move source tar creation to a function
@ 2015-09-01 13:48 riku.voipio
  2015-09-01 14:31 ` Jim Davis
  0 siblings, 1 reply; 5+ messages in thread
From: riku.voipio @ 2015-09-01 13:48 UTC (permalink / raw)
  To: linux-kbuild, mmarek; +Cc: Riku Voipio

From: Riku Voipio <riku.voipio@linaro.org>

Split source tarball creation from rpm-pkg target
so it can be used from deb-pkg target as well. Other
improvements:

- Replace symlink to self with tar --transform
- Print 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>
---
 scripts/package/Makefile | 28 +++++++++++++++-------------
 1 file changed, 15 insertions(+), 13 deletions(-)

diff --git a/scripts/package/Makefile b/scripts/package/Makefile
index 8b11d5a..65cf12d 100644
--- a/scripts/package/Makefile
+++ b/scripts/package/Makefile
@@ -24,27 +24,29 @@
 # Remove hyphens since they have special meaning in RPM filenames
 KERNELPATH := kernel-$(subst -,_,$(KERNELRELEASE))
 # Include only those top-level files that are needed by make, plus the GPL copy
-TAR_CONTENT := $(KBUILD_ALLDIRS) kernel.spec .config .scmversion Makefile \
+TAR_CONTENT := $(KBUILD_ALLDIRS) .config .scmversion Makefile \
                Kbuild Kconfig COPYING $(wildcard localversion*)
-TAR_CONTENT := $(addprefix $(KERNELPATH)/,$(TAR_CONTENT))
 MKSPEC     := $(srctree)/scripts/package/mkspec
 
+quiet_cmd_src_tar = TAR     $(2).tar.gz
+      cmd_src_tar = \
+if test "$(objtree)" != "$(srctree)"; then \
+	echo "Building source tarball is not possible outside the"; \
+	echo "kernel source tree. Don't set KBUILD_OUTPUT, or use the"; \
+	echo "binrpm-pkg or bindeb-pkg target instead."; \
+	false; \
+fi ; \
+$(srctree)/scripts/setlocalversion --save-scmversion; \
+tar -cz $(RCS_TAR_IGNORE) --transform 's,^,$(2)/,' \
+    -f $(2).tar.gz $(TAR_CONTENT) $(3);\
+rm -f $(objtree)/.scmversion
+
 # rpm-pkg
 # ---------------------------------------------------------------------------
 rpm-pkg rpm: FORCE
-	@if test "$(objtree)" != "$(srctree)"; then \
-		echo "Building source + binary RPM is not possible outside the"; \
-		echo "kernel source tree. Don't set KBUILD_OUTPUT, or use the"; \
-		echo "binrpm-pkg target instead."; \
-		false; \
-	fi
 	$(MAKE) clean
-	ln -sf $(srctree) $(KERNELPATH)
 	$(CONFIG_SHELL) $(MKSPEC) >$(objtree)/kernel.spec
-	$(CONFIG_SHELL) $(srctree)/scripts/setlocalversion --save-scmversion
-	tar -cz $(RCS_TAR_IGNORE) -f $(KERNELPATH).tar.gz $(TAR_CONTENT)
-	rm $(KERNELPATH)
-	rm -f $(objtree)/.scmversion
+	$(call cmd,src_tar,$(KERNELPATH),kernel.spec)
 	$(CONFIG_SHELL) $(srctree)/scripts/mkversion > $(objtree)/.tmp_version
 	mv -f $(objtree)/.tmp_version $(objtree)/.version
 	rpmbuild --target $(UTS_MACHINE) -ta $(KERNELPATH).tar.gz
-- 
2.4.6


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

* Re: [PATCH] package/Makefile: move source tar creation to a function
  2015-09-01 13:48 [PATCH] package/Makefile: move source tar creation to a function riku.voipio
@ 2015-09-01 14:31 ` Jim Davis
  2015-09-02  4:58   ` Riku Voipio
  0 siblings, 1 reply; 5+ messages in thread
From: Jim Davis @ 2015-09-01 14:31 UTC (permalink / raw)
  To: riku.voipio; +Cc: linux-kbuild, Michal Marek

On Tue, Sep 1, 2015 at 6:48 AM,  <riku.voipio@linaro.org> wrote:
> From: Riku Voipio <riku.voipio@linaro.org>
>
> Split source tarball creation from rpm-pkg target
> so it can be used from deb-pkg target as well. Other
> improvements:
>
> - Replace symlink to self with tar --transform

While probably everyone -- or almost everyone -- uses gnu tar, that
particular option isn't available in older versions of gnu tar
(https://groups.google.com/forum/#!topic/uk.comp.os.linux/-7LDdMSRo5w).
Perhaps something could be added to Documentation/Changes about the
gnu tar version required?

-- 
Jim

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

* Re: [PATCH] package/Makefile: move source tar creation to a function
  2015-09-01 14:31 ` Jim Davis
@ 2015-09-02  4:58   ` Riku Voipio
  2015-09-02  6:09     ` Michal Marek
  0 siblings, 1 reply; 5+ messages in thread
From: Riku Voipio @ 2015-09-02  4:58 UTC (permalink / raw)
  To: Jim Davis; +Cc: linux-kbuild, Michal Marek

On 1 September 2015 at 17:31, Jim Davis <jim.epost@gmail.com> wrote:
>> - Replace symlink to self with tar --transform

> While probably everyone -- or almost everyone -- uses gnu tar, that
> particular option isn't available in older versions of gnu tar
> (https://groups.google.com/forum/#!topic/uk.comp.os.linux/-7LDdMSRo5w).
> Perhaps something could be added to Documentation/Changes about the
> gnu tar version required?

Looking at the changelog, this was added to tar 1.16 which was
released in 2006. Nine years sounds like a reasonable timeframe to
expect a feature being available?

Riku

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

* Re: [PATCH] package/Makefile: move source tar creation to a function
  2015-09-02  4:58   ` Riku Voipio
@ 2015-09-02  6:09     ` Michal Marek
  0 siblings, 0 replies; 5+ messages in thread
From: Michal Marek @ 2015-09-02  6:09 UTC (permalink / raw)
  To: Riku Voipio, Jim Davis; +Cc: linux-kbuild

Dne 2.9.2015 v 06:58 Riku Voipio napsal(a):
> On 1 September 2015 at 17:31, Jim Davis <jim.epost@gmail.com> wrote:
>>> - Replace symlink to self with tar --transform
> 
>> While probably everyone -- or almost everyone -- uses gnu tar, that
>> particular option isn't available in older versions of gnu tar
>> (https://groups.google.com/forum/#!topic/uk.comp.os.linux/-7LDdMSRo5w).
>> Perhaps something could be added to Documentation/Changes about the
>> gnu tar version required?
> 
> Looking at the changelog, this was added to tar 1.16 which was
> released in 2006. Nine years sounds like a reasonable timeframe to
> expect a feature being available?

But it costs us only a this ln and rm invocation to continue supporting
older GNU tar versions and non-GNU implementation. So I'd leave this
part as is. The rest of the patch is OK.

Michal


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

* [PATCH] package/Makefile: move source tar creation to a function
@ 2015-09-02  9:57 riku.voipio
  0 siblings, 0 replies; 5+ messages in thread
From: riku.voipio @ 2015-09-02  9:57 UTC (permalink / raw)
  To: linux-kbuild, mmarek; +Cc: Riku Voipio

From: Riku Voipio <riku.voipio@linaro.org>

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>
---
v2: don't use tar --transform anymore
 scripts/package/Makefile | 29 ++++++++++++++++-------------
 1 file changed, 16 insertions(+), 13 deletions(-)

diff --git a/scripts/package/Makefile b/scripts/package/Makefile
index 8b11d5a..297e756 100644
--- a/scripts/package/Makefile
+++ b/scripts/package/Makefile
@@ -24,27 +24,30 @@
 # Remove hyphens since they have special meaning in RPM filenames
 KERNELPATH := kernel-$(subst -,_,$(KERNELRELEASE))
 # Include only those top-level files that are needed by make, plus the GPL copy
-TAR_CONTENT := $(KBUILD_ALLDIRS) kernel.spec .config .scmversion Makefile \
+TAR_CONTENT := $(KBUILD_ALLDIRS) .config .scmversion Makefile \
                Kbuild Kconfig COPYING $(wildcard localversion*)
-TAR_CONTENT := $(addprefix $(KERNELPATH)/,$(TAR_CONTENT))
 MKSPEC     := $(srctree)/scripts/package/mkspec
 
+quiet_cmd_src_tar = TAR     $(2).tar.gz
+      cmd_src_tar = \
+if test "$(objtree)" != "$(srctree)"; then \
+	echo "Building source tarball is not possible outside the"; \
+	echo "kernel source tree. Don't set KBUILD_OUTPUT, or use the"; \
+	echo "binrpm-pkg or bindeb-pkg target instead."; \
+	false; \
+fi ; \
+$(srctree)/scripts/setlocalversion --save-scmversion; \
+ln -sf $(srctree) $(2); \
+tar -cz $(RCS_TAR_IGNORE) -f $(2).tar.gz \
+	$(addprefix $(2)/,$(TAR_CONTENT) $(3)); \
+rm -f $(2) $(objtree)/.scmversion
+
 # rpm-pkg
 # ---------------------------------------------------------------------------
 rpm-pkg rpm: FORCE
-	@if test "$(objtree)" != "$(srctree)"; then \
-		echo "Building source + binary RPM is not possible outside the"; \
-		echo "kernel source tree. Don't set KBUILD_OUTPUT, or use the"; \
-		echo "binrpm-pkg target instead."; \
-		false; \
-	fi
 	$(MAKE) clean
-	ln -sf $(srctree) $(KERNELPATH)
 	$(CONFIG_SHELL) $(MKSPEC) >$(objtree)/kernel.spec
-	$(CONFIG_SHELL) $(srctree)/scripts/setlocalversion --save-scmversion
-	tar -cz $(RCS_TAR_IGNORE) -f $(KERNELPATH).tar.gz $(TAR_CONTENT)
-	rm $(KERNELPATH)
-	rm -f $(objtree)/.scmversion
+	$(call cmd,src_tar,$(KERNELPATH),kernel.spec)
 	$(CONFIG_SHELL) $(srctree)/scripts/mkversion > $(objtree)/.tmp_version
 	mv -f $(objtree)/.tmp_version $(objtree)/.version
 	rpmbuild --target $(UTS_MACHINE) -ta $(KERNELPATH).tar.gz
-- 
2.4.6


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

end of thread, other threads:[~2015-09-02  9:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-01 13:48 [PATCH] package/Makefile: move source tar creation to a function riku.voipio
2015-09-01 14:31 ` Jim Davis
2015-09-02  4:58   ` Riku Voipio
2015-09-02  6:09     ` Michal Marek
  -- strict thread matches above, loose matches on Subject: below --
2015-09-02  9:57 riku.voipio

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).