From patchwork Sat Mar 16 20:49:02 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Dawson X-Patchwork-Id: 228252 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from fraxinus.osuosl.org (fraxinus.osuosl.org [140.211.166.137]) by ozlabs.org (Postfix) with ESMTP id D89342C00B0 for ; Sun, 17 Mar 2013 07:54:38 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 9D39EFFFC2; Sat, 16 Mar 2013 20:54:22 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id puHbUCuQTBWI; Sat, 16 Mar 2013 20:54:03 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id D7FC2103B7F; Sat, 16 Mar 2013 20:49:59 +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 C76B98F74B for ; Sat, 16 Mar 2013 20:50:20 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 3E7428B5F9 for ; Sat, 16 Mar 2013 20:50:13 +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 8wJH+QiXrlG7 for ; Sat, 16 Mar 2013 20:50:11 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-we0-f170.google.com (mail-we0-f170.google.com [74.125.82.170]) by whitealder.osuosl.org (Postfix) with ESMTPS id 4C3CA861C8 for ; Sat, 16 Mar 2013 20:50:11 +0000 (UTC) Received: by mail-we0-f170.google.com with SMTP id z53so3883880wey.15 for ; Sat, 16 Mar 2013 13:50:09 -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=U4BU5Zu71qR3oBNIB/Tcb+FmSVuvzdZBQnAFXE9xR44=; b=LUILdKNu8waUhc0PkRLSYOsLU9O4UrBtUAyeKL4mymn7AJqM/Gbj5ID35HbpUC+2Vg BijyXdx41nYm2s03v+N4vkSx3s/OSgrtDSJnt2mmV2MycDaDjM0QJ11rOJLZ/OQcFVmD mLWeRXzHRC6n1+opX2F7/EbOZsgGlHNhtyH9TsvQ5i387bhyWxLAeIMHGHl2WcWqo4tZ qASqrYCRK21t5oE62Oo57WDUQIFAGCj8fCOr0iyd4hua7Yw7Eo5zSzKQ6xE7iIkDs6Vo 1z8bYm+f4q5b0O4eZSFZKaWDLv8REcdLq3TgMgC/hRbvxtDsKTSTN8jIRf904HUj5OAl bKKg== X-Received: by 10.180.19.39 with SMTP id b7mr9410506wie.15.1363467009453; Sat, 16 Mar 2013 13:50:09 -0700 (PDT) Received: from localhost.localdomain (host-84-13-110-38.opaltelecom.net. [84.13.110.38]) by mx.google.com with ESMTPS id c15sm5736593wiw.3.2013.03.16.13.50.07 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 16 Mar 2013 13:50:08 -0700 (PDT) From: spdawson@gmail.com To: buildroot@busybox.net Date: Sat, 16 Mar 2013 20:49:02 +0000 Message-Id: <1363466942-21510-1-git-send-email-spdawson@gmail.com> X-Mailer: git-send-email 1.7.10.4 Subject: [Buildroot] [PATCH] 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 --- Config.in | 7 +++++++ package/pkg-generic.mk | 16 ++++++++-------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/Config.in b/Config.in index a2c305f..3008374 100644 --- a/Config.in +++ b/Config.in @@ -437,6 +437,13 @@ 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. + Note that any global patches for a package will be applied AFTER + the default Buildroot patch set for the package. + endmenu source "toolchain/Config.in" diff --git a/package/pkg-generic.mk b/package/pkg-generic.mk index 57b0fd0..db0b025 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 $@