From patchwork Mon Nov 21 14:48:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jonathan Toppins X-Patchwork-Id: 13051235 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5503AC433FE for ; Mon, 21 Nov 2022 15:00:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230396AbiKUPAb (ORCPT ); Mon, 21 Nov 2022 10:00:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57892 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230481AbiKUPAM (ORCPT ); Mon, 21 Nov 2022 10:00:12 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0EE89D328E for ; Mon, 21 Nov 2022 06:49:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1669042140; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=8s15f6YbiNJZ1KFlIgHMjRgcF6TQvT9XGT2eZS0P2qA=; b=FRzc2VNbMyovRx7EE+ENsa6BSs7fI44khl4LAxiHlF5toxrKZzhPUGWNjSZE3/PGbNW9LY dIjgen+Gs/EfBwrMDjNXbGn5Lvtarb17xp+73QDs5aaR7Cd+etlY9/zGB43PfKeBbmCEDd D8MphS2aqv/1hgjcoufg1XW3A1HWZlw= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-70-IAA0qnkINS2XAe7m2x-rvg-1; Mon, 21 Nov 2022 09:48:59 -0500 X-MC-Unique: IAA0qnkINS2XAe7m2x-rvg-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A01F51C008A5; Mon, 21 Nov 2022 14:48:58 +0000 (UTC) Received: from jtoppins.rdu.csb (unknown [10.22.10.102]) by smtp.corp.redhat.com (Postfix) with ESMTP id 84BFE2027062; Mon, 21 Nov 2022 14:48:57 +0000 (UTC) From: Jonathan Toppins To: linux-kbuild@vger.kernel.org Cc: masahiroy@kernel.org, dzickus@redhat.com, ihuguet@redhat.com, ivecera@redhat.com, jtoppins@redhat.com, jtornosm@redhat.com, kheib@redhat.com, linux-kernel@vger.kernel.org, michal.lkml@markovi.net, ndesaulniers@google.com, Nathan Chancellor , Nicolas Schier Subject: [PATCH next v2] kbuild: add ability to make source rpm buildable using koji Date: Mon, 21 Nov 2022 09:48:45 -0500 Message-Id: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org From: Ivan Vecera Changes: - added new target 'srcrpm-pkg' to generate source rpm - added required build tools to spec file - removed locally compiled host tools to force their re-compile Signed-off-by: Ivan Vecera Signed-off-by: Jonathan Toppins Acked-by: Íñigo Huguet Tested-by: Ivan Vecera --- Notes: v2: * updated UTS_MACHINE to be $(UTS_MACHINE)-linux suggested by Masahiro Yamada scripts/Makefile.package | 10 ++++++++++ scripts/package/mkspec | 7 +++++++ 2 files changed, 17 insertions(+) diff --git a/scripts/Makefile.package b/scripts/Makefile.package index 8bbcced67c22..1290f1c631fb 100644 --- a/scripts/Makefile.package +++ b/scripts/Makefile.package @@ -62,6 +62,16 @@ rpm-pkg: +rpmbuild $(RPMOPTS) --target $(UTS_MACHINE)-linux -ta $(KERNELPATH).tar.gz \ --define='_smp_mflags %{nil}' +# srcrpm-pkg +# --------------------------------------------------------------------------- +PHONY += srcrpm-pkg +srcrpm-pkg: + $(MAKE) clean + $(CONFIG_SHELL) $(MKSPEC) >$(objtree)/kernel.spec + $(call cmd,src_tar,$(KERNELPATH),kernel.spec) + +rpmbuild $(RPMOPTS) --target $(UTS_MACHINE)-linux -ts $(KERNELPATH).tar.gz \ + --define='_smp_mflags %{nil}' --define='_srcrpmdir $(srctree)' + # binrpm-pkg # --------------------------------------------------------------------------- PHONY += binrpm-pkg diff --git a/scripts/package/mkspec b/scripts/package/mkspec index 70392fd2fd29..dda00a948a01 100755 --- a/scripts/package/mkspec +++ b/scripts/package/mkspec @@ -33,6 +33,8 @@ EXCLUDES="$RCS_TAR_IGNORE --exclude=*vmlinux* --exclude=*.mod \ --exclude=*.o --exclude=*.ko --exclude=*.cmd --exclude=Documentation \ --exclude=.config.old --exclude=.missing-syscalls.d --exclude=*.s" +test -n "$LOCALVERSION" && MAKE="$MAKE LOCALVERSION=$LOCALVERSION" + # We can label the here-doc lines for conditional output to the spec file # # Labels: @@ -49,6 +51,9 @@ sed -e '/^DEL/d' -e 's/^\t*//' <