From patchwork Thu Nov 19 10:36:04 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?SsOpcsO0bWUgUG91aWxsZXI=?= X-Patchwork-Id: 546379 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ozlabs.org (Postfix) with ESMTP id 6E448141474 for ; Thu, 19 Nov 2015 21:36:29 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id A281C87786; Thu, 19 Nov 2015 10:36:28 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id A4s1aisOU5G2; Thu, 19 Nov 2015 10:36:26 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id 7E2F68676D; Thu, 19 Nov 2015 10:36:26 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id C25711C1E4F for ; Thu, 19 Nov 2015 10:36:24 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id BC13B8BF6C for ; Thu, 19 Nov 2015 10:36:24 +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 Tv9SPoBUdTcL for ; Thu, 19 Nov 2015 10:36:23 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from lupi.sysmic.org (sysmic.org [62.210.89.17]) by whitealder.osuosl.org (Postfix) with ESMTPS id 6A4828BF67 for ; Thu, 19 Nov 2015 10:36:23 +0000 (UTC) Received: from localhost.localdomain (unknown [212.234.226.241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: jezz) by lupi.sysmic.org (Postfix) with ESMTPSA id 7695F42F4A; Thu, 19 Nov 2015 11:36:21 +0100 (CET) From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Pouiller?= To: buildroot@busybox.net Date: Thu, 19 Nov 2015 11:36:04 +0100 Message-Id: <1447929366-8972-4-git-send-email-jezz@sysmic.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1447929366-8972-1-git-send-email-jezz@sysmic.org> References: <1447929366-8972-1-git-send-email-jezz@sysmic.org> MIME-Version: 1.0 Cc: =?UTF-8?q?J=C3=A9r=C3=B4me=20Pouiller?= Subject: [Buildroot] [PATCH 3/5] pkg-generic: allow to populate build directory from a git archive X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" Signed-off-by: Jérôme Pouiller --- package/pkg-generic.mk | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/package/pkg-generic.mk b/package/pkg-generic.mk index 08f4f31..846d8e9 100644 --- a/package/pkg-generic.mk +++ b/package/pkg-generic.mk @@ -515,12 +515,26 @@ $(2)_TARGET_SOURCE = $$($(2)_DIR)/.stamp_downloaded $(2)_TARGET_DIRCLEAN = $$($(2)_DIR)/.stamp_dircleaned # default extract command +ifdef $(2)_SOURCE +ifeq ($$(filter %.git.tar.gz,$$($(2)_SOURCE)),) $(2)_EXTRACT_CMDS ?= \ - $$(if $$($(2)_SOURCE),$$(INFLATE$$(suffix $$($(2)_SOURCE))) $$(DL_DIR)/$$($(2)_SOURCE) | \ + $$(INFLATE$$(suffix $$($(2)_SOURCE))) $$(DL_DIR)/$$($(2)_SOURCE) | \ $$(TAR) --strip-components=$$($(2)_STRIP_COMPONENTS) \ -C $$($(2)_DIR) \ $$(foreach x,$$($(2)_EXCLUDES),--exclude='$$(x)' ) \ - $$(TAR_OPTIONS) -) + $$(TAR_OPTIONS) - +else +# $(2)_STRIP_COMPONENTS != 1 and $(2)_EXCLUDES are not supported +$(2)_EXTRACT_CMDS ?= \ + mkdir -p $$($(2)_DIR)/.git && \ + $$(INFLATE$$(suffix $$($(2)_SOURCE))) $$(DL_DIR)/$$($(2)_SOURCE) | \ + $$(TAR) --strip-components=1 \ + -C $$($(2)_DIR)/.git \ + $$(TAR_OPTIONS) - && \ + $(GIT) -C $$($(2)_DIR) config --local --bool core.bare false && \ + $(GIT) -C $$($(2)_DIR) reset --hard +endif +endif # pre/post-steps hooks $(2)_PRE_DOWNLOAD_HOOKS ?=