Commit Graph

174 Commits

Author SHA1 Message Date
Michael Marineau
39086358bf refactor(build_image): Build dev and prod images independently
We need some more control over exactly what lands in dev vs prod images
which will require letting them diverge in what is currently the common
base image step. There isn't any real need for the base image in the
first place other than to speed up building both dev and prod images at
the same time but that isn't common enough to worry about.

As part of this cleanup also remove references to CHROMEOS_* variables
and the recovery image that never actually existed in CoreOS.
2014-05-09 10:55:09 -07:00
Michael Marineau
10d98e7b32 fix(common): Switch to os-release style names in version.txt
The existing version.txt is kinda annoying. The common case of referring
to the current version requires joining three values and the names of
those values only make sense in ChromeOS. Instead just use version as a
string, using VERSION, VERSION_ID, and BUILD_ID just as they appear in
os-release. It is up to the few scripts that need the individual parts
to break the version apart.

The old values remain for the sake of compatibility.
2014-04-29 01:44:47 -04:00
Michael Marineau
10025571d9 fix(common): Disable parallel_emerge by default for most commands.
I would like to phase out parallel_emerge so disable it for all commands
other than build_image which is the only one that shows a noticeable
benefit from it (~2 min with --fast, ~3 min with --nofast).
2014-02-17 12:42:22 -08:00
Michael Marineau
e6739a22a8 fix(common): Fix dumb typo in bash alternate-value expansion
Missing a :
Perhaps I'm getting to clever with my shell for my own good.
2014-02-10 21:56:59 -08:00
Michael Marineau
5524a7ce9a fix(common): Define VERSION_ID and BUILD_ID
Scripts can now use COREOS_VERSION_ID to get the base version instead of
having to strip off the BUILD_ID that is appended for unofficial builds.
2014-02-09 13:59:42 -08:00
Michael Marineau
50e54cea85 fix(release_util): Move default upload root to common, add --upload_root
Make it possible for other scripts to share the same value for our
release repository and equally easy to override with a custom value.
Also allow setting the root from the command line in addition to the
environment. Usually --upload_root is better to use than --upload_path.
2014-02-07 10:37:45 -08:00
Michael Marineau
feb59db9f5 fix(release_util): Add argument to specify the name to use for .DIGESTS
For multi-file uploads we should explicitly declare what the name of the
.DIGESTS file should be instead of using the first file name. Relying on
the ordering was subtle and easy to break.
2014-01-29 16:30:03 -08:00
Michael Marineau
6d414d275e fix(*): remove lingering broken support for board overlays.
This is a feature from the chromeos sdk that we haven't used and doesn't
work any more. Clean it up...
2013-12-08 16:02:00 -08:00
Michael Marineau
0a8152891e fix(common.sh): Remove some dead code. 2013-11-29 23:38:06 -08:00
Michael Marineau
175d88e6e4 fix(build_image_util.sh): Move image install mask to portage profile.
Reduce the spaghetti config a bit...
2013-11-29 23:38:06 -08:00
Michael Marineau
763b27bb7f fix(common.sh): Move DIGESTS handling code to common functions.
This code would be useful to use when downloading SDK tarballs in
addition to uploading them. :)
2013-11-22 19:15:10 -08:00
Michael Marineau
c5c9ea0b9b fix(common.sh): New variables for .cache and .repo/manfests
A number of places refer to these paths and that number is going to
grow. Since the standard pattern is to use environment variables for
commonly used paths it is time to add ones for these:
REPO_CACHE_DIR
REPO_MANIFESTS_DIR
2013-11-22 16:13:49 -08:00
Michael Marineau
55a4517d65 fix(common.sh): Use $SCRIPT_NAME as the default log prefix.
Seems useful with all the scripts-calling-scripts-turtles but very few
scripts explicitly set a prefix.
2013-11-07 13:28:13 -08:00
Michael Marineau
8ee5f00137 fix(common.sh): Stop collecting stats and uploading them to Google.
Just... no.. in so many ways. Kinda dumb it took me this long to delete
this little chunk of rather annoying code.
2013-10-23 11:39:08 -07:00
Michael Marineau
e2b35bbae1 fix(build_image): Install dev packages into root, not /usr/local.
We don't have any particular reason for the weird hackery required to
install packages into /usr/local instead of root. The rootfs image is
already being modified a little might as well modify it a lot. :)
2013-09-19 20:43:59 -04:00
Michael Marineau
207cc2f6a3 cleanup(*): Remove unused/broken test and factory images 2013-09-19 19:04:54 -04:00
Michael Marineau
ba9dd61aeb fix(common.sh): Do not add dev build id when outside a repo checkout.
When running from a au zip or other strange situation assume the version
in version.txt should be used as-is. This avoid the need to set
COREOS_OFFICIAL=1 in these situations which can be lead to surprises.
2013-08-16 21:47:31 -04:00
Michael Marineau
ba4c770c37 fix(common): Exclude default systemd filesystem targets.
We don't need the default root filesystem fsck and remount targets
provided by systemd since root is read only. The only default one what
was included in this way was tmp.mount but that is now covered by
a dependency in the coreos-init package.
2013-08-11 14:50:05 -04:00
Michael Marineau
a0f383e3fe fix(common): sort -R is random, -r is reverse. Kids, use long options...
Randomly failing builds for fun and profit!
2013-08-07 12:38:58 -04:00
Michael Marineau
19caadc8c9 feat(common): Add simple version comparison function.
Relies on sort for version comparison which should generally be good
enough. Not a proper semver tool but good enough for dirty scripts. :)
2013-08-06 13:50:17 -04:00
Michael Marineau
1ea1e8ba9b cleanup(common): Remove rarely used pv_cat_cmd
Its single use is in build_common and even then having a little progress
bar for copying images isn't that interesting, they just get lost in the
noise of the emerge output. Keep it simple, use cp.
2013-07-26 22:40:59 -04:00
Michael Marineau
42a4536d7d fix(*): Rename dev image to coreos_developer_image.bin
Remove hard-coded references and unused scripts that mentioned it.
2013-07-26 22:12:10 -04:00
Brandon Philips
be72d56a50 fix(*): move dev_image to overlays
put the dev_image in overlays/usr/local
2013-07-26 10:20:18 -07:00
Brandon Philips
cf8be2c320 fix(*): use /media/state and overlays dir
/mnt/stateful_partition was already a little unruly with
/mnt/stateful_partition/home and /mnt/stateful_partition/var_overlay
serving similar functional purposes.

