From patchwork Fri Jan 16 21:45:37 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Olivari X-Patchwork-Id: 430015 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from arrakis.dune.hu (arrakis.dune.hu [78.24.191.176]) (using TLSv1.1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 5F756140185 for ; Sat, 17 Jan 2015 09:02:47 +1100 (AEDT) Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id A05D42890DB; Fri, 16 Jan 2015 23:00:15 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on arrakis.dune.hu X-Spam-Level: X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,T_DKIM_INVALID, T_RP_MATCHES_RCVD autolearn=unavailable version=3.3.2 Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id 98ACC2806D9 for ; Fri, 16 Jan 2015 23:00:10 +0100 (CET) X-policyd-weight: using cached result; rate: -8.5 Received: from wolverine01.qualcomm.com (wolverine01.qualcomm.com [199.106.114.254]) by arrakis.dune.hu (Postfix) with ESMTPS for ; Fri, 16 Jan 2015 23:00:10 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=qca.qualcomm.com; i=@qca.qualcomm.com; q=dns/txt; s=qcdkim; t=1421445747; x=1452981747; h=from:to:cc:subject:date:message-id:mime-version; bh=5AhE3Xb/OWM8yHIRNXsk2VmTz6Yv6KRKOJ9jnqZo80w=; b=SDCmVaPIcKNymKF1uXA8xBACE5ROeFa6SFAsU6UZtWe2F0ix++udBqE9 v9uZRPNSaIRPJnkzja+v+/PFHsOvCi+0pKpR2wzfBw1xyQZDEKE2+HWKH 6TDleDwbOSUjDNyiGuj67+PVMq/eNFV/heSzDRawZ+tvfNWChOf6aKAw1 o=; X-IronPort-AV: E=McAfee;i="5600,1067,7683"; a="98644994" Received: from ironmsg05-lv.qualcomm.com ([10.47.202.182]) by wolverine01.qualcomm.com with ESMTP; 16 Jan 2015 14:02:25 -0800 X-IronPort-AV: E=Sophos;i="5.09,413,1418112000"; d="scan'208";a="26712572" Received: from nalasexr01g.na.qualcomm.com ([10.49.56.53]) by ironmsg05-lv.qualcomm.com with ESMTP/TLS/RC4-SHA; 16 Jan 2015 14:02:24 -0800 Received: from mathieu-linux.qualcomm.com (10.80.80.8) by NALASEXR01G.na.qualcomm.com (10.49.56.53) with Microsoft SMTP Server (TLS) id 15.0.995.29; Fri, 16 Jan 2015 14:02:23 -0800 From: Mathieu Olivari To: Date: Fri, 16 Jan 2015 13:45:37 -0800 Message-ID: <1421444737-1495-1-git-send-email-mathieu@qca.qualcomm.com> X-Mailer: git-send-email 1.7.10.4 MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanexm01a.na.qualcomm.com (10.85.0.81) To NALASEXR01G.na.qualcomm.com (10.49.56.53) Subject: [OpenWrt-Devel] [PATCH] build: allow openwrt.git packages to be replaced by feeds X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: openwrt-devel-bounces@lists.openwrt.org Sender: "openwrt-devel" Currently, replacing a package available in openwrt.git requires modifications in openwrt.git, or requires duplicating the package in a feed but with a different name, which causes all kind of problems related to dependencies (all packages selecting it would have to be modified accordingly to select the new package). With this change, if a package with the same name is present both in feeds/ and package/ folders, the one in feeds/ will override the one in package/, both in the menuconfig and during the build. This mechanism is particularly useful for vendor tree, or in general for application which needs to replace one particular package which exists within openwrt.git by a custom/newer version. Signed-off-by: Mathieu Olivari --- include/scan.awk | 17 +++++++++++++++++ include/scan.mk | 2 +- scripts/feeds | 9 ++++++--- 3 files changed, 24 insertions(+), 4 deletions(-) create mode 100644 include/scan.awk diff --git a/include/scan.awk b/include/scan.awk new file mode 100644 index 0000000..39b2977 --- /dev/null +++ b/include/scan.awk @@ -0,0 +1,17 @@ +BEGIN { FS="/" } +$1 ~ /^feeds/ { FEEDS[$NF]=$0 } +$1 !~ /^feeds/ { PKGS[$NF]=$0 } +END { + # Filter-out OpenWrt packages which have a feeds equivalent + for (pkg in PKGS) + if (pkg in FEEDS) + delete PKGS[pkg] + n = asort(PKGS) + for (i=1; i <= n; i++) { + print PKGS[i] + } + n = asort(FEEDS) + for (i=1; i <= n; i++){ + print FEEDS[i] + } +} diff --git a/include/scan.mk b/include/scan.mk index 0998333..138707d 100644 --- a/include/scan.mk +++ b/include/scan.mk @@ -43,7 +43,7 @@ endef $(FILELIST): rm -f $(TMP_DIR)/info/.files-$(SCAN_TARGET)-* - $(call FIND_L, $(SCAN_DIR)) $(SCAN_EXTRA) -mindepth 1 $(if $(SCAN_DEPTH),-maxdepth $(SCAN_DEPTH)) -name Makefile | xargs grep -HE 'call (Build/DefaultTargets|Build(Package|Target)|.+Package)' | sed -e 's#^$(SCAN_DIR)/##' -e 's#/Makefile:.*##' | uniq > $@ + $(call FIND_L, $(SCAN_DIR)) $(SCAN_EXTRA) -mindepth 1 $(if $(SCAN_DEPTH),-maxdepth $(SCAN_DEPTH)) -name Makefile | xargs grep -HE 'call (Build/DefaultTargets|Build(Package|Target)|.+Package)' | sed -e 's#^$(SCAN_DIR)/##' -e 's#/Makefile:.*##' | uniq | awk -f include/scan.awk > $@ $(TMP_DIR)/info/.files-$(SCAN_TARGET).mk: $(FILELIST) ( \ diff --git a/scripts/feeds b/scripts/feeds index 31ad544..01d9041 100755 --- a/scripts/feeds +++ b/scripts/feeds @@ -384,12 +384,15 @@ sub install_package { # previously installed packages set the runtime package # newly installed packages set the source package - $installed{$src} and return 0; + $installed{$src} and !is_core_package($src) and return 0; # check previously installed packages - $installed{$name} and return 0; + $installed{$name} and !is_core_package($name) and return 0; $installed{$src} = 1; - warn "Installing package '$src'\n"; + + is_core_package($src) + and warn "Overriding package '$src'\n" + or warn "Installing package '$src'\n"; $install_method{$type} or do { warn "Unknown installation method: '$type'\n";