From patchwork Wed Sep 2 09:57:24 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 7110281 Return-Path: X-Original-To: patchwork-linux-kbuild@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 6C69A9F1CD for ; Wed, 2 Sep 2015 09:57:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4C99920661 for ; Wed, 2 Sep 2015 09:57:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CD0D8205EF for ; Wed, 2 Sep 2015 09:57:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752194AbbIBJ52 (ORCPT ); Wed, 2 Sep 2015 05:57:28 -0400 Received: from mail-lb0-f175.google.com ([209.85.217.175]:35315 "EHLO mail-lb0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752023AbbIBJ51 (ORCPT ); Wed, 2 Sep 2015 05:57:27 -0400 Received: by lbpo4 with SMTP id o4so2895140lbp.2 for ; Wed, 02 Sep 2015 02:57:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=grH6Fgiyi/ASUYqV0gKHb6bAZ7wyiguQok83tY8XcUE=; b=C5kG7z6c9VdV8QXtpG21qrXdhwTDPj/mNy17PaD2Hk0kLv/TdgUP51a28JQ5Br3snq kGc9Zwubg90xkI+xy3ef6g0fephEYUmJd4cAIvbLH+c3CJ40P/i0O1uGmHRqZ0ZQFi3Y P2X6prSE2TvrSaAYo9/M2aPl6tzJg35NDpgCkOLJybr/u2e/REa9xY8mzKD8jjDuCcuq 2Y7BdLTY6JfXxA2u9se3lcV90JnhnnlcfFDrsGFLpiiB+bWAvVmDC0t4FK3cN7NfoiEO 9v0spSZ2yZpOVwcf5YS+D6ccaPcnM7GXLwtyXgA6OrXY+fD232ZZVxNROopMREY2min/ hzDQ== X-Gm-Message-State: ALoCoQk5rvwU3F7rq1xzLy/OMjqSWzpQrXEi7lyMcdXQNWGh/i0olAEVFGYNz0cJKh/5Bc3eg11v X-Received: by 10.152.198.140 with SMTP id jc12mr6317936lac.19.1441187845867; Wed, 02 Sep 2015 02:57:25 -0700 (PDT) Received: from localhost.localdomain (91-157-196-38.elisa-laajakaista.fi. [91.157.196.38]) by smtp.gmail.com with ESMTPSA id kk2sm5413024lbc.18.2015.09.02.02.57.24 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 02 Sep 2015 02:57:24 -0700 (PDT) From: riku.voipio@linaro.org To: linux-kbuild@vger.kernel.org, mmarek@suse.cz Cc: Riku Voipio , Chris J Arges , maximilian attems , Ben Hutchings Subject: [PATCH v5] deb-pkg: add source package Date: Wed, 2 Sep 2015 12:57:24 +0300 Message-Id: <1441187844-10660-1-git-send-email-riku.voipio@linaro.org> X-Mailer: git-send-email 2.4.6 Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Riku Voipio 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 KDEB_SOURCENAME enviroment variable. The source package is useful for GPL compliance, or for feeding to a automated debian package builder. Cc: Chris J Arges Cc: maximilian attems Cc: Ben Hutchings Signed-off-by: Riku Voipio Reviewed-by: Ben Hutchings Reviewed-by: maximilian attems --- v5: - fix variable typo - clean tmp dirs in clean: target 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 | 38 ++++++++++++++++++++++++++++++++++++-- 2 files changed, 49 insertions(+), 6 deletions(-) diff --git a/scripts/package/Makefile b/scripts/package/Makefile index 297e756..1aca224 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*) @@ -83,11 +85,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/ @@ -132,8 +140,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..0cd46e1 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 < 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 < 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,33 @@ EOF create_package "$dbg_packagename" "$dbg_dir" fi +if [ "x$1" = "xdeb-pkg" ] +then + cat < debian/rules +#!/usr/bin/make -f + +build: + \$(MAKE) + +binary-arch: + \$(MAKE) KDEB_SOURCENAME=${sourcename} KDEB_PKGVERSION=${packageversion} bindeb-pkg + +clean: + rm -rf debian/*tmp + 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