Then we needed to also add /opt and /srv overlays.

I also have wanted to get rid of the ugly and weird
/mnt/stateful_partition name so lets just have one big move.

/mnt/stateful_partition -> /media/state
/mnt/stateful_partition/var_overlay -> /media/overlays/var
/mnt/stateful_partition/home -> /media/overlays/home

From there we add /media/overlays/srv and /media/overlays/opt
2013-07-26 08:44:47 -07:00
Michael Marineau
033cf224f1 feat(image_to_vm): Refactor to make adding/changing vm formats easier.
The old script was heading towards spaghetti code realm. This breaks up
all the image variations such as hybrid MBR, OEM packages, etc into
configuration options and small functions that actually do the work.

All this is in the new vm_image_util.sh library but the command line
parsing and overall procedure remains in image_to_vm.sh

As part of this we gain support for putting some qemu options in a
config file as well as Xen virtual machines using pygrub and pvgrub.

Lots of generally unused options have been removed to simplify things
and keep output file names consistent.
2013-07-24 23:11:50 -04:00
Brandon Philips
95b2a4b8cd chore(*): use coreos_ everywhere 2013-07-21 23:20:50 -07:00
Michael Marineau
99089076af fix(build_image): Don't unmount when the rootfs isn't mounted
This function is never called when rootfs is mounted but leaving in a
check for it as a just in case sort of thing.
2013-07-19 02:41:52 -04:00
Michael Marineau
e99f088f19 fix(common): Simplify unmount code, die loud and die hard.
As-is safe_umount is extremely dangerous. When passed multiple mount
points and any one of them fail with a "not mounted" or "doesn't exist"
error then any others that fail with a more serious error will be
silently ignored. This can cause untold sadness when running deleting a
chroot with cros_sdk if /mnt/host/source is left mounted, all your code
will be gone. To avoid this situation remove *ALL* this extra logic and
die very loudly when umount fails. Due to the way bind mounts interact
with this code "not mounted" so when unmounting a full tree we need to
still need to gracefully retry when the first umount fails.
2013-07-18 16:59:29 -07:00
Michael Marineau
67cea27070 fix(common): Fix okboat and failboat because boat. 2013-07-18 15:52:47 -07:00
Michael Marineau
b9257ee2a8 fix(common): Read mounts from /proc/self/mounts
Just in case the filesystem view is slightly different.
2013-07-18 15:27:02 -07:00
Marc MERLIN
a1f5ee388d Remove a warning when $HOME is on NFS
If ~/.subversion doesn't exist, the code didn't run, but if it existed
there is no reason to re-create it, nor is it necessary to change its
permissions since they are inherited by the bind mount source.
However user_mkdir was trying to run chown as root which does not work
over NFS with root_squash or krb-nfs.
Therefore, the un-needed call to user_mkdir is removed.
(this is an issue because cros_sdk  --replace does call this code path
multiple times).

