linux-kbuild.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michal Marek <mmarek@suse.cz>
To: Jonathan Nieder <jrnieder@gmail.com>
Cc: linux-kbuild@vger.kernel.org, maximilian attems <max@stro.at>,
	Sam Ravnborg <sam@ravnborg.org>, Frans Pop <elendil@planet.nl>
Subject: Re: [PATCH v2 1/2] scripts/package: add KBUILD_PKG_ROOTCMD variable
Date: Tue, 24 Nov 2009 12:27:02 +0100	[thread overview]
Message-ID: <4B0BC306.9010009@suse.cz> (raw)
In-Reply-To: <20091015133532.GB6718@progeny.tock>

Dne 15.10.2009 15:35, Jonathan Nieder napsal(a):
> diff --git a/scripts/package/Makefile b/scripts/package/Makefile
> index f67cc88..6997f38 100644
> --- a/scripts/package/Makefile
> +++ b/scripts/package/Makefile
> @@ -53,7 +53,8 @@ rpm-pkg rpm: $(objtree)/kernel.spec FORCE
>  	set -e; \
>  	mv -f $(objtree)/.tmp_version $(objtree)/.version
>  
> -	$(RPM) $(RPMOPTS) --target $(UTS_MACHINE) -ta ../$(KERNELPATH).tar.gz
> +	$(KBUILD_PKG_ROOTCMD) $(RPM) $(RPMOPTS) --target $(UTS_MACHINE) \
> +		-ta ../$(KERNELPATH).tar.gz
>  	rm ../$(KERNELPATH).tar.gz
>  
>  clean-files := $(objtree)/kernel.spec
> @@ -70,8 +71,9 @@ binrpm-pkg: $(objtree)/binkernel.spec FORCE
>  	set -e; \
>  	mv -f $(objtree)/.tmp_version $(objtree)/.version
>  
> -	$(RPM) $(RPMOPTS) --define "_builddir $(objtree)" --target \
> -		$(UTS_MACHINE) -bb $<
> +	$(KBUILD_PKG_ROOTCMD) $(RPM) $(RPMOPTS) \
> +		--define "_builddir $(objtree)" \
> +		--target $(UTS_MACHINE) -bb $<

Why is this needed for the rpm targets? The generates spec file doesn't
require root privileges and correctly sets root as the owner of the
packaged files.


>  clean-files += $(objtree)/binkernel.spec
>  
> @@ -79,7 +81,8 @@ clean-files += $(objtree)/binkernel.spec
>  # ---------------------------------------------------------------------------
>  deb-pkg: FORCE
>  	$(MAKE) KBUILD_SRC=
> -	$(CONFIG_SHELL) $(srctree)/scripts/package/builddeb
> +	$(KBUILD_PKG_ROOTCMD) $(CONFIG_SHELL) \
> +		$(srctree)/scripts/package/builddeb
>  
>  clean-dirs += $(objtree)/debian/
>  
> @@ -88,7 +91,8 @@ clean-dirs += $(objtree)/debian/
>  # ---------------------------------------------------------------------------
>  tar%pkg: FORCE
>  	$(MAKE) KBUILD_SRC=
> -	$(CONFIG_SHELL) $(srctree)/scripts/package/buildtar $@
> +	$(KBUILD_PKG_ROOTCMD) $(CONFIG_SHELL) \
> +		$(srctree)/scripts/package/buildtar $@

GNU tar has --owner and --group options to override the owner and group
of the files in the archive, something like

opts=
if tar --owner=root --group=root --help >/dev/null 2>&1; then
    opts="--owner=root --group=root"
fi
tar cf - . $opts ...

would make tar-pkg do the right thing automatically without specifying
fakeroot. I don't know about deb-pkg, if it needs fakeroot, let's add
the variable, but it's not needed for *rpm-pkg and after a simple change
to buildtar it would not be needed for tar-pkg.

Michal

>  
>  clean-dirs += $(objtree)/tar-install/
>  
> @@ -96,10 +100,10 @@ clean-dirs += $(objtree)/tar-install/
>  # Help text displayed when executing 'make help'
>  # ---------------------------------------------------------------------------
>  help: FORCE
> +	@echo ' Set KBUILD_PKG_ROOTCMD={sudo|fakeroot -u|...} and make as non-root:'
>  	@echo '  rpm-pkg         - Build both source and binary RPM kernel packages'
>  	@echo '  binrpm-pkg      - Build only the binary kernel package'
>  	@echo '  deb-pkg         - Build the kernel as an deb package'
>  	@echo '  tar-pkg         - Build the kernel as an uncompressed tarball'
>  	@echo '  targz-pkg       - Build the kernel as a gzip compressed tarball'
>  	@echo '  tarbz2-pkg      - Build the kernel as a bzip2 compressed tarball'
> -


  reply	other threads:[~2009-11-24 11:26 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-14  6:46 [PATCH resend 0/2] fakeroot dwimery for scripts/package/* Jonathan Nieder
2009-10-14  6:54 ` [PATCH resend 1/2] scripts/package: add ROOTCMD variable Jonathan Nieder
2009-10-14  6:55 ` [PATCH resend 2/2] scripts/package: use fakeroot if available Jonathan Nieder
2009-10-14  7:16 ` [PATCH resend 0/2] fakeroot dwimery for scripts/package/* Sam Ravnborg
2009-10-14  9:59   ` Frans Pop
2009-10-14 11:03     ` maximilian attems
2009-10-15 13:31       ` [PATCH v2 " Jonathan Nieder
2009-10-15 13:35         ` [PATCH v2 1/2] scripts/package: add KBUILD_PKG_ROOTCMD variable Jonathan Nieder
2009-11-24 11:27           ` Michal Marek [this message]
2009-11-24 12:03             ` Jonathan Nieder
2009-11-24 13:13               ` Michal Marek
2009-11-24 15:09             ` [PATCH v3 0/3] fakeroot dwimery for deb-pkg target Jonathan Nieder
2009-11-24 15:11               ` [PATCH 1/3] scripts/package: tar-pkg: use tar --owner=root Jonathan Nieder
2009-11-24 15:14               ` [PATCH v3 2/3] scripts/package: add KBUILD_PKG_ROOTCMD variable Jonathan Nieder
2009-11-24 15:21               ` [PATCH v3 3/3] scripts/package: deb-pkg: use fakeroot if available Jonathan Nieder
2009-11-24 19:07                 ` Michal Marek
2009-10-15 13:39         ` [PATCH v2 2/2] scripts/package: " Jonathan Nieder
2009-11-04 21:22         ` [PATCH v2 0/2] fakeroot dwimery for scripts/package/* maximilian attems

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4B0BC306.9010009@suse.cz \
    --to=mmarek@suse.cz \
    --cc=elendil@planet.nl \
    --cc=jrnieder@gmail.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=max@stro.at \
    --cc=sam@ravnborg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).