From patchwork Mon Mar 18 09:13:47 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Dawson X-Patchwork-Id: 228408 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from silver.osuosl.org (silver.osuosl.org [140.211.166.136]) by ozlabs.org (Postfix) with ESMTP id A9E232C00B4 for ; Mon, 18 Mar 2013 20:14:00 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 0E0B931012; Mon, 18 Mar 2013 09:13:57 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id c5WKgJMI66im; Mon, 18 Mar 2013 09:13:55 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id 005BC30B3D; Mon, 18 Mar 2013 09:13:54 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (whitealder.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 668938F753 for ; Mon, 18 Mar 2013 09:14:01 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id B533E89F30 for ; Mon, 18 Mar 2013 09:13:53 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id PzZY-2QWjxqi for ; Mon, 18 Mar 2013 09:13:52 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-we0-f181.google.com (mail-we0-f181.google.com [74.125.82.181]) by whitealder.osuosl.org (Postfix) with ESMTPS id 3555E899CD for ; Mon, 18 Mar 2013 09:13:52 +0000 (UTC) Received: by mail-we0-f181.google.com with SMTP id t44so4656747wey.40 for ; Mon, 18 Mar 2013 02:13:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:subject:date:message-id:x-mailer; bh=HjLYCT130gmxwGBLTEAnvubmDUakyP8egnvPJbBdTbc=; b=U2pGLnt+hRW86Rngfai7ZUSPPyNr98mu0AB/bmgEPJGLSqm5KEagK6uMw6vTSMsSxw tNTBxuVEUhH3jHKkY7l0Akeo6WIwiEKpUNqPF1KYtoO0QD9Vur0hI9aPrkIJ5zpXC56b jZbYJgG1r8c3crsXBKqu7477jBH+9l+s8j9QLWSNZTGKkH+y7JKW+XHk5D2bP44E1W4W pUHFtECjwgx8KzWKnZ+gTGDgna3z9ayrsMMsrolyuvFvQv7tQT2TJsMMwXWbXvm7QWdB mvQ/vLVAkXayiVDam8ZBeMvhZMjj2KCAEExXeUPJopEol4D4Ms10p8Ru+8L8G/Z4dn2l 6JwQ== X-Received: by 10.194.120.169 with SMTP id ld9mr23266252wjb.24.1363598030557; Mon, 18 Mar 2013 02:13:50 -0700 (PDT) Received: from localhost.localdomain (host86-167-129-159.range86-167.btcentralplus.com. [86.167.129.159]) by mx.google.com with ESMTPS id fv2sm13700720wib.6.2013.03.18.02.13.48 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 18 Mar 2013 02:13:49 -0700 (PDT) From: spdawson@gmail.com To: buildroot@busybox.net Date: Mon, 18 Mar 2013 09:13:47 +0000 Message-Id: <1363598027-25900-1-git-send-email-spdawson@gmail.com> X-Mailer: git-send-email 1.7.10.4 Subject: [Buildroot] [PATCH v3] rework patch model X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: buildroot-bounces@busybox.net From: Simon Dawson At the Buildroot Developers Meeting (4-5 February 2013, in Brussels) a change to the patch logic was discussed. See http://elinux.org/Buildroot:DeveloperDaysFOSDEM2013 for details. In summary: * For patches stored in the package directory, if package/// does exist, apply package///*.patch, otherwise, apply package//*.patch * For patches stored in the global patches directory, if $(GLOBAL_PATCH_DIR)/// does exist, apply $(GLOBAL_PATCH_DIR)///*.patch, otherwise, apply $(GLOBAL_PATCH_DIR)//*.patch This patch adds the new BR2_GLOBAL_PATCH_DIR configuration item, and reworks the generic package infrastructure to implement the new patch logic. Signed-off-by: Simon Dawson Acked-by: Thomas Petazzoni Tested-by: Thomas Petazzoni Acked-by: Samuel Martin --- v3: Wrap commit message properly; incoroporate changes to manual, as suggested by Samuel Martin v2: Add documentation, as suggested by Baruch Siach Config.in | 15 +++++++++++++++ docs/manual/customize-packages.txt | 23 +++++++++++++++++++++++ docs/manual/customize.txt | 2 ++ docs/manual/patch-policy.txt | 14 +++++++++++--- package/pkg-generic.mk | 16 ++++++++-------- 5 files changed, 59 insertions(+), 11 deletions(-) create mode 100644 docs/manual/customize-packages.txt diff --git a/Config.in b/Config.in index a2c305f..bbb9885 100644 --- a/Config.in +++ b/Config.in @@ -437,6 +437,21 @@ config BR2_PACKAGE_OVERRIDE_FILE as the source directory for a particular package. See the Buildroot documentation for more details on this feature. +config BR2_GLOBAL_PATCH_DIR + string "global patch directory" + help + You may specify a directory containing global package patches. + For a specific version of a specific package + , patches are applied as follows. + + First, the default Buildroot patch set for the package is applied. + + If the directory $(BR2_GLOBAL_PATCH_DIR)// + exists, then all *.patch files in the directory will be applied. + + Otherwise, if the directory $(BR2_GLOBAL_PATCH_DIR)/ exists, + then all *.patch files in the directory will be applied. + endmenu source "toolchain/Config.in" diff --git a/docs/manual/customize-packages.txt b/docs/manual/customize-packages.txt new file mode 100644 index 0000000..a71a7a3 --- /dev/null +++ b/docs/manual/customize-packages.txt @@ -0,0 +1,23 @@ +// -*- mode:doc -*- ; + +[[packages-custom]] +Customizing packages +~~~~~~~~~~~~~~~~~~~~ + +It is sometimes useful to apply 'extra' patches to packages - over and +above those provided in Buildroot. This might be used to support custom +features in a project, for example, or when working on a new architecture. + +The +BR2_GLOBAL_PATCH_DIR+ configuration file option can be +used to specify a directory containing global package patches. + +For a specific version of a specific package , +patches are applied as follows. + +First, the default Buildroot patch set for the package is applied. + +If the directory $(BR2_GLOBAL_PATCH_DIR)// +exists, then all *.patch files in the directory will be applied. + +Otherwise, if the directory $(BR2_GLOBAL_PATCH_DIR)/ exists, then +all *.patch files in the directory will be applied. diff --git a/docs/manual/customize.txt b/docs/manual/customize.txt index 3b1a5a7..0456ef1 100644 --- a/docs/manual/customize.txt +++ b/docs/manual/customize.txt @@ -15,3 +15,5 @@ include::customize-kernel-config.txt[] include::customize-toolchain.txt[] include::customize-store.txt[] + +include::customize-packages.txt[] diff --git a/docs/manual/patch-policy.txt b/docs/manual/patch-policy.txt index 0f55b26..d2250ad 100644 --- a/docs/manual/patch-policy.txt +++ b/docs/manual/patch-policy.txt @@ -11,8 +11,9 @@ necessary to patch the source of the software to get it cross-built within Buildroot. Buildroot offers an infrastructure to automatically handle this during -the builds. It supports two ways of applying patch sets: downloaded patches -and patches supplied within buildroot. +the builds. It supports three ways of applying patch sets: downloaded patches, +patches supplied within buildroot and patches located in a user-defined +global patch directory. Providing patches ~~~~~~~~~~~~~~~~~ @@ -45,6 +46,13 @@ application order. reference in their filename. - The field ++ in the patch file name refers to the 'apply order'. +Global patch directory +^^^^^^^^^^^^^^^^^^^^^^ + +The +BR2_GLOBAL_PATCH_DIR+ configuration file option can be +used to specify a directory containing global package patches. See +xref:packages-custom[] for details. + How patches are applied ~~~~~~~~~~~~~~~~~~~~~~~ @@ -57,7 +65,7 @@ How patches are applied tarballs are applied; . If there are some +*.patch+ files in the package directory or in the - a package subdirectory named +-+, then: + a package subdirectory named ++, then: + * If a +series+ file exists in the package directory, then patches are applied according to the +series+ file; diff --git a/package/pkg-generic.mk b/package/pkg-generic.mk index 8d964a1..afb90bf 100644 --- a/package/pkg-generic.mk +++ b/package/pkg-generic.mk @@ -82,21 +82,21 @@ endif # find the package directory (typically package/) and the # prefix of the patches $(BUILD_DIR)/%/.stamp_patched: NAMEVER = $(RAWNAME)-$($(PKG)_VERSION) +$(BUILD_DIR)/%/.stamp_patched: PATCH_BASE_DIRS = $($(PKG)_DIR_PREFIX)/$(RAWNAME) $(call qstrip,$(BR2_GLOBAL_PATCH_DIR))/$(RAWNAME) $(BUILD_DIR)/%/.stamp_patched: @$(call MESSAGE,"Patching $($(PKG)_DIR_PREFIX)/$(RAWNAME)") $(foreach hook,$($(PKG)_PRE_PATCH_HOOKS),$(call $(hook))$(sep)) $(foreach p,$($(PKG)_PATCH),support/scripts/apply-patches.sh $(@D) $(DL_DIR) $(p)$(sep)) $(Q)( \ - if test -d $($(PKG)_DIR_PREFIX)/$(RAWNAME); then \ - if test "$(wildcard $($(PKG)_DIR_PREFIX)/$(RAWNAME)/$(NAMEVER)*.patch*)"; then \ - support/scripts/apply-patches.sh $(@D) $($(PKG)_DIR_PREFIX)/$(RAWNAME) $(NAMEVER)\*.patch $(NAMEVER)\*.patch.$(ARCH) || exit 1; \ - else \ - support/scripts/apply-patches.sh $(@D) $($(PKG)_DIR_PREFIX)/$(RAWNAME) $(RAWNAME)\*.patch $(RAWNAME)\*.patch.$(ARCH) || exit 1; \ - if test -d $($(PKG)_DIR_PREFIX)/$(RAWNAME)/$(NAMEVER); then \ - support/scripts/apply-patches.sh $(@D) $($(PKG)_DIR_PREFIX)/$(RAWNAME)/$(NAMEVER) \*.patch \*.patch.$(ARCH) || exit 1; \ + for D in $(PATCH_BASE_DIRS); do \ + if test -d $${D}; then \ + if test -d $${D}/$($(PKG)_VERSION); then \ + support/scripts/apply-patches.sh $(@D) $${D}/$($(PKG)_VERSION) \*.patch \*.patch.$(ARCH) || exit 1; \ + else \ + support/scripts/apply-patches.sh $(@D) $${D} \*.patch \*.patch.$(ARCH) || exit 1; \ fi; \ fi; \ - fi; \ + done; \ ) $(foreach hook,$($(PKG)_POST_PATCH_HOOKS),$(call $(hook))$(sep)) $(Q)touch $@