Commit Graph

9 Commits

Author SHA1 Message Date
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
Mandeep Singh Baines
e46aa776a1 cros_workon_make: deprecate
BUG=11507
TEST=Ran and verified that an error is printed.

Change-Id: Icc494be4af8c5e3f462363280d5c17c12e16d24d

R=cmasone@chromium.org,anush@chromium.org

Review URL: http://codereview.chromium.org/6748008
2011-03-29 12:55:32 -07:00
Mandeep Singh Baines
93da99be03 cros_workon: fix comments/messages to be consistent with new location
cros_workon has move to /usr/bin/

BUG=11507
TEST=none

Change-Id: I7301f659900713c432104ccceb3e658218e0ecac

Review URL: http://codereview.chromium.org/6334137
2011-02-05 11:42:19 -08: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
Mandeep Singh Baines
46b5e1d286 cros_workon_make: actually inplace when doing an install
Also, fixed to honour external FEATURES for the install case.

BUG=n0ne
TEST=Built a kernel with this CL.

Change-Id: I17d50cc382b297766761f12d47a555630fedc016

Review URL: http://codereview.chromium.org/5530004
2010-12-03 16:18:30 -08:00
David Rochberg
3b9107014b restart_in_chroot_if_needed can run scripts from bin/. cros_workon_now does this
BUG=chromium-os:9877
TEST=ran bin/cros_workon_now, cros_workon, set_shared_user_password

Note---this introduces another bashism to common.sh.  However, despite
comments to the contrary, common.sh does not actually parse under dash
without this change

Change-Id: I1e6b9751afa8341c100f3b8e0b96284835a53d17

Review URL: http://codereview.chromium.org/5444002
2010-12-02 10:45:21 -05:00
Chris Masone
330375f692 [crosutils] Add confirmation warning to cros_workon_make --scrub
BUG=9717
TEST=run cros_workon_make --scrub and ensure that it only scrubs if the user types y or yes (case insensitive)

Change-Id: Ic1f8020fcca8bd57924391fcbf075d3e2adc5e4a

Review URL: http://codereview.chromium.org/5265009
2010-11-29 15:06:53 -08:00
Chris Masone
5c5a95e865 [crosutils] Add script to help build incrementally
cros_workon_make provides a make-style interface to incrementally building
    cros_workon-enabled packages, appropriately setting up the toolchain for
    the target board beforehand.

    To incrementally build your package:
      cros_workon_make --board <board> <package>

    To re-run your package's configure steps and compile:
      cros_workon_make --board <board> <package> --reconf

    To incrementally build your package and tests, and run the tests:
      cros_workon_make --board <board> <package> --tests

    To incrementally build and install your package:
      cros_workon_make --board <board> <package> --install

    To remove ALL files in your package repo not known by git:
      cros_workon_make --board <board> <package> --scrub

    With the exception of --scrub, these flags all compose

BUG=6843
TEST=build workon packages in place

Change-Id: Ie219074127549e1e29adad6d6a03142ab74e0172

Review URL: http://codereview.chromium.org/5244001
2010-11-29 12:49:10 -08:00