* [PATCH v4] deb-pkg: add source package
@ 2015-09-01 13:48 riku.voipio
2015-09-01 23:26 ` Ben Hutchings
0 siblings, 1 reply; 3+ messages in thread
From: riku.voipio @ 2015-09-01 13:48 UTC (permalink / raw)
To: linux-kbuild, mmarek
Cc: Riku Voipio, Chris J Arges, maximilian attems, Ben Hutchings
From: Riku Voipio <riku.voipio@linaro.org>
Make deb-pkg build both source and binary package like make rpm-pkg does.
For people who only need binary kernel package, there is now bindeb-pkg
target, same target also used to build the .deb files if built from the
source package using dpkg-buildpackage.
Generated source package will build the same kernel .config than what
was available for make deb-pkg. The name of the source package can
be set with SOURCENAME enviroment variable.
The source package is useful for GPL compliance, or for feeding to a
automated debian package builder.
Cc: Chris J Arges <chris.j.arges@canonical.com>
Cc: maximilian attems <maks@stro.at>
Cc: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
---
v4 address Bens commends,
- use src_tar function instead of git archive for kernel sources
- move KDEB_SOURCENAME setting to Makefile so it can be passed to
src_tar
- use a toplevel .config file instead of a copy in debian/control
- defend against delete of debian/ in clean target
v3,
- Allow setting source package name with KDEB_SOURCENAME
- Fix issues noted by Ben: drop python and fix target in debian/rules
- Merge "ensure $MAKE can use jobserver" oneliner from Chris J Arges
v2, address Maximilians comments
- Isolate from my other patches, so it can be merged easier
- Separate bindeb-pkg target for building just binary debs
- Build source package in deb-pkg target to match rpm-pkg target
scripts/package/Makefile | 17 +++++++++++++----
scripts/package/builddeb | 37 +++++++++++++++++++++++++++++++++++--
2 files changed, 48 insertions(+), 6 deletions(-)
diff --git a/scripts/package/Makefile b/scripts/package/Makefile
index 65cf12d..562aa15 100644
--- a/scripts/package/Makefile
+++ b/scripts/package/Makefile
@@ -23,6 +23,8 @@
# Remove hyphens since they have special meaning in RPM filenames
KERNELPATH := kernel-$(subst -,_,$(KERNELRELEASE))
+KDEB_SOURCENAME ?= linux-$(KERNELRELEASE)
+export KDEB_SOURCENAME
# Include only those top-level files that are needed by make, plus the GPL copy
TAR_CONTENT := $(KBUILD_ALLDIRS) .config .scmversion Makefile \
Kbuild Kconfig COPYING $(wildcard localversion*)
@@ -82,11 +84,17 @@ quiet_cmd_builddeb = BUILDDEB
} && \
\
$$KBUILD_PKG_ROOTCMD $(CONFIG_SHELL) \
- $(srctree)/scripts/package/builddeb
+ $(srctree)/scripts/package/builddeb $@
deb-pkg: FORCE
+ $(MAKE) clean
+ $(call cmd,src_tar,$(KDEB_SOURCENAME))
+ $(MAKE) KBUILD_SRC=
+ +$(call cmd,builddeb)
+
+bindeb-pkg: FORCE
$(MAKE) KBUILD_SRC=
- $(call cmd,builddeb)
+ +$(call cmd,builddeb)
clean-dirs += $(objtree)/debian/
@@ -131,8 +139,9 @@ perf-%pkg: FORCE
# ---------------------------------------------------------------------------
help: FORCE
@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 a deb package'
+ @echo ' binrpm-pkg - Build only the binary kernel RPM package'
+ @echo ' deb-pkg - Build both source and binary deb kernel packages'
+ @echo ' bindeb-pkg - Build only the binary kernel 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'
diff --git a/scripts/package/builddeb b/scripts/package/builddeb
index 0c18cfd..6231cbef 100755
--- a/scripts/package/builddeb
+++ b/scripts/package/builddeb
@@ -79,6 +79,7 @@ if [ -n "$KDEB_PKGVERSION" ]; then
else
packageversion=$version-$revision
fi
+sourcename=$KDEB_SOURCENAME
tmpdir="$objtree/debian/tmp"
fwdir="$objtree/debian/fwtmp"
kernel_headers_dir="$objtree/debian/hdrtmp"
@@ -238,7 +239,7 @@ fi
# Generate a simple changelog template
cat <<EOF > debian/changelog
-linux-upstream ($packageversion) $distribution; urgency=low
+$sourcename ($packageversion) $distribution; urgency=low
* Custom built Linux kernel.
@@ -265,12 +266,16 @@ On Debian GNU/Linux systems, the complete text of the GNU General Public
License version 2 can be found in \`/usr/share/common-licenses/GPL-2'.
EOF
+
+build_depends="bc, kmod, cpio "
+
# Generate a control file
cat <<EOF > debian/control
-Source: linux-upstream
+Source: $sourcename
Section: kernel
Priority: optional
Maintainer: $maintainer
+Build-Depends: $build_depends
Standards-Version: 3.8.4
Homepage: http://www.kernel.org/
EOF
@@ -391,4 +396,32 @@ EOF
create_package "$dbg_packagename" "$dbg_dir"
fi
+if [ "x$1" = "xdeb-pkg" ]
+then
+ cat <<EOF > debian/rules
+#!/usr/bin/make -f
+
+build:
+ \$(MAKE) sourcename=${sourcename} KDEB_PKGVERSION=${packageversion}
+
+binary-arch:
+ \$(MAKE) sourcename=${sourcename} KDEB_PKGVERSION=${packageversion} bindeb-pkg
+
+clean:
+ mv debian/ debian.backup # debian/ might be cleaned away
+ \$(MAKE) clean
+ mv debian.backup debian
+
+binary: binary-arch
+EOF
+ mv ${sourcename}.tar.gz ../${sourcename}_${version}.orig.tar.gz
+ tar caf ../${sourcename}_${packageversion}.debian.tar.gz debian/{copyright,rules,changelog,control}
+ dpkg-source -cdebian/control -ldebian/changelog --format="3.0 (custom)" --target-format="3.0 (quilt)" \
+ -b / ../${sourcename}_${version}.orig.tar.gz ../${sourcename}_${packageversion}.debian.tar.gz
+ mv ${sourcename}_${packageversion}*dsc ..
+ dpkg-genchanges > ../${sourcename}_${packageversion}_${debarch}.changes
+else
+ dpkg-genchanges -b > ../${sourcename}_${packageversion}_${debarch}.changes
+fi
+
exit 0
--
2.4.6
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v4] deb-pkg: add source package
2015-09-01 13:48 [PATCH v4] deb-pkg: add source package riku.voipio
@ 2015-09-01 23:26 ` Ben Hutchings
2015-09-02 8:09 ` Riku Voipio
0 siblings, 1 reply; 3+ messages in thread
From: Ben Hutchings @ 2015-09-01 23:26 UTC (permalink / raw)
To: riku.voipio, linux-kbuild, mmarek; +Cc: Chris J Arges, maximilian attems
[-- Attachment #1: Type: text/plain, Size: 1896 bytes --]
On Tue, 2015-09-01 at 16:48 +0300, riku.voipio@linaro.org wrote:
> From: Riku Voipio <riku.voipio@linaro.org>
>
> Make deb-pkg build both source and binary package like make rpm-pkg does.
> For people who only need binary kernel package, there is now bindeb-pkg
> target, same target also used to build the .deb files if built from the
> source package using dpkg-buildpackage.
>
> Generated source package will build the same kernel .config than what
> was available for make deb-pkg. The name of the source package can
> be set with SOURCENAME enviroment variable.
KDEB_SOURCENAME, not SOURCENAME.
> The source package is useful for GPL compliance, or for feeding to a
> automated debian package builder.
>
> Cc: Chris J Arges <chris.j.arges@canonical.com>
> Cc: maximilian attems <maks@stro.at>
> Cc: Ben Hutchings <ben@decadent.org.uk>
> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
> ---
> v4 address Bens commends,
> - use src_tar function instead of git archive for kernel sources
> - move KDEB_SOURCENAME setting to Makefile so it can be passed to
> src_tar
> - use a toplevel .config file instead of a copy in debian/control
> - defend against delete of debian/ in clean target
[...]
> @@ -391,4 +396,32 @@ EOF
> > > create_package "$dbg_packagename" "$dbg_dir"
> fi
>
> +if [ "x$1" = "xdeb-pkg" ]
> +then
> + cat < debian/rules
> +#!/usr/bin/make -f
> +
> +build:
> +> > \$(MAKE) sourcename=${sourcename} KDEB_PKGVERSION=${packageversion}
I don't think this needs to set any variables, though it shouldn't
hurt.
> +binary-arch:
> + \$(MAKE) sourcename=${sourcename} KDEB_PKGVERSION=${packageversion} bindeb-pkg
[...]
Shouldn't this be setting KDEB_SOURCENAME, not sourcename?
Ben.
--
Ben Hutchings
Horngren's Observation:
Among economists, the real world is often a special case.
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 811 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v4] deb-pkg: add source package
2015-09-01 23:26 ` Ben Hutchings
@ 2015-09-02 8:09 ` Riku Voipio
0 siblings, 0 replies; 3+ messages in thread
From: Riku Voipio @ 2015-09-02 8:09 UTC (permalink / raw)
To: Ben Hutchings; +Cc: linux-kbuild, mmarek, Chris J Arges, maximilian attems
On 2 September 2015 at 02:26, Ben Hutchings <ben@decadent.org.uk> wrote:
> KDEB_SOURCENAME, not SOURCENAME.
Argh, last minute changes in variable names was a bad idea. Fixing up.
>> The source package is useful for GPL compliance, or for feeding to a
>> automated debian package builder.
>>
>> Cc: Chris J Arges <chris.j.arges@canonical.com>
>> Cc: maximilian attems <maks@stro.at>
>> Cc: Ben Hutchings <ben@decadent.org.uk>
>> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
>> ---
>> v4 address Bens commends,
>> - use src_tar function instead of git archive for kernel sources
>> - move KDEB_SOURCENAME setting to Makefile so it can be passed to
>> src_tar
>> - use a toplevel .config file instead of a copy in debian/control
>> - defend against delete of debian/ in clean target
> [...]
>> @@ -391,4 +396,32 @@ EOF
>> > > create_package "$dbg_packagename" "$dbg_dir"
>> fi
>>
>> +if [ "x$1" = "xdeb-pkg" ]
>> +then
>> + cat < debian/rules
>> +#!/usr/bin/make -f
>> +
>> +build:
>> +> > \$(MAKE) sourcename=${sourcename} KDEB_PKGVERSION=${packageversion}
> I don't think this needs to set any variables, though it shouldn't
> hurt.
Ok, I thought that make calls with different parameters might trigger
rebuild, but after some tests this doesn't seem the case. Cleaning up.
>> +binary-arch:
>> + \$(MAKE) sourcename=${sourcename} KDEB_PKGVERSION=${packageversion} bindeb-pkg
> [...]
> Shouldn't this be setting KDEB_SOURCENAME, not sourcename?
Like the variable name in comments, yes. Thanks for patient reviews.
Riku
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-09-02 8:09 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-01 13:48 [PATCH v4] deb-pkg: add source package riku.voipio
2015-09-01 23:26 ` Ben Hutchings
2015-09-02 8:09 ` Riku Voipio
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox