From patchwork Fri Apr 1 20:25:29 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yann E. MORIN" X-Patchwork-Id: 605010 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ozlabs.org (Postfix) with ESMTP id 3qcCYz3dbDz9sD5 for ; Sat, 2 Apr 2016 07:25:43 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=hHkuuMxh; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 9C925A6358; Fri, 1 Apr 2016 20:25:42 +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 VW79Vfp_ZSPM; Fri, 1 Apr 2016 20:25:42 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id E5998A6392; Fri, 1 Apr 2016 20:25:39 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id CA0FE1C0B41 for ; Fri, 1 Apr 2016 20:25:37 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id C16FBA637A for ; Fri, 1 Apr 2016 20:25:37 +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 Q1K_EVCJWmbW for ; Fri, 1 Apr 2016 20:25:36 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wm0-f65.google.com (mail-wm0-f65.google.com [74.125.82.65]) by fraxinus.osuosl.org (Postfix) with ESMTPS id 4643EA60DF for ; Fri, 1 Apr 2016 20:25:36 +0000 (UTC) Received: by mail-wm0-f65.google.com with SMTP id 20so933493wmh.3 for ; Fri, 01 Apr 2016 13:25:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=7l0Gqh/SIz9Eu7m/v26G7uE7TctKj7Y34qmLlUMC7FE=; b=hHkuuMxhCr33KlhB6H3kCNDcUIPOkpRFMXpdE/duvPY31z/SaXhWG9/H6qdPG/orLD HHnqLfPXXpmZBqqnvSW736A4tosfAM0md8EqMRlCzW3oGghTKx+/7CfRhKraORBlnTwf AbSQfsNcNEsiIUnDI3Wf8+gsjA0Oxt/Ou4CqImXmZPjEbKzMk0RRtyNSw0YI5oBrz5EX gkbw74El+wx4TSCMrF+JeDPR0gb+RkngGfui2t2bg5TxVAHHvBM0WhWmiW63OUZHKLhu 0y/3tgwabPtVaJm0DaZ/r18i8+oyAW+ZMeWj/ExJKF9OlkU1CN/4T8hN5Y1RUJknR7TT ruXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=7l0Gqh/SIz9Eu7m/v26G7uE7TctKj7Y34qmLlUMC7FE=; b=GRUAvhv8qcoxHXT/K0oqM9nOEN4maT8J5Q3nlI1vMd3PP8rZc+xvOs/Z+Obvrxp49c AlNG2iIl1ULKdMpeyjdUI06HfHggUQRUn5lF1mk1A89Ld3+hkZ8MySNkVO+wRNlaRinC ufMD/6yQrZSR2zBZkfqe+r/zVZ5lSBnCZ6eEHpHq5bBxN6EgAgCdcUTiXS6cj07eRHfs r3XDMKg1FzKvKhehlrds3QxlaEel3tkLCDsuVz3mny6uu8X2lLjqDZs8xqpmzp4RPLSa /J8cvnrxS4gky+UBLKDGiFIMIoRgaS+CRhK/3+Qv5+wbpBsWUi/h0E8QS2am9U8qFX3e c39Q== X-Gm-Message-State: AD7BkJIxURg4PwZL2lccjdEtPKGjn2Ij8Fws+RP08KobRWJvYIfVOpL7QoovQJS54lSzCg== X-Received: by 10.28.45.132 with SMTP id t126mr528344wmt.86.1459542334906; Fri, 01 Apr 2016 13:25:34 -0700 (PDT) Received: from gourin.bzh.lan (ns304657.ip-46-105-103.eu. [46.105.103.66]) by smtp.gmail.com with ESMTPSA id w203sm559814wmg.14.2016.04.01.13.25.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 01 Apr 2016 13:25:34 -0700 (PDT) From: "Yann E. MORIN" To: buildroot@buildroot.org Date: Fri, 1 Apr 2016 22:25:29 +0200 Message-Id: <5a6f95aea1aac633ba580a190c833d45005ea918.1459541702.git.yann.morin.1998@free.fr> X-Mailer: git-send-email 1.9.1 In-Reply-To: References: Cc: "Yann E. MORIN" Subject: [Buildroot] [PATCH 2/4 v2] support/download/git: do not use git archive, handle it manually 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: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" We currently use git-archive to generate the tarball. This is all handy and dandy, but git-archive does not support submodules. In the follow-up patch, we're going to handle submodules, so we would not be able to use git-archive. Instead, we manually generate the archive: - extract the tree to the requested cset, - get the date of the commit to store in the archive, - store only numeric owners, - store owner and group as 0 (zero, although any arbitrary value would have been fine, as long as it's a constant), - sort the files to store in the archive. We also get rid of the .git directory, because there is no reason to keep it in the context of Buildroot. Some people would love to keep it so as to speed up later downloads when updating a package, but that is not really doable. For example: - use current Buildroot - it would need foo-12345, so do a clone and keep the .git in the generated tarball - update Buildroot - it would need foo-98765 For that second clone, how could we know we would have to first extract foo-12345 ? So, the .git in the archive is pretty much useless for Buildroot. Signed-off-by: "Yann E. MORIN" Tested-by: Matt Weber Reviewed-by: Matt Weber --- support/download/git | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/support/download/git b/support/download/git index 20b436e..5672217 100755 --- a/support/download/git +++ b/support/download/git @@ -65,9 +65,17 @@ if ! _git fetch "'${cset}:${cset}'" >/dev/null 2>&1; then printf "Could not fetch special ref '%s'; assuming it is not special.\n" "${cset}" fi -_git archive --prefix="'${basename}/'" -o "'${output}.tmp'" --format=tar "'${cset}'" +# Checkout the required changeset. +_git checkout -q "'${cset}'" + +# Get date of commit to generate a reproducible archive. +date="$( _git show --no-patch --pretty=format:%cD )" + +# We do not need the .git dir to generate the tarball +rm -rf .git -# Not really required, but here for consistency popd >/dev/null +tar cf - --numeric-owner --owner=0 --group=0 --mtime="${date}" \ + -T <(find "${basename}" -not -type d |sort) >"${output}.tmp" gzip -n <"${output}.tmp" >"${output}"