[OpenWrt-Devel] [PATCH] scripts/feeds: Return non-zero return code if updating of a feed failed.

Martin Strbacka martin.strbacka at nic.cz
Tue May 12 08:49:01 EDT 2015


Hello,
I found out that if I make a mistake in a branch or commit expression in the feeds.conf file the updating procedure fails silently. This patch fixes this behavior and returns error code 1 if something went wrong.

Best Regards,
Martin Strbačka

Signed-off-by: Martin Strbacka <martin.strbacka at nic.cz>
---
 scripts/feeds | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/scripts/feeds b/scripts/feeds
index 89cb5a2..ece9bb0 100755
--- a/scripts/feeds
+++ b/scripts/feeds
@@ -687,6 +687,7 @@ sub update {
 	my %opts;
 	my $feed_name;
 	my $perform_update=1;
+	my $failed=0;
 
 	$ENV{SCAN_COOKIE} = $$;
 	$ENV{OPENWRT_VERBOSE} = 's';
@@ -711,8 +712,10 @@ sub update {
 	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;
+			if(update_feed($type, $name, $src, $perform_update) == 1) {
+				$failed=1;
+				last;
+			}
 		}
 	} else {
 		while ($feed_name = shift @ARGV) {
@@ -721,14 +724,13 @@ sub update {
 				if($feed_name ne $name) {
 					next;
 				}
-				update_feed($type, $name, $src, $perform_update);
+				update_feed($type, $name, $src, $perform_update) == 0 or $failed=1;
 			}
 		}
 	}
 
 	refresh_config();
-
-	return 0;
+	return $failed;
 }
 
 sub feed_config() {
-- 
1.9.1
-------------- next part --------------
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list