BUG=None
TEST=Built the chroot, and the permission denied on 'install' went away.
Change-Id: I01e9a7baf51a99a96d790c9613e26e652379e6df
Reviewed-on: https://gerrit.chromium.org/gerrit/44880
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Marc MERLIN <merlin@chromium.org>
Tested-by: Marc MERLIN <merlin@chromium.org>
2013-07-14 10:45:10 -07:00
Michael Marineau
680c40ad81 fix(common): Adopt semver formatted version strings.
Drop zero padding and format versions as described by the semver spec.
The terminology is a little awkward because we inherited the backwards
meaning of 'BUILD' and 'BRANCH' version identifiers but that the version
strings themselves conform to semver.

(This doesn't change the current version, that'll happen with our next
branch cut)
2013-07-09 11:31:39 -07:00
Michael Marineau
12935743b6 fix(common.sh): Fallback to loading version.txt from current directory.
This makes version handling continue to work normally with
au-generator.zip
2013-07-08 21:39:04 -07:00
Michael Marineau
8af55de72c fix(common.sh): Correctly report script name in tracebacks
Pretty simple typo.
2013-07-05 21:34:11 -04:00
Brandon Philips
a45c529549 feat(build*): add CoreOS production image building
This will create a CoreOS production image and support it with the tools
like image_to_vm.sh and build_image.
2013-07-05 12:06:40 -07:00
Brandon Philips
195d052495 fix(*): drop FACTORY images
we don't need factory image functionality. Drop it to simplify our
scripts and prepare for our "production" feature and flags.
2013-07-05 09:37:38 -07:00
Brandon Philips
61b3560bec Merge pull request #18 from philips/core_upload_update-signing
Core upload update signing
2013-07-03 12:20:15 -07:00
Michael Marineau
5790b3e182 fix(*_release): Calculate TODAYS_VERSION in common.sh 2013-07-03 12:11:49 -04:00
Brandon Philips
3b9ff1ea62 fix(core_upload_update): use the base image
- Use variable for the image name
- add COREOS prefixed variables so we can start weaning ourself off of the
others.
2013-07-02 16:14:07 -07:00
Michael Marineau
2482291e7d fix(scripts): Cleanup build version handling.
A few things here:
 - Source manifests/version.txt directly instead of coreos-version.sh
 - Remove Chrome branch from target image directory names.
 - Use proper version instead of timestap for catalyst builds.
 - Move lsb_release script from coreos-overlay to build_library.
