scripts/feeds: handle missing/broken feeds better
authorblogic <blogic@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Mon, 13 Oct 2014 19:41:27 +0000 (19:41 +0000)
committerblogic <blogic@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Mon, 13 Oct 2014 19:41:27 +0000 (19:41 +0000)
commit692e0a27db69b55d3ebcaa395b76f01cddd41bc0
tree987b5ed5b7c2c6ac037eb9f84e506ba8fdea70bd
parent2c6f0a1a5b1c9d78325aec12781eff4421f322a0
scripts/feeds: handle missing/broken feeds better

pts/feeds update -a" can fail rather silently for feeds using git, as
the script does not pause when updating a feed fails. Instead it prints the
error message and calmly continues to the next feed. It is very easy to
overlook update errors with the feeds updated first, as their text scrolls
rapidly away from the screen.

This behaviour has not been a big problem with svn feeds, as svn update stops
with a conflict message and interactively forces the user to resolve or
postpone the conflict. In any case the svn error is noticed by the user.

Majority of the feeds use now git, so this silent failure can affect users
doing private builds in an increasing amount.

Below is an example of update failing and script continuing:

perus@v1404:/Openwrt/barrier$ ./scripts/feeds update -a
Updating feed 'packages' from
'https://github.com/openwrt/packages.git;for-14.07' ...
remote: Counting objects: 17, done.
remote: Compressing objects: 100% (15/15), done.
remote: Total 17 (delta 10), reused 8 (delta 1)
Unpacking objects: 100% (17/17), done.
From https://github.com/openwrt/packages
62031da..dc26009  for-14.07  -> origin/for-14.07
Updating 62031da..dc26009
error: Your local changes to the following files would be overwritten by merge:
utils/collectd/Makefile
Please, commit your changes or stash them before you can merge.
Aborting
failed.
Updating feed 'luci' from 'http://git.openwrt.org/project/luci.git;luci-0.12' ...
Already up-to-date.
Create index file './feeds/luci.index'
Updating feed 'routing' from
'https://github.com/openwrt-routing/packages.git;for-14.07' ...
...

The script prints "failed.", but does not break the updating process. The
"update_feed" function returns an error code 1, but that value is not checked
in the "update" function, which continues to the next feed.
Return 1 as error:
​https://dev.openwrt.org/browser/trunk/scripts/feeds#L547
Call to update_feed without any error monitoring:
​https://dev.openwrt.org/browser/trunk/scripts/feeds#L585

The included patch makes the feeds script to stop updating after failing to
update a feed.

The script continues to the refresh_config step despite a possible failure in
updating, so the stopping action just prevents the other feeds from updating
and makes the error more clearly visible.

Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@42891 3c298f89-4303-0410-b956-a3cf2f4a3e73
scripts/feeds