From patchwork Tue Mar 20 23:04:47 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Korsgaard X-Patchwork-Id: 147878 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 6E057B6FA7 for ; Wed, 21 Mar 2012 10:32:55 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 0839610142D; Tue, 20 Mar 2012 23:32:54 +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 g5aZh9CmG1dC; Tue, 20 Mar 2012 23:32:46 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id AA92610112D; Tue, 20 Mar 2012 23:32:19 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from fraxinus.osuosl.org (fraxinus.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id A93628F75B for ; Tue, 20 Mar 2012 23:32:01 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id A1645100BC5 for ; Tue, 20 Mar 2012 23:32:01 +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 ocaZk3uoss+k for ; Tue, 20 Mar 2012 23:31:59 +0000 (UTC) Received: from busybox.osuosl.org (busybox.osuosl.org [140.211.167.224]) by fraxinus.osuosl.org (Postfix) with ESMTP id D030310076F for ; Tue, 20 Mar 2012 23:31:59 +0000 (UTC) Received: by busybox.osuosl.org (Postfix, from userid 4021) id CCAAE953F5; Tue, 20 Mar 2012 23:31:59 +0000 (UTC) From: Peter Korsgaard To: buildroot@busybox.net Date: Wed, 21 Mar 2012 00:04:47 +0100 X-Git-Refname: refs/heads/master X-Git-Oldrev: 1b58957a9637d3b3d1ae13ec26096d737fdd1a45 X-Git-Newrev: 4f9e82da2a7d30f7e9e39238a3a2f0bd021a7be4 Message-Id: <20120320233159.CCAAE953F5@busybox.osuosl.org> Subject: [Buildroot] [git commit] apply-patches.sh: change archive management 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 commit: http://git.buildroot.net/buildroot/commit/?id=4f9e82da2a7d30f7e9e39238a3a2f0bd021a7be4 branch: http://git.buildroot.net/buildroot/commit/?id=refs/heads/master The way archives were managed was incorrect because the uncompressed archives were sent directly to the patch command. It means that alphabetical patch order was not respected. Signed-off-by: Ludovic Desroches Tested-by: Ludovic Desroches with an armadeus_apf9328_defconfig build Acked-by: Thomas Petazzoni Tested-by: Thomas Petazzoni Signed-off-by: Peter Korsgaard --- support/scripts/apply-patches.sh | 48 +++++++++++++++++++++++++------------ 1 files changed, 32 insertions(+), 16 deletions(-) diff --git a/support/scripts/apply-patches.sh b/support/scripts/apply-patches.sh index 3d655f1..1f632aa 100755 --- a/support/scripts/apply-patches.sh +++ b/support/scripts/apply-patches.sh @@ -26,12 +26,10 @@ fi find ${builddir}/ '(' -name '*.rej' -o -name '.*.rej' ')' -print0 | \ xargs -0 -r rm -f -for i in `cd ${patchdir}; ls -d ${patchpattern} 2> /dev/null` ; do - apply="patch -g0 -p1 -E -d" - uncomp_parm="" - if [ -d "${patchdir}/$i" ] ; then - echo "${patchdir}/$i skipped" - else case "$i" in +function apply_patch { + path=$1 + patch=$2 + case "$patch" in *.gz) type="gzip"; uncomp="gunzip -dc"; ;; *.bz) @@ -42,22 +40,40 @@ for i in `cd ${patchdir}; ls -d ${patchpattern} 2> /dev/null` ; do type="zip"; uncomp="unzip -d"; ;; *.Z) type="compress"; uncomp="uncompress -c"; ;; - *.tgz) - type="tar gzip"; uncomp="gunzip -dc"; apply="tar xvf - -C"; ;; - *.tar) - type="tar"; uncomp="cat"; apply="tar xvf - -C"; ;; *) type="plaintext"; uncomp="cat"; ;; - esac fi + esac echo "" - echo "Applying ${i} using ${type}: " - echo ${i} >> ${builddir}/.applied_patches_list - ${uncomp} "${patchdir}/${i}" ${uncomp_parm} | ${apply} "${builddir}" + echo "Applying $patch using ${type}: " + echo $patch >> ${builddir}/.applied_patches_list + ${uncomp} "${path}/$patch" | patch -g0 -p1 -E -d "${builddir}" if [ $? != 0 ] ; then - echo "Patch failed! Please fix $i!" + echo "Patch failed! Please fix ${patch}!" exit 1 fi -done +} + +function scan_patchdir { + path=$1 + shift 1 + patches=${@-*} + + for i in `cd $path; ls -d $patches 2> /dev/null` ; do + if [ -d "${path}/$i" ] ; then + echo "${path}/$i skipped" + 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" + scan_patchdir "$unpackedarchivedir" + else + apply_patch "$path" "$i" || exit 1 + fi + done +} + +scan_patchdir $patchdir $patchpattern # Check for rejects... if [ "`find $builddir/ '(' -name '*.rej' -o -name '.*.rej' ')' -print`" ] ; then