[OpenWrt-Devel] [PATCH] scripts/feeds: Return non-zero return code if updating of a feed failed.
John Crispin
blogic at openwrt.org
Fri May 22 09:59:13 EDT 2015
On 12/05/2015 14:49, Martin Strbacka wrote:
> 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>
would it not be easier to do this -->
if (!update_feed(...)) {
exit 1;
}
also i am not sure if we want the script to abort if one of the feeds
has failed
John
> ---
> 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() {
>
>
>
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
>
_______________________________________________
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