mirror of
https://github.com/flatcar/scripts.git
synced 2025-09-21 21:51:57 +02:00
Merge pull request #391 from marineam/repos
toolchain_util: include repos.conf in bootstrap build environments
This commit is contained in:
commit
f04e213c2c
@ -80,11 +80,28 @@ export PORTAGE_GRPNAME=portage
|
||||
EOF
|
||||
}
|
||||
|
||||
repos_conf() {
|
||||
cat <<EOF
|
||||
[DEFAULT]
|
||||
main-repo = portage-stable
|
||||
|
||||
[gentoo]
|
||||
disabled = true
|
||||
|
||||
[coreos]
|
||||
location = /usr/portage
|
||||
|
||||
[portage-stable]
|
||||
location = /usr/local/portage
|
||||
EOF
|
||||
}
|
||||
|
||||
# Common values for all stage spec files
|
||||
catalyst_stage_default() {
|
||||
cat <<EOF
|
||||
subarch: $ARCH
|
||||
rel_type: $TYPE
|
||||
portage_confdir: $TEMPDIR/portage
|
||||
portage_overlay: $FLAGS_coreos_overlay
|
||||
profile: $FLAGS_profile
|
||||
snapshot: $FLAGS_version
|
||||
@ -212,20 +229,22 @@ write_configs() {
|
||||
export CCACHE_DIR="$TEMPDIR/ccache"
|
||||
|
||||
info "Creating output directories..."
|
||||
mkdir -m 775 -p "$TEMPDIR" "$DISTDIR" "$CCACHE_DIR"
|
||||
mkdir -m 775 -p "$TEMPDIR/portage/repos.conf" "$DISTDIR" "$CCACHE_DIR"
|
||||
chown portage:portage "$DISTDIR" "$CCACHE_DIR"
|
||||
info "Writing out catalyst configs..."
|
||||
info " $TEMPDIR/catalyst.conf"
|
||||
info " catalyst.conf"
|
||||
catalyst_conf > "$TEMPDIR/catalyst.conf"
|
||||
info " $TEMPDIR/catalystrc"
|
||||
info " catalystrc"
|
||||
catalystrc > "$TEMPDIR/catalystrc"
|
||||
info " $TEMPDIR/stage1.spec"
|
||||
info " portage/repos.conf/coreos.conf"
|
||||
repos_conf > "$TEMPDIR/portage/repos.conf/coreos.conf"
|
||||
info " stage1.spec"
|
||||
catalyst_stage1 > "$TEMPDIR/stage1.spec"
|
||||
info " $TEMPDIR/stage2.spec"
|
||||
info " stage2.spec"
|
||||
catalyst_stage2 > "$TEMPDIR/stage2.spec"
|
||||
info " $TEMPDIR/stage3.spec"
|
||||
info " stage3.spec"
|
||||
catalyst_stage3 > "$TEMPDIR/stage3.spec"
|
||||
info " $TEMPDIR/stage4.spec"
|
||||
info " stage4.spec"
|
||||
catalyst_stage4 > "$TEMPDIR/stage4.spec"
|
||||
}
|
||||
|
||||
|
@ -32,8 +32,7 @@ build_target_toolchain() {
|
||||
run_merge -u --root="$ROOT" "${TOOLCHAIN_PKGS[@]}"
|
||||
}
|
||||
|
||||
mkdir -p "/tmp/crossdev"
|
||||
export PORTDIR_OVERLAY="/tmp/crossdev $(portageq envvar PORTDIR_OVERLAY)"
|
||||
configure_crossdev_overlay / /tmp/crossdev
|
||||
|
||||
for cross_chost in $(get_chost_list); do
|
||||
echo "Building cross toolchain for ${cross_chost}"
|
||||
|
@ -172,6 +172,35 @@ get_binonly_args() {
|
||||
|
||||
### Toolchain building utilities ###
|
||||
|
||||
# Create the crossdev overlay and repos.conf entry.
|
||||
# crossdev will try to setup this itself but doesn't do everything needed
|
||||
# to make the newer repos.conf based configuration system happy. This can
|
||||
# probably go away if crossdev itself is improved.
|
||||
configure_crossdev_overlay() {
|
||||
local root="$1"
|
||||
local location="$2"
|
||||
|
||||
# may be called from either catalyst (root) or update_chroot (user)
|
||||
local sudo="env"
|
||||
if [[ $(id -u) -ne 0 ]]; then
|
||||
sudo="sudo -E"
|
||||
fi
|
||||
|
||||
$sudo mkdir -p "${root}${location}/"{profiles,metadata}
|
||||
echo "x-crossdev" | \
|
||||
$sudo tee "${root}${location}/profiles/repo_name" > /dev/null
|
||||
$sudo tee "${root}${location}/metadata/layout.conf" > /dev/null <<EOF
|
||||
masters = portage-stable coreos
|
||||
use-manifests = true
|
||||
thin-manifests = true
|
||||
EOF
|
||||
|
||||
$sudo tee "${root}/etc/portage/repos.conf/crossdev.conf" > /dev/null <<EOF
|
||||
[x-crossdev]
|
||||
location = ${location}
|
||||
EOF
|
||||
}
|
||||
|
||||
# Ugly hack to get a dependency list of a set of packages.
|
||||
# This is required to figure out what to install in the crossdev sysroot.
|
||||
# Usage: ROOT=/foo/bar _get_dependency_list pkgs... [--portage-opts...]
|
||||
@ -198,7 +227,8 @@ _configure_sysroot() {
|
||||
sudo="sudo -E"
|
||||
fi
|
||||
|
||||
$sudo mkdir -p "${ROOT}/etc/portage"
|
||||
$sudo mkdir -p "${ROOT}/etc/portage/"{profile,repos.conf}
|
||||
$sudo cp /etc/portage/repos.conf/* "${ROOT}/etc/portage/repos.conf/"
|
||||
$sudo eselect profile set --force "$profile"
|
||||
|
||||
$sudo tee "${ROOT}/etc/portage/make.conf" >/dev/null <<EOF
|
||||
@ -240,6 +270,16 @@ install_cross_toolchain() {
|
||||
sudo="sudo -E"
|
||||
fi
|
||||
|
||||
# crossdev will arbitrarily choose an overlay that it finds first.
|
||||
# Force it to use the one created by configure_crossdev_overlay
|
||||
local cross_overlay=$(portageq get_repo_path / x-crossdev)
|
||||
if [[ -n "${cross_overlay}" ]]; then
|
||||
cross_flags+=( --ov-output "${cross_overlay}" )
|
||||
else
|
||||
echo "No x-crossdev overlay found!" >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Only call crossdev to regenerate configs if something has changed
|
||||
if ! cmp --quiet - "${cross_cfg}" <<<"${cross_cfg_data}"
|
||||
then
|
||||
|
@ -125,16 +125,7 @@ sudo eselect profile set --force "$(get_sdk_profile)"
|
||||
|
||||
# Create crossdev repo_name and metadata
|
||||
info "Setting up crossdev..."
|
||||
sudo mkdir -p "${FLAGS_chroot}/${CROSSDEV_OVERLAY}/profiles"
|
||||
echo "x-crossdev" | \
|
||||
sudo tee "/${CROSSDEV_OVERLAY}/profiles/repo_name" > /dev/null
|
||||
|
||||
sudo mkdir -p "/${CROSSDEV_OVERLAY}/metadata"
|
||||
sudo tee "/${CROSSDEV_OVERLAY}/metadata/layout.conf" > /dev/null <<EOF
|
||||
masters = portage-stable coreos
|
||||
use-manifests = true
|
||||
thin-manifests = true
|
||||
EOF
|
||||
configure_crossdev_overlay "${FLAGS_chroot}" "${CROSSDEV_OVERLAY}"
|
||||
|
||||
# Run version hooks as pre-update
|
||||
if [[ -f /etc/os-release ]]; then
|
||||
|
Loading…
x
Reference in New Issue
Block a user