Skip to content

Commit

Permalink
build: Only prepare overlays when doing build, not fetch
Browse files Browse the repository at this point in the history
I have `cosa fetch; and cosa build` in my shell history and use
it somewhat often.  We only need to commit the overlay directories
on actual builds, not fetch which is just about RPMs.  Mostly
doing this because:

 - The overlay commit is more visual noise
 - For `overrides/rootfs` it can be a nontrivial cost
  • Loading branch information
cgwalters authored and jlebon committed Sep 23, 2019
1 parent 1494c63 commit 6eb9701
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/cmd-build
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ fi
composejson=${PWD}/tmp/compose.json
# Put this under tmprepo so it gets automatically chown'ed if needed
lockfile_out=${tmprepo}/tmp/manifest-lock.generated.${basearch}.json
prepare_compose_overlays
# --cache-only is here since `fetch` is a separate verb.
# shellcheck disable=SC2086
runcompose --cache-only ${FORCE} --add-metadata-from-json "${commitmeta_input_json}" \
Expand Down
16 changes: 13 additions & 3 deletions src/cmdlib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -264,9 +264,13 @@ commit_overlay() {
--timestamp "${git_timestamp}"
}

runcompose() {
# Implement support for automatic local overrides:
# https://github.com/coreos/coreos-assembler/issues/118
# Implement support for automatic local overrides:
# https://github.com/coreos/coreos-assembler/issues/118
#
# This function commits the contents of overlay.d/ as well
# as overrides/{rootfs} to OSTree commits, and also handles
# overrides/rpm.
prepare_compose_overlays() {
local overridesdir=${workdir}/overrides
local tmp_overridesdir=${TMPDIR}/override
local override_manifest="${tmp_overridesdir}"/coreos-assembler-override-manifest.yaml
Expand Down Expand Up @@ -362,7 +366,13 @@ ostree-override-layers:
- cosa-bin-overlay
EOF
fi
}

# Wrapper for `rpm-ostree compose tree` which adds some default options
# such as `--repo` (which is auto-derived from the builddir) and
# `--unified-core` that we always want. Also dispatches to supermin if
# we're running without support for nested containerization.
runcompose() {
# shellcheck disable=SC2086
set - ${COSA_RPMOSTREE_GDB:-} rpm-ostree compose tree --repo="${tmprepo}" \
--cachedir="${workdir}"/cache --touch-if-changed "${changed_stamp}" \
Expand Down

0 comments on commit 6eb9701

Please sign in to comment.