* [PATCH] package Makefile: fix perf-tar targets when outdir is set
@ 2015-06-17 12:34 riku.voipio
2015-06-18 12:33 ` Riku Voipio
0 siblings, 1 reply; 4+ messages in thread
From: riku.voipio @ 2015-06-17 12:34 UTC (permalink / raw)
To: linux-kbuild, mmarek; +Cc: Riku Voipio
From: Riku Voipio <riku.voipio@linaro.org>
When building with $srctree != $objtree, perf-tar-* targets fail
to read the MANIFEST file and add the PERF-VERSION-FILE needed
by out-of-tree builds. The build errors and an incorrect tar is created:
$ make O=build-x86 perf-targz-src-pkg
TAR
cat: ../tools/perf/MANIFEST: No such file or directory
tar: perf-4.1.0-rc8/PERF-VERSION-FILE: Cannot stat: No such file or dir..
tar: Exiting with failure status due to previous errors
Kbuild sets objtree to "." and srctree to ".." The command to output
MANIFEST becomes:
$(cd ..; echo $(cat ../tools/perf/MANIFEST))
Without MANIFEST, the entire kernel source tree is added to the perf
source tarball. The easy fix is removing the unneccesary cd $objtree bit.
Second, PERF-VERSION-FILE gets not added, because in-tree build path is
hardcoded to Makefile:
util/PERF-VERSION-GEN ../../$(perf-tar)/ 2>/dev/null)
The PERF-VERSION-GEN needs to be run from tools/perf directory, so
we can't just replace the hardcoded "../../" bit the relative $objtree
contents - we need a fully expanded $objtree_full variable to place
PERF-VERSION-FILE to the right place. Also remove the error redirect
to /dev/null which hid the error.
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
---
scripts/package/Makefile | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/scripts/package/Makefile b/scripts/package/Makefile
index 99ca6e7..98f934c 100644
--- a/scripts/package/Makefile
+++ b/scripts/package/Makefile
@@ -33,6 +33,11 @@ TAR_CONTENT := $(KBUILD_ALLDIRS) kernel.spec .config .scmversion Makefile \
TAR_CONTENT := $(addprefix $(KERNELPATH)/,$(TAR_CONTENT))
MKSPEC := $(srctree)/scripts/package/mkspec
+# objtree is relative path, which doesn't work if we cd around
+ifneq ($(objtree),)
+ objtree_full := $(shell readlink -f $(objtree) || echo $(objtree))
+endif
+
# rpm-pkg
# ---------------------------------------------------------------------------
rpm-pkg rpm: FORCE
@@ -110,13 +115,12 @@ perf-tar=perf-$(KERNELVERSION)
quiet_cmd_perf_tar = TAR
cmd_perf_tar = \
git --git-dir=$(srctree)/.git archive --prefix=$(perf-tar)/ \
- HEAD^{tree} $$(cd $(srctree); \
- echo $$(cat $(srctree)/tools/perf/MANIFEST)) \
+ HEAD^{tree} $$(echo $$(cat $(srctree)/tools/perf/MANIFEST)) \
-o $(perf-tar).tar; \
mkdir -p $(perf-tar); \
git --git-dir=$(srctree)/.git rev-parse HEAD > $(perf-tar)/HEAD; \
(cd $(srctree)/tools/perf; \
-util/PERF-VERSION-GEN ../../$(perf-tar)/ 2>/dev/null); \
+util/PERF-VERSION-GEN $(objtree_full)/$(perf-tar)/); \
tar rf $(perf-tar).tar $(perf-tar)/HEAD $(perf-tar)/PERF-VERSION-FILE; \
rm -r $(perf-tar); \
$(if $(findstring tar-src,$@),, \
--
2.1.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] package Makefile: fix perf-tar targets when outdir is set
2015-06-17 12:34 riku.voipio
@ 2015-06-18 12:33 ` Riku Voipio
0 siblings, 0 replies; 4+ messages in thread
From: Riku Voipio @ 2015-06-18 12:33 UTC (permalink / raw)
To: linux-kbuild, mmarek; +Cc: Riku Voipio
On 17 June 2015 at 15:34, <riku.voipio@linaro.org> wrote:
> From: Riku Voipio <riku.voipio@linaro.org>
>
> When building with $srctree != $objtree, perf-tar-* targets fail
> to read the MANIFEST file and add the PERF-VERSION-FILE needed
> by out-of-tree builds. The build errors and an incorrect tar is created:
>
> $ make O=build-x86 perf-targz-src-pkg
> TAR
> cat: ../tools/perf/MANIFEST: No such file or directory
> tar: perf-4.1.0-rc8/PERF-VERSION-FILE: Cannot stat: No such file or dir..
> tar: Exiting with failure status due to previous errors
>
> Kbuild sets objtree to "." and srctree to ".." The command to output
> MANIFEST becomes:
>
> $(cd ..; echo $(cat ../tools/perf/MANIFEST))
>
> Without MANIFEST, the entire kernel source tree is added to the perf
> source tarball. The easy fix is removing the unneccesary cd $objtree bit.
Easy but wrong. MANIFEST has wildcards that fail to expand if current directory
isn't srctree. Updated patch coming.
> Second, PERF-VERSION-FILE gets not added, because in-tree build path is
> hardcoded to Makefile:
>
> util/PERF-VERSION-GEN ../../$(perf-tar)/ 2>/dev/null)
>
> The PERF-VERSION-GEN needs to be run from tools/perf directory, so
> we can't just replace the hardcoded "../../" bit the relative $objtree
> contents - we need a fully expanded $objtree_full variable to place
> PERF-VERSION-FILE to the right place. Also remove the error redirect
> to /dev/null which hid the error.
>
> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
> ---
> scripts/package/Makefile | 10 +++++++---
> 1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/scripts/package/Makefile b/scripts/package/Makefile
> index 99ca6e7..98f934c 100644
> --- a/scripts/package/Makefile
> +++ b/scripts/package/Makefile
> @@ -33,6 +33,11 @@ TAR_CONTENT := $(KBUILD_ALLDIRS) kernel.spec .config .scmversion Makefile \
> TAR_CONTENT := $(addprefix $(KERNELPATH)/,$(TAR_CONTENT))
> MKSPEC := $(srctree)/scripts/package/mkspec
>
> +# objtree is relative path, which doesn't work if we cd around
> +ifneq ($(objtree),)
> + objtree_full := $(shell readlink -f $(objtree) || echo $(objtree))
> +endif
> +
> # rpm-pkg
> # ---------------------------------------------------------------------------
> rpm-pkg rpm: FORCE
> @@ -110,13 +115,12 @@ perf-tar=perf-$(KERNELVERSION)
> quiet_cmd_perf_tar = TAR
> cmd_perf_tar = \
> git --git-dir=$(srctree)/.git archive --prefix=$(perf-tar)/ \
> - HEAD^{tree} $$(cd $(srctree); \
> - echo $$(cat $(srctree)/tools/perf/MANIFEST)) \
> + HEAD^{tree} $$(echo $$(cat $(srctree)/tools/perf/MANIFEST)) \
> -o $(perf-tar).tar; \
> mkdir -p $(perf-tar); \
> git --git-dir=$(srctree)/.git rev-parse HEAD > $(perf-tar)/HEAD; \
> (cd $(srctree)/tools/perf; \
> -util/PERF-VERSION-GEN ../../$(perf-tar)/ 2>/dev/null); \
> +util/PERF-VERSION-GEN $(objtree_full)/$(perf-tar)/); \
> tar rf $(perf-tar).tar $(perf-tar)/HEAD $(perf-tar)/PERF-VERSION-FILE; \
> rm -r $(perf-tar); \
> $(if $(findstring tar-src,$@),, \
> --
> 2.1.4
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] package Makefile: fix perf-tar targets when outdir is set
@ 2015-06-18 12:37 riku.voipio
2015-08-19 14:08 ` Michal Marek
0 siblings, 1 reply; 4+ messages in thread
From: riku.voipio @ 2015-06-18 12:37 UTC (permalink / raw)
To: linux-kbuild, mmarek; +Cc: Riku Voipio
From: Riku Voipio <riku.voipio@linaro.org>
When building with $srctree != $objtree, perf-tar-* targets fail
to read the MANIFEST file and add the PERF-VERSION-FILE needed
by out-of-tree builds. The build errors and an incorrect tar is created:
$ make O=build-x86 perf-targz-src-pkg
TAR
cat: ../tools/perf/MANIFEST: No such file or directory
tar: perf-4.1.0-rc8/PERF-VERSION-FILE: Cannot stat: No such file or
dir..
tar: Exiting with failure status due to previous errors
Kbuild sets objtree to "." and srctree to ".." The command to output
MANIFEST becomes:
$(cd ..; echo $(cat ../tools/perf/MANIFEST))
Without MANIFEST, the entire kernel source tree is added to the perf
source tarball. The *correct* fix is to keep the cd and remove srctree
from cat command line since MANIFEST has wildcards that fail to expand
working directory isn't srctree.
Second, PERF-VERSION-FILE gets not added, because in-tree build path is
hardcoded to Makefile:
util/PERF-VERSION-GEN ../../$(perf-tar)/ 2>/dev/null)
The PERF-VERSION-GEN needs to be run from tools/perf directory, so
we can't just replace the hardcoded "../../" bit the relative $objtree
contents - we need a fully expanded $objtree_full variable to place
PERF-VERSION-FILE to the right place. Also remove the error redirect
to /dev/null which hid the error.
Patch v2: switch from easy fix to correct fix
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
---
scripts/package/Makefile | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/scripts/package/Makefile b/scripts/package/Makefile
index 99ca6e7..cd5a321 100644
--- a/scripts/package/Makefile
+++ b/scripts/package/Makefile
@@ -33,6 +33,11 @@ TAR_CONTENT := $(KBUILD_ALLDIRS) kernel.spec .config .scmversion Makefile \
TAR_CONTENT := $(addprefix $(KERNELPATH)/,$(TAR_CONTENT))
MKSPEC := $(srctree)/scripts/package/mkspec
+# objtree is relative path, which doesn't work if we cd around
+ifneq ($(objtree),)
+ objtree_full := $(shell readlink -f $(objtree) || echo $(objtree))
+endif
+
# rpm-pkg
# ---------------------------------------------------------------------------
rpm-pkg rpm: FORCE
@@ -111,12 +116,12 @@ quiet_cmd_perf_tar = TAR
cmd_perf_tar = \
git --git-dir=$(srctree)/.git archive --prefix=$(perf-tar)/ \
HEAD^{tree} $$(cd $(srctree); \
- echo $$(cat $(srctree)/tools/perf/MANIFEST)) \
+ echo $$(cat tools/perf/MANIFEST)) \
-o $(perf-tar).tar; \
mkdir -p $(perf-tar); \
git --git-dir=$(srctree)/.git rev-parse HEAD > $(perf-tar)/HEAD; \
(cd $(srctree)/tools/perf; \
-util/PERF-VERSION-GEN ../../$(perf-tar)/ 2>/dev/null); \
+util/PERF-VERSION-GEN $(objtree_full)/$(perf-tar)/); \
tar rf $(perf-tar).tar $(perf-tar)/HEAD $(perf-tar)/PERF-VERSION-FILE; \
rm -r $(perf-tar); \
$(if $(findstring tar-src,$@),, \
--
2.1.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] package Makefile: fix perf-tar targets when outdir is set
2015-06-18 12:37 [PATCH] package Makefile: fix perf-tar targets when outdir is set riku.voipio
@ 2015-08-19 14:08 ` Michal Marek
0 siblings, 0 replies; 4+ messages in thread
From: Michal Marek @ 2015-08-19 14:08 UTC (permalink / raw)
To: riku.voipio; +Cc: linux-kbuild
On 2015-06-18 14:37, riku.voipio@linaro.org wrote:
> From: Riku Voipio <riku.voipio@linaro.org>
>
> When building with $srctree != $objtree, perf-tar-* targets fail
> to read the MANIFEST file and add the PERF-VERSION-FILE needed
> by out-of-tree builds. The build errors and an incorrect tar is created:
>
> $ make O=build-x86 perf-targz-src-pkg
> TAR
> cat: ../tools/perf/MANIFEST: No such file or directory
> tar: perf-4.1.0-rc8/PERF-VERSION-FILE: Cannot stat: No such file or
> dir..
> tar: Exiting with failure status due to previous errors
>
> Kbuild sets objtree to "." and srctree to ".." The command to output
> MANIFEST becomes:
>
> $(cd ..; echo $(cat ../tools/perf/MANIFEST))
>
> Without MANIFEST, the entire kernel source tree is added to the perf
> source tarball. The *correct* fix is to keep the cd and remove srctree
> from cat command line since MANIFEST has wildcards that fail to expand
> working directory isn't srctree.
>
> Second, PERF-VERSION-FILE gets not added, because in-tree build path is
> hardcoded to Makefile:
>
> util/PERF-VERSION-GEN ../../$(perf-tar)/ 2>/dev/null)
>
> The PERF-VERSION-GEN needs to be run from tools/perf directory, so
> we can't just replace the hardcoded "../../" bit the relative $objtree
> contents - we need a fully expanded $objtree_full variable to place
> PERF-VERSION-FILE to the right place. Also remove the error redirect
> to /dev/null which hid the error.
>
> Patch v2: switch from easy fix to correct fix
>
> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
> ---
> scripts/package/Makefile | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/scripts/package/Makefile b/scripts/package/Makefile
> index 99ca6e7..cd5a321 100644
> --- a/scripts/package/Makefile
> +++ b/scripts/package/Makefile
> @@ -33,6 +33,11 @@ TAR_CONTENT := $(KBUILD_ALLDIRS) kernel.spec .config .scmversion Makefile \
> TAR_CONTENT := $(addprefix $(KERNELPATH)/,$(TAR_CONTENT))
> MKSPEC := $(srctree)/scripts/package/mkspec
>
> +# objtree is relative path, which doesn't work if we cd around
> +ifneq ($(objtree),)
> + objtree_full := $(shell readlink -f $(objtree) || echo $(objtree))
> +endif
> +
> # rpm-pkg
> # ---------------------------------------------------------------------------
> rpm-pkg rpm: FORCE
> @@ -111,12 +116,12 @@ quiet_cmd_perf_tar = TAR
> cmd_perf_tar = \
> git --git-dir=$(srctree)/.git archive --prefix=$(perf-tar)/ \
> HEAD^{tree} $$(cd $(srctree); \
> - echo $$(cat $(srctree)/tools/perf/MANIFEST)) \
> + echo $$(cat tools/perf/MANIFEST)) \
> -o $(perf-tar).tar; \
> mkdir -p $(perf-tar); \
> git --git-dir=$(srctree)/.git rev-parse HEAD > $(perf-tar)/HEAD; \
> (cd $(srctree)/tools/perf; \
> -util/PERF-VERSION-GEN ../../$(perf-tar)/ 2>/dev/null); \
> +util/PERF-VERSION-GEN $(objtree_full)/$(perf-tar)/); \
Make defines a $(CURDIR) variable, which you can use instead of defining
your own.
Michal
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-08-19 14:08 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-18 12:37 [PATCH] package Makefile: fix perf-tar targets when outdir is set riku.voipio
2015-08-19 14:08 ` Michal Marek
-- strict thread matches above, loose matches on Subject: below --
2015-06-17 12:34 riku.voipio
2015-06-18 12:33 ` 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).