From patchwork Sun May 24 17:50:03 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hannu Nyman X-Patchwork-Id: 475985 X-Patchwork-Delegate: jow@openwrt.org 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.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 977871401B5 for ; Mon, 25 May 2015 03:50:31 +1000 (AEST) Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id D20EA281084; Sun, 24 May 2015 19:48:52 +0200 (CEST) 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 autolearn=unavailable version=3.3.2 Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id DF955280660 for ; Sun, 24 May 2015 19:48:46 +0200 (CEST) X-policyd-weight: using cached result; rate: -5.5 Received: from filtteri5.pp.htv.fi (filtteri5.pp.htv.fi [213.243.153.188]) by arrakis.dune.hu (Postfix) with ESMTP for ; Sun, 24 May 2015 19:48:46 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by filtteri5.pp.htv.fi (Postfix) with ESMTP id BEA965A7012 for ; Sun, 24 May 2015 20:49:57 +0300 (EEST) X-Virus-Scanned: Debian amavisd-new at pp.htv.fi Received: from smtp6.welho.com ([213.243.153.40]) by localhost (filtteri5.pp.htv.fi [213.243.153.188]) (amavisd-new, port 10024) with ESMTP id UeczSk0pJQ0u for ; Sun, 24 May 2015 20:49:51 +0300 (EEST) Received: from [192.168.1.180] (87-92-23-160.bb.dnainternet.fi [87.92.23.160]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by smtp6.welho.com (Postfix) with ESMTPS id 52A115BC003 for ; Sun, 24 May 2015 20:50:04 +0300 (EEST) To: OpenWrt Development List From: Hannu Nyman Message-ID: <55620F4B.5020502@iki.fi> Date: Sun, 24 May 2015 20:50:03 +0300 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Thunderbird/40.0a2 MIME-Version: 1.0 Subject: [OpenWrt-Devel] [PATCH] scripts/feeds: return error status from feed updating (alternative approach) 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" scripts/feeds: return error status from feed update This patch is a modified version of the patch being discussed at here: https://patchwork.ozlabs.org/patch/471303/ from Martin Strbacka My version modifies scripts/feeds so that an error with one of the feeds just raises the error flag, but script continues and tries to update the other feeds. After all feeds have been updated, the script returns 1 if at least one feed failed, and 0 on success with all feeds. The user can then utilise the status in his build script, if he wants. signed-off-by: Hannu Nyman Index: scripts/feeds =================================================================== --- scripts/feeds (revision 45743) +++ scripts/feeds (working copy) @@ -687,6 +687,7 @@ my %opts; my $feed_name; my $perform_update=1; + my $failed=0; $ENV{SCAN_COOKIE} = $$; $ENV{OPENWRT_VERBOSE} = 's'; @@ -711,8 +712,7 @@ if ( ($#ARGV == -1) or $opts{a}) { foreach my $feed (@feeds) { my ($type, $name, $src) = @$feed; - next unless update_feed($type, $name, $src, $perform_update) == 1; - last; + update_feed($type, $name, $src, $perform_update) == 0 or $failed=1; } } else { while ($feed_name = shift @ARGV) { @@ -721,7 +721,7 @@ if($feed_name ne $name) { next; } - update_feed($type, $name, $src, $perform_update); + update_feed($type, $name, $src, $perform_update) == 0 or $failed=1; } } } @@ -728,7 +728,7 @@ refresh_config(); - return 0; + return $failed; } sub feed_config() {