2013-07-02 16:12:02 -04:00
Brandon Philips
11472e5166 common: make safe_umount retry a few times
on Fedora 18 on Gnome 3.0 something is making the first attempt at
unmounting return busy. Unfortunatly, the return code is 32 everytime
so we have to parse the output of umount :( :( :(

Change-Id: I7f94bf6c2059c7e7cb4fb173d9ffbabd59f2b24f
2013-02-14 16:18:56 -08:00
Ryan Harrison
b8bd594130 Add /usr/share/profiling to COMMON_INSTALL_MASK
This directory contains profiling/coverage data that is generated by some
packages during the build process. It should not be installed onto the device,
but we want the data to live on in /build to allow developers to consult it.

BUG=chromium-os:37854
TEST=None, this change will be tested in CL 42339 since it currently has not
     effect

Change-Id: I882fa7a7496db52a72bb8c5409b3715490d95879
Reviewed-on: https://gerrit.chromium.org/gerrit/42499
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Tested-by: Ryan Harrison <rharrison@chromium.org>
2013-02-02 11:48:48 -08:00
Mike Frysinger
baae8eb628 common.sh: convert to bash
We don't need to support POSIX shell, so convert to bash.

BUG=None
TEST=`cbuildbot {amd64,x86,arm}-generic-full chromiumos-sdk daisy-release` worked

Change-Id: I33ad25d2310c593f3e346d955e3aa27da41091fc
Reviewed-on: https://gerrit.chromium.org/gerrit/41271
Reviewed-by: David James <davidjames@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
2013-01-16 13:59:21 -08:00
Brian Harring
9086a3f9d3 Calculate CHROOT_TRUNK_DIR earlier.
Issues flagged during unittest run; bit unsure how this got missed
since trybots were involved (Presuming human error).

BUG=chromium-os:37347
TEST=trybot run

Change-Id: Ib6e49d28f9427197a0abd0e4da68d2f628dc2803
Reviewed-on: https://gerrit.chromium.org/gerrit/41203
Reviewed-by: Brian Harring <ferringb@chromium.org>
Tested-by: Brian Harring <ferringb@chromium.org>
2013-01-14 01:53:41 -08:00
Brian Harring
2499bfbeb2 Move source access to a standard location, add chromite to PYTHONPATH.
Rather than having to find /home/${SUDO_USER:-${USER}}/trunk, instead
just look for /mnt/host/trunk (defined by common.sh as $CHROOT_TRUNK_DIR).
This simplifies code flow, and is a requirement for shoving chromite
into PYTHONPATH globally w/in the chroot.

BUG=chromium-os:37347
TEST=cros_sdk --replace; cros_sdk w/ chroot upgrade.
Change-Id: I9ee3e6556541a91193f49cbf74ffc5a8e090537f
Reviewed-on: https://gerrit.chromium.org/gerrit/39921
Tested-by: Brian Harring <ferringb@chromium.org>
Reviewed-by: David James <davidjames@chromium.org>
2013-01-14 00:44:03 -08:00
Gilad Arnold
8f861c05b6 common.sh: limit pv progress bar initial width to 80 characters
By default, pv automatically infers and uses the full width of the
terminal. This generally makes sense for a console application, but in
the case of pv it just causes the progress bar to be ridiculously wide
when run on wide terminals, to the point it's hard to read. This CL is
setting it to 80 characters, the widely accepted standard width for
a terminal, in cases where the terminal appears to be larger than
80 columns. Note that:

* Even with -w, pv appears to be resizing the progress bar as the
  terminal width changes midway through the run. This means that if
  a user widens the window, then the progress bar will go wide again and
  there's nothing to be done about it.

* Theoretically, in very rare cases this may lead to a progress bar the
  exceeds the width of the terminal (i.e. set to 80 columns on
  a terminal that has just shrunk to fewer columns). The odds for such
  timing are close to nil and even then the damage is minimal.

* This will work for non-terminal runs, or otherwise runs where stty
  does not produce any output.

* To avoid the initialization overhead for all common.sh inclusion,
  replacing the variable with a function that prints the pv/cat command.

BUG=None
TEST=Ran ./image_to_usb on wide and narrow terminal windows, it works.

Change-Id: I549df1dd29e93909ea646ae9b9e09d9a588ad382
Reviewed-on: https://gerrit.chromium.org/gerrit/40937
Commit-Queue: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
2013-01-12 23:06:31 -08:00
David James
7efb76cde5 Remove deprecated mod_image_for_test.sh and references.
mod_image_for_test.sh doesn't work anymore so nobody should be using it.
There are a few places where scripts try to use mod_image_for_test.sh,
and these are timebombs because they fail if a test image needs to actually
be produced.

BUG=chromium-os:31183
TEST=Tested that this script doesn't produce any images anymore, so
     it should be fine to delete it.

Change-Id: If80337407023d62f76117dc44cadfa46801ca236
Reviewed-on: https://gerrit.chromium.org/gerrit/40955
Reviewed-by: Chris Sosa <sosa@chromium.org>
Commit-Queue: David James <davidjames@chromium.org>
Tested-by: David James <davidjames@chromium.org>
2013-01-09 18:30:52 -08:00
Kees Cook
74f163b587 install kernel testcase modules on test image only
Similar to the uinput module, install the testcases/ tree of modules
only on test images.

BUG=chromium-os:37353
TEST=daisy test image build has modules, production does not.
CQ-DEPEND=I16eee5afd1664f0ab4a9ab48b6cb2beaa6f30017

Change-Id: I5e7a48936b3fb45f49ff7ca4d592d46150c5610c
Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/39920
Reviewed-by: Chris Sosa <sosa@chromium.org>
Reviewed-by: Grant Grundler <grundler@chromium.org>
2012-12-21 12:42:42 -08:00
Vic Yang
982556afcc Filter out more things in install shim
This reduces tens of MB of install shim.

BUG=chrome-os-partner:16712
TEST=Build install shim and install with it.

Change-Id: Ic7fab3c6e26d9b78f5181c4f10181217c1c2697a
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/39534
Reviewed-by: Tom Wai-Hong Tam <waihong@chromium.org>
2012-12-11 03:02:12 -08:00
David James
22dc2ba9d9 Fallback to SUDO_USER when running on NFS.
When running on NFS, the root user may not be able to access ~/.ssh and
~/.gitconfig, so it is necessary to fallback to SUDO_USER to access these
files.

To discourage users from using NFS homedirs, print warnings every time
cros_sdk is run with an NFS homedir.

BUG=chromium-os:36783
TEST=Try cros_sdk --replace and cros_sdk with and without NFS homedirs.

Change-Id: I4cdbceca485d3491656d6f743814da4ebcdd75ad
Reviewed-on: https://gerrit.chromium.org/gerrit/38953
Commit-Ready: David James <davidjames@chromium.org>
Reviewed-by: David James <davidjames@chromium.org>
Tested-by: David James <davidjames@chromium.org>
2012-11-30 09:06:06 -08:00