Commit Graph

192 Commits

Author SHA1 Message Date
Benjamin Gilbert
97b09dc943 common: Drop functions to disable/enable ext[234] read-only hack
The last user of this code switched to disk_util in
b312044172.
2017-04-21 13:59:31 -07:00
Benjamin Gilbert
3e27bdcc45 common: Don't export COREOS_BUILD_ID
5a76e4e5e9 started exporting COREOS_BUILD_ID
whenever it was found in version.txt, even if its value was blank. Because
COREOS_BUILD_ID is in ENVIRONMENT_WHITELIST, this caused generated build IDs
to be propagated into the SDK chroot environment and reused for every build
in a "cork enter" session. Stop exporting COREOS_BUILD_ID when we set it
ourselves.

See also 8e754f9c2b.
2017-04-06 12:23:51 -07:00
Geoff Levand
5a76e4e5e9 load_environment_var: Pickup COREOS_BUILD_ID
Change the setting of COREOS_BUILD_ID so that its value, in order of
preference, is set to

  A value set in the environment.
  A value provided in manifest's version.txt.
  A fall back value of the current time-date.

Signed-off-by: Geoff Levand <geoff@infradead.org>
2017-03-20 15:36:03 -07:00
Geoff Levand
aa259bf685 load_environment_var: Strip double quotes
To allow double quoted values to be processed correctly.

Signed-off-by: Geoff Levand <geoff@infradead.org>
2017-03-20 15:36:03 -07:00
Michael Marineau
95d0bdaf72 *: Fix PIPESTATUS checks for bash 4.3
The one-liner `[[ -z ${PIPESTATUS[*]#0} ]]` no longer works because the
expansion still includes spaces even if all the values are zero. Somehow
that didn't matter in bash 4.2 but it does mater in 4.3 to be consistent
with the general behavior of variables in [[ tests.
2016-01-25 18:25:53 -08:00
Michael Marineau
f6064d52e8 build_image: fix generation of version.txt
The generation of version.txt was the only thing depending on sourcing
the deprecated BUILD, BRANCH, and PATCH values from version.txt which
common.sh no longer does since 0b6acf86. Derive them instead.
2015-12-02 12:32:34 -08:00
Michael Marineau
14646f7900 common: set properly COREOS_SDK_VERSION
Broken in 0b6acf86 when we started selectively reading version.txt
2015-12-01 12:46:01 -08:00
Michael Marineau
0b6acf8605 common: add support for using COREOS_BUILD_ID from the environment
This allows build systems to export COREOS_BUILD_ID, making it practical
to map built images to the job that created them.
2015-11-30 09:29:24 -08:00
Michael Marineau
39a3a48a18 enter_chroot: add support for passing through GNUPGHOME
When running under jenkins the $GNUPGHOME may be located under the
current build directory instead of $HOME to avoid conflicting with other
jobs on the same build host.
2015-11-29 14:05:08 -08:00
Michael Marineau
6b1a7e7b3b common: don't get env list from chromite
This call to a python script is merely used to get a static list of
environment variables that happens to be defined in that repo.
2015-11-18 16:09:27 -08:00
Andrej Rosano
21925e99d4 common.sh: add arm64 chroot utility functions
By copying and removing the relevant qemu static executable the
functions enable and disable the chroot environment for arm64 rootfs.

Signed-off-by: Andrej Rosano <andrej@inversepath.com>
2015-09-16 12:41:12 +02:00
Michael Marineau
729f9da872 common: make sure /etc/mtab is correct before mounting anything
If mtab ever gets replaced by a regular file all sorts of things break.
2014-12-03 16:30:19 -08:00
Michael Marineau
81ce75300f cleanup: remove source location migration code
This code is not applicable to us, it predates CoreOS and is a weird
thing for common.sh to be doing as well. Instead always define
CHROOT_TRUNK_DIR to /mnt/host/source, create ~/trunk in make_chroot.
2014-09-14 15:32:10 -07:00
Michael Marineau
6df3bbbe2e sdk: assert host system is running Linux 3.7 or later
Currently building images on older kernels will fail because mkfs.btrfs
enables an incompatible feature 'extref' by default. We never really
made this requirement explicit and the SDK in general has continued to
maintain compatibility with older kernels. Make the requirement explicit
so users will get errors quicker and there is a clear line for what
kernel features can be used in the SDK.
2014-09-02 15:55:52 -07:00
Michael Marineau
4d3c198161 tools: remove support for parallel_emerge
Using parallel_emerge has been disabled by default for all commands
except build_image for quite a while now, build_image kept it just
because it was still a bit faster than normal emerge. Keeping
parallel_emerge complicates future changes to build_image so it needs to
drop it entirely. Since that means nothing uses it by default we might
as well just rip out support for it entirely.
2014-07-19 16:38:17 -07:00
Michael Marineau
47daca491c fix(sdk_lib): Remove depot_tools mount
We now include repo in the SDK which was the only thing from depot_tools
that we depended on.
2014-05-27 16:39:49 -07:00
Michael Marineau
2e9911b978 fix(*): Migrate image storage to new buckets
- Automated builds drop SDK and binary packages into
  gs://builds.developer.core-os.net/ and the new download URL is
  http://builds.developer.core-os.net/ (COREOS_DEV_BUILDS)
- Change default upload path to gs://users.developer.core-os.net/ for
  misc developer builds. Official builds go elsewhere and will just be
  configured in buildbot/jenkins so some COREOS_OFFICIAL stuff is gone.
- Automated builds of images go to a private bucket,
  gs://builds.release.core-os.net which later gets copied to
  gs://alpha.release.core-os.net and friends by core_promote.
2014-05-21 13:21:07 -07:00
Michael Marineau
b24df04465 feat(build_image): Add 'container' image type.
This image type is the same as the developer image except that it is a
single root filesystem and is bootable via systemd-nspawn. This may
become obsolete eventually when it becomes possible to boot the normal
disk images under nspawn but it is useful for testing until then.

The partition type is defined by the Discoverable Partitions Spec.
http://www.freedesktop.org/wiki/Specifications/DiscoverablePartitionsSpec/
2014-05-16 21:11:01 -07:00
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