From patchwork Wed Mar 21 13:26:27 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: ludovic.desroches@atmel.com X-Patchwork-Id: 147965 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 A86A1B6EE7 for ; Wed, 21 Mar 2012 22:27:29 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 00E7B26AF4; Wed, 21 Mar 2012 11:27:28 +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 5uQScXJ-l4S1; Wed, 21 Mar 2012 11:27:23 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id F02CA26B33; Wed, 21 Mar 2012 11:27:22 +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 258198F75B for ; Wed, 21 Mar 2012 11:27:20 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id C597D8D117 for ; Wed, 21 Mar 2012 11:27:19 +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 mI3ecMyV7onB for ; Wed, 21 Mar 2012 11:27:18 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from sjogate2.atmel.com (newsmtp5.atmel.com [204.2.163.5]) by whitealder.osuosl.org (Postfix) with ESMTP id 452028D119 for ; Wed, 21 Mar 2012 11:27:18 +0000 (UTC) Received: from meyreuil.atmel.fr ([10.159.254.132]) by sjogate2.atmel.com (8.13.6/8.13.6) with ESMTP id q2LBN38k018418; Wed, 21 Mar 2012 04:23:04 -0700 (PDT) Received: from ibiza..rfo.atmel.com ([10.159.245.197]) by meyreuil.atmel.fr (8.11.7p1+Sun/8.11.7) with ESMTP id q2LBRBq19898; Wed, 21 Mar 2012 12:27:11 +0100 (MET) From: ludovic.desroches@atmel.com To: buildroot@busybox.net, jacmet@uclibc.org Date: Wed, 21 Mar 2012 14:26:27 +0100 Message-Id: <1332336387-3434-2-git-send-email-ludovic.desroches@atmel.com> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1332336387-3434-1-git-send-email-ludovic.desroches@atmel.com> References: <87k42e5nt8.fsf@macbook.be.48ers.dk> <1332336387-3434-1-git-send-email-ludovic.desroches@atmel.com> Cc: thomas.petazzoni@free-electrons.com, nicolas.ferre@atmel.com Subject: [Buildroot] [PATCH] apply-patches.sh: add recursivity when scanning patchdir 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: Ludovic Desroches Recursivity is needed with some tarballs containing debian patches: . debian changelog control patches 02-COPYRIGHT.patch [...] Since we can find some files which are not patches in those directories, only consider .patch* and .diff* files as valid patches. Due to recursivity, strip-components option is no more necessary so it has been removed. Signed-off-by: Ludovic Desroches --- support/scripts/apply-patches.sh | 12 +++++++++--- 1 files changed, 9 insertions(+), 3 deletions(-) diff --git a/support/scripts/apply-patches.sh b/support/scripts/apply-patches.sh index 968e2a4..e4b98bc 100755 --- a/support/scripts/apply-patches.sh +++ b/support/scripts/apply-patches.sh @@ -40,8 +40,14 @@ function apply_patch { type="zip"; uncomp="unzip -d"; ;; *.Z) type="compress"; uncomp="uncompress -c"; ;; + *.diff*) + type="diff"; uncomp="cat"; ;; + *.patch*) + type="patch"; uncomp="cat"; ;; *) - type="plaintext"; uncomp="cat"; ;; + echo "Unsupported format file for ${patch}, skip it"; + return 0; + ;; esac echo "" echo "Applying $patch using ${type}: " @@ -67,12 +73,12 @@ function scan_patchdir { else for i in `cd $path; ls -d $patches 2> /dev/null` ; do if [ -d "${path}/$i" ] ; then - echo "${path}/$i skipped" + scan_patchdir "${path}/$i" elif echo "$i" | grep -q -E "\.tar(\..*)?$|\.tbz2?$|\.tgz$" ; then unpackedarchivedir="$builddir/.patches-$(basename $i)-unpacked" rm -rf "$unpackedarchivedir" 2> /dev/null mkdir "$unpackedarchivedir" - tar -C "$unpackedarchivedir" --strip-components=1 -xaf "${path}/$i" + tar -C "$unpackedarchivedir" -xaf "${path}/$i" scan_patchdir "$unpackedarchivedir" else apply_patch "$path" "$i" || exit 1