Commit Graph

14 Commits

Author SHA1 Message Date
Mike Frysinger
c17a493bcc setup DEFAULT_BOARD by default
Rather than forcing all consumers of DEFAULT_BOARD to remember to call
get_default_board, just do it for them automatically.

BUG=None
TEST=`cbuildbot {arm,amd64,x86}-generic-full` works
TEST=`./build_packages --help` shows correct default

Change-Id: I8d6ccb83babb2764a50692318eb9193c45fb3b39
Reviewed-on: https://gerrit.chromium.org/gerrit/17868
Reviewed-by: David James <davidjames@chromium.org>
Commit-Ready: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
2012-08-14 10:17:31 -07:00
David James
359d3e119d Simplify boilerplate common.sh code in src/scripts.
Currently, the scripts in src/scripts have multiple implementations
for handling when common.sh fails to load, some of which are buggy.
To simplify the boilerplate, these scripts now just exit if common.sh
fails to load. The shell itself will print the following message if
common.sh is not found:
  /usr/lib/crosutils/common.sh: No such file or directory

BUG=chromium-os:32442
TEST=Run these scripts with and without common.sh installed.

Change-Id: Ie54420b6c649774f9cb039c14c80f4cf6c6ebc07
Reviewed-on: https://gerrit.chromium.org/gerrit/27058
Reviewed-by: David James <davidjames@chromium.org>
Tested-by: David James <davidjames@chromium.org>
Commit-Ready: David James <davidjames@chromium.org>
2012-07-12 10:55:37 -07:00
Brian Harring
7f175a59e1 common.sh: output a backtrace and debug information on failure.
Currently, if set -e spots a nonzero exit we basically have
no real debug information- it just stops immediately without stating
where or why.  This forces our scripts to be stupidly verbose so
we can track roughly where they were, thus when they fail we can
use that information to localize the rough exit point.

Instead we should be traping that set -e induced exit and
outputing necessary debug information to run it down.  This includes
outputing the relevant stack trace, or at least what we can get of
it.

The 'die' function is now enhanced to automatically dump the trace
that lead to it.  For most consumers this is desired- however for
commandline parsing induced dies ("--board is missing" for example),
the trace is noise.  For those cases, a 'die_notrace' function was
added that retains the original non-backtrace behaviour.

Example output via instrumenting cros_generate_breakpad_symbols
w/ the failing command '/bin/false' (nonzero exit code).

Before:
./cros_generate_breakpad_symbols  monkeys --board=x86-alex
<no output at all, just exit code 1>

With this CL:
./cros_generate_breakpad_symbols  monkeys --board=x86-alex
ERROR   : script called: ./cros_generate_breakpad_symbols 'monkeys' '--board=x86-alex'
ERROR   : Backtrace:  (most recent call is last)
ERROR   :   file cros_generate_breakpad_symbols, line 207, called: main 'monkeys' '--board=x86-alex'
ERROR   :   file cros_generate_breakpad_symbols, line 163, called: die_err_trap '/bin/false' '1'
ERROR   :
ERROR   : Command failed:
ERROR   :   Command '/bin/false' exited with nonzero code: 1

BUG=chromium-os:30598
TEST=inject a failing command into a script, verify the output.
TEST=inject a 'command not found', verify the output
TEST=cbuildbot x86-generic-full --remote
TEST=cbuildbot arm-tegra2-full --remote
TEST=cbuildbot chromiumos-sdk --remote

Change-Id: I517ffde4d1bb7e2310a74f5a6455b53ba2dea86c
Reviewed-on: https://gerrit.chromium.org/gerrit/17225
Reviewed-by: Brian Harring <ferringb@chromium.org>
Tested-by: Brian Harring <ferringb@chromium.org>
Commit-Ready: Brian Harring <ferringb@chromium.org>
2012-05-07 17:19:41 -07:00
Brian Harring
aa13ea4658 Shift crosutils scripts to use the common.sh they were written against.
Rather than trying to use an old/stale common.sh, use the common.sh
from the invocation point- if invoked via /usr/lib/crosutils, use that
common.sh.  If invoked via src/scripts/, use that, etc.

Trying to intermix it just introduces potential for bugs and invalidly
freezes common.sh api, thus the efforts to revert this and ultimately
revert the existing of a crosutils ebuild.

BUG=chromium-os:27201
TEST=cbuildbot x86-generic-full

Change-Id: I4c6c5fbade3d28c71752bd4c44dccad49af52ec0
Reviewed-on: https://gerrit.chromium.org/gerrit/18303
Reviewed-by: David James <davidjames@chromium.org>
Commit-Ready: Brian Harring <ferringb@chromium.org>
Tested-by: Brian Harring <ferringb@chromium.org>
2012-03-15 23:35:06 -07:00
Mike Frysinger
59d3d736a7 get_latest_image.sh: error out when image dirs are missing
Every consumer that I can find of get_latest_image.sh expects this
script to output something useful.  Many don't check the result and
end up spitting out unhelpful messages when it doesn't.  So make a
missing images dir fatal for this script so everyone on top of us
gets this checking for free.

If, in the future, someone actually wants this to output nothing
when there's nothing found, we can add a dedicated flag.  That mode
of operation is a lot less common than having it die by default.

BUG=None
TEST=delete image tree, run ./get_latest_image.sh --board=${BOARD}, see it fail nicely
TEST=delete image tree, run ./image_to_vm.sh --board=${BOARD}, see it fail nicely

