[OpenWrt-Devel] [PATCH] scripts/feeds: return error status from feed updating (alternative approach)

Hannu Nyman hannu.nyman at iki.fi
Sun May 24 13:50:03 EDT 2015


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 
<martin.strbacka at nic.cz>

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 <hannu.nyman at iki.fi>

-------------- next part --------------
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() {
-------------- 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