Change-Id: I0a2ffd0b9084297b6d2346f02dbdb7bd0ef667bf
Reviewed-on: https://gerrit.chromium.org/gerrit/15589
Reviewed-by: David James <davidjames@chromium.org>
Reviewed-by: Chris Sosa <sosa@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
Commit-Ready: Mike Frysinger <vapier@chromium.org>
2012-02-13 08:51:43 -08:00
Mike Frysinger
c9dfcaf480 get_latest_image: ignore files when searching for latest images
If files are in the board build dir with newer mtimes than the dirs
or symlinks, then the get_latest_image code selects the file instead
of the latest dir.  And then it all falls down:
	Cannot find image directory /path/to/file

So tweak the look up code by having bash do the expansion of dirs
only, and then let ls do the mtime sorting.

BUG=None
TEST=`./image_to_usb.sh --board=x86-alex -y --to=/dev/sdb` still works after deleting "latest"
Change-Id: Ic06a2ddd0206748d35cb7762009df67a267d4746
Reviewed-on: http://gerrit.chromium.org/gerrit/10258
Reviewed-by: Chris Sosa <sosa@chromium.org>
Reviewed-by: David James <davidjames@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
Commit-Ready: Mike Frysinger <vapier@chromium.org>
2011-10-19 19:14:42 -07:00
Brian Harring
d5d5dbffa1 Fix/standardize exiting if common.sh can't be found
The problem here is that most were doing their exiting w/in a subshell;
exit within a subshell kills the subshell, not the parent.  Not all scripts
were using set -e (which would pick up the failing subshell); as such
just rewriting them to remove the potential via eliminateing the subshelling.

Beyond that, removed a couple of custom (working, although non-standard)
approaches, and removed a duplicate common.sh sourc'ing w/in mk_memento_images.sh

TEST=force 'find_common_sh' to fail, note the scripts fails to exit
BUG=none

Change-Id: Ia1108a091a6399ad6aedd3cade4a107f4411686c
Reviewed-on: http://gerrit.chromium.org/gerrit/3905
Reviewed-by: Brian Harring <ferringb@chromium.org>
Tested-by: Brian Harring <ferringb@chromium.org>
2011-07-22 12:06:59 -07:00
Greg Spencer
798d75f3be This starts to fix the scripts so that they load from /usr/lib/crosutils
from within the chroot.

It also fixes a number of style issues.

It changes the meaning of cros_workon "list-all" to list all available
packages, and adds "list-live" to list all live packages.

It changes things that load chromeos-common.sh from the installer to
load it from /usr/lib/installer.

BUG=chromium-os:4230
TEST=synced, rebuilt chroot, made packages, made images, built chrome
from source, and wrote an image to a USB stick.

Review URL: http://codereview.chromium.org/6240018

Change-Id: I90c34420af1a64020402bafef8e9e77f56837c02
2011-02-01 22:04:49 -08:00
Chris Sosa
af33f8f8ae Add board option to au test harness so that this works for others without a default board and add ability to reference images without relative paths.
Change-Id: I4afa86fa7a6b772124de56114910a1ca5e3d4511

BUG=
TEST=Ran through update harness code and ran loman.

Review URL: http://codereview.chromium.org/3612004
2010-10-04 18:19:29 -07:00
Olof Johansson
58f25cca72 Create a latest link to point at newest image
build_image creates it after a successful build, and get_latest_image
can use it if it exists. Fall back to old behavior for now when there
are directories without a link.

BUG=none
TEST=Try building an image, check link. Rebuild, check new link.

Review URL: http://codereview.chromium.org/3014051
2010-08-04 21:18:49 -07:00
David James
868d7bb6b9 Added --preserve option and logic.
Other changes:
- Added update_base_packages() method.
- Fix a get_latest_image.sh problem when the image does not already exist.
- Cleanup method invocations, and remove OUTPUT_IMG global variable.
- Add kernel testing logic back (it was accidentally deleted in an earlier patch.)

TEST=Built regular image. Updated old image to contain new packages.
BUG=none

Patch by: Don Garrett <dgarrett@chromium.org>
(Tweaked by me to address review feedback.)

Review URL: http://codereview.chromium.org/2857020
2010-06-24 21:48:14 -07:00
Chris Sosa
5d8ed6de6a adds default board to get_latest_image
Review URL: http://codereview.chromium.org/1702014
2010-04-29 10:23:24 -07:00
Sam Leffler
7111b4f204 fixup autoupdate for new build system
- write board is to /etc/lsb-release
- send board id to omaha
- require board to find latest image

Review URL: http://codereview.chromium.org/633001
2010-02-18 09:58:42 -08:00
rtc@google.com
d26178fa7e Adds a local Autoupdate server and a mechanism for adding developer packages.
I've been getting frustrated by juggling usb sticks to constantly update my netbook so I wrote a simple
server that can run in a developer's source tree and serve updates to a netbook. I also added an upstart
task that will download a script from the dev server and run it. I use this to install sshfs, gdb, and vim.

Here's a quick heads up about what has changed. 

1. /etc/lsb-release

I added two new fields to the release file. One is the URL that should be pinged for updates. The other is the URL that can be used to download a developer setup script. 

2. chromeos_version.sh

The functionality for the release build is unchanged, however, developer builds now have a monotonically increasing version number. 

3. software-update.conf

Autoupdate is disabled when the DEV_SERVER field in /etc/lsb-release is initialized. This field won't be set on the build server, but will be set everywhere else. 

4. ping_omaha.sh

The omaha server is now configured by /etc/lsb-release

Review URL: http://chromereview.prom.corp.google.com/1175098

git-svn-id: svn://chrome-svn/chromeos/trunk@92 06c00378-0e64-4dae-be16-12b19f9950a1
2009-10-26 22:36:21 +00:00