mirror of
https://github.com/fosslinux/live-bootstrap.git
synced 2026-03-23 11:36:32 +01:00
refactor(extra-builds): remove build_guix_also flag and legacy compatibility paths
This commit is contained in:
parent
4dc0135455
commit
8917b7ba3d
7 changed files with 33 additions and 40 deletions
|
|
@ -104,5 +104,5 @@ Attach `external.img` as an extra raw disk in QEMU, or as the second disk on bar
|
||||||
- Without `--external-sources` and without `--repo`, there is no second disk:
|
- Without `--external-sources` and without `--repo`, there is no second disk:
|
||||||
the initial image only includes distfiles needed before `improve: get_network`,
|
the initial image only includes distfiles needed before `improve: get_network`,
|
||||||
and later distfiles are downloaded from mirrors.
|
and later distfiles are downloaded from mirrors.
|
||||||
- `--build-guix-also` increases container contents (includes post-early `steps-guix`
|
- `--extra-builds=guix` increases container contents (includes post-early `steps-guix`
|
||||||
sources), but does not change the mechanism.
|
sources), but does not change the mechanism.
|
||||||
|
|
|
||||||
|
|
@ -135,7 +135,7 @@ with ``--external-sources`` (and no ``--repo``).
|
||||||
Notes:
|
Notes:
|
||||||
|
|
||||||
* ``external.img`` raw container mode is used with ``--external-sources`` (and
|
* ``external.img`` raw container mode is used with ``--external-sources`` (and
|
||||||
no ``--repo``). With ``--build-guix-also``, the container content is larger
|
no ``--repo``). With ``--extra-builds=guix``, the container content is larger
|
||||||
because it also includes post-early sources from ``steps-guix``.
|
because it also includes post-early sources from ``steps-guix``.
|
||||||
* Without ``--external-sources`` and without ``--repo``, there is no second
|
* Without ``--external-sources`` and without ``--repo``, there is no second
|
||||||
image. The initial image only includes distfiles needed before
|
image. The initial image only includes distfiles needed before
|
||||||
|
|
|
||||||
|
|
@ -30,24 +30,24 @@ class Generator():
|
||||||
|
|
||||||
# pylint: disable=too-many-arguments,too-many-positional-arguments
|
# pylint: disable=too-many-arguments,too-many-positional-arguments
|
||||||
def __init__(self, arch, external_sources, early_preseed, repo_path, mirrors,
|
def __init__(self, arch, external_sources, early_preseed, repo_path, mirrors,
|
||||||
build_guix_also=False):
|
extra_builds=None):
|
||||||
self.arch = arch
|
self.arch = arch
|
||||||
self.early_preseed = early_preseed
|
self.early_preseed = early_preseed
|
||||||
self.external_sources = external_sources
|
self.external_sources = external_sources
|
||||||
self.repo_path = repo_path
|
self.repo_path = repo_path
|
||||||
self.mirrors = mirrors
|
self.mirrors = mirrors
|
||||||
self.build_guix_also = build_guix_also
|
self.extra_builds = list(extra_builds or [])
|
||||||
self.pre_network_source_manifest = self.get_source_manifest(
|
self.pre_network_source_manifest = self.get_source_manifest(
|
||||||
stop_before_improve="get_network",
|
stop_before_improve="get_network",
|
||||||
build_guix_also=False,
|
extra_builds=[],
|
||||||
)
|
)
|
||||||
self.pre_import_source_manifest = self.get_source_manifest(
|
self.pre_import_source_manifest = self.get_source_manifest(
|
||||||
stop_before_improve="import_payload",
|
stop_before_improve="import_payload",
|
||||||
build_guix_also=False,
|
extra_builds=[],
|
||||||
)
|
)
|
||||||
# Only raw-external mode needs full upfront availability for container generation.
|
# Only raw-external mode needs full upfront availability for container generation.
|
||||||
if self.external_sources and not self.repo_path:
|
if self.external_sources and not self.repo_path:
|
||||||
self.source_manifest = self.get_source_manifest(build_guix_also=self.build_guix_also)
|
self.source_manifest = self.get_source_manifest(extra_builds=self.extra_builds)
|
||||||
else:
|
else:
|
||||||
self.source_manifest = self.pre_network_source_manifest
|
self.source_manifest = self.pre_network_source_manifest
|
||||||
self.bootstrap_source_manifest = self.source_manifest
|
self.bootstrap_source_manifest = self.source_manifest
|
||||||
|
|
@ -98,7 +98,7 @@ class Generator():
|
||||||
# carrier for the remaining distfiles.
|
# carrier for the remaining distfiles.
|
||||||
self.bootstrap_source_manifest = self.pre_import_source_manifest
|
self.bootstrap_source_manifest = self.pre_import_source_manifest
|
||||||
|
|
||||||
full_manifest = self.get_source_manifest(build_guix_also=self.build_guix_also)
|
full_manifest = self.get_source_manifest(extra_builds=self.extra_builds)
|
||||||
if self.bootstrap_source_manifest == full_manifest:
|
if self.bootstrap_source_manifest == full_manifest:
|
||||||
raise ValueError("steps/manifest must include `improve: import_payload` in kernel-bootstrap mode.")
|
raise ValueError("steps/manifest must include `improve: import_payload` in kernel-bootstrap mode.")
|
||||||
bootstrap_set = set(self.bootstrap_source_manifest)
|
bootstrap_set = set(self.bootstrap_source_manifest)
|
||||||
|
|
@ -255,13 +255,18 @@ class Generator():
|
||||||
self.get_packages()
|
self.get_packages()
|
||||||
|
|
||||||
shutil.copytree(os.path.join(self.git_dir, 'steps'), os.path.join(self.target_dir, 'steps'))
|
shutil.copytree(os.path.join(self.git_dir, 'steps'), os.path.join(self.target_dir, 'steps'))
|
||||||
if self.build_guix_also:
|
for extra_build in self.extra_builds:
|
||||||
steps_guix_dir = os.path.join(self.git_dir, 'steps-guix')
|
steps_extra = f"steps-{extra_build}"
|
||||||
if not os.path.isdir(steps_guix_dir):
|
steps_extra_dir = os.path.join(self.git_dir, steps_extra)
|
||||||
raise ValueError("steps-guix directory does not exist while --build-guix-also is set.")
|
if not os.path.isdir(steps_extra_dir):
|
||||||
if not os.path.isfile(os.path.join(steps_guix_dir, 'manifest')):
|
raise ValueError(
|
||||||
raise ValueError("steps-guix/manifest does not exist while --build-guix-also is set.")
|
f"{steps_extra} directory does not exist while --extra-builds includes {extra_build}."
|
||||||
shutil.copytree(steps_guix_dir, os.path.join(self.target_dir, 'steps-guix'))
|
)
|
||||||
|
if not os.path.isfile(os.path.join(steps_extra_dir, 'manifest')):
|
||||||
|
raise ValueError(
|
||||||
|
f"{steps_extra}/manifest does not exist while --extra-builds includes {extra_build}."
|
||||||
|
)
|
||||||
|
shutil.copytree(steps_extra_dir, os.path.join(self.target_dir, steps_extra))
|
||||||
|
|
||||||
def stage0_posix(self, kernel_bootstrap=False):
|
def stage0_posix(self, kernel_bootstrap=False):
|
||||||
"""Copy in all of the stage0-posix"""
|
"""Copy in all of the stage0-posix"""
|
||||||
|
|
@ -488,25 +493,27 @@ this script the next time")
|
||||||
self.check_file(path, line[0])
|
self.check_file(path, line[0])
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_source_manifest(cls, stop_before_improve=None, build_guix_also=False):
|
def get_source_manifest(cls, stop_before_improve=None, extra_builds=None):
|
||||||
"""
|
"""
|
||||||
Generate a source manifest for the system.
|
Generate a source manifest for the system.
|
||||||
"""
|
"""
|
||||||
entries = []
|
entries = []
|
||||||
directory = os.path.relpath(cls.distfiles_dir, cls.git_dir)
|
directory = os.path.relpath(cls.distfiles_dir, cls.git_dir)
|
||||||
|
extra_builds = list(extra_builds or [])
|
||||||
|
|
||||||
manifests = [os.path.join(cls.git_dir, 'steps')]
|
manifests = [os.path.join(cls.git_dir, 'steps')]
|
||||||
if build_guix_also:
|
for extra_build in extra_builds:
|
||||||
steps_guix_dir = os.path.join(cls.git_dir, 'steps-guix')
|
steps_extra = f"steps-{extra_build}"
|
||||||
if not os.path.isdir(steps_guix_dir):
|
steps_extra_dir = os.path.join(cls.git_dir, steps_extra)
|
||||||
raise ValueError("steps-guix directory does not exist while --build-guix-also is set.")
|
if not os.path.isdir(steps_extra_dir):
|
||||||
manifests.append(steps_guix_dir)
|
raise ValueError(
|
||||||
|
f"{steps_extra} directory does not exist while --extra-builds includes {extra_build}."
|
||||||
|
)
|
||||||
|
manifests.append(steps_extra_dir)
|
||||||
|
|
||||||
for steps_dir in manifests:
|
for steps_dir in manifests:
|
||||||
manifest_path = os.path.join(steps_dir, 'manifest')
|
manifest_path = os.path.join(steps_dir, 'manifest')
|
||||||
if not os.path.isfile(manifest_path):
|
if not os.path.isfile(manifest_path):
|
||||||
if steps_dir.endswith('steps-guix'):
|
|
||||||
raise ValueError("steps-guix/manifest does not exist while --build-guix-also is set.")
|
|
||||||
raise ValueError(f"Missing manifest: {manifest_path}")
|
raise ValueError(f"Missing manifest: {manifest_path}")
|
||||||
|
|
||||||
with open(manifest_path, 'r', encoding="utf_8") as file:
|
with open(manifest_path, 'r', encoding="utf_8") as file:
|
||||||
|
|
|
||||||
10
rootfs.py
10
rootfs.py
|
|
@ -314,8 +314,7 @@ def _update_stage0_tree(mountpoint,
|
||||||
with open(old_config_path, "r", encoding="utf-8") as cfg:
|
with open(old_config_path, "r", encoding="utf-8") as cfg:
|
||||||
lines = [
|
lines = [
|
||||||
line for line in cfg
|
line for line in cfg
|
||||||
if not line.startswith("BUILD_GUIX_ALSO=")
|
if not line.startswith("EXTRA_BUILDS=")
|
||||||
and not line.startswith("EXTRA_BUILDS=")
|
|
||||||
and not line.startswith("INTERNAL_CI=")
|
and not line.startswith("INTERNAL_CI=")
|
||||||
and not line.startswith(_RESUME_NEXT_SCOPE_VAR + "=")
|
and not line.startswith(_RESUME_NEXT_SCOPE_VAR + "=")
|
||||||
and not line.startswith(_RESUME_NEXT_PACKAGE_VAR + "=")
|
and not line.startswith(_RESUME_NEXT_PACKAGE_VAR + "=")
|
||||||
|
|
@ -613,9 +612,6 @@ def main():
|
||||||
parser.add_argument("--extra-builds",
|
parser.add_argument("--extra-builds",
|
||||||
help="Comma-separated extra build namespaces to run after main steps "
|
help="Comma-separated extra build namespaces to run after main steps "
|
||||||
"(e.g. guix or guix,gentoo,azl3).")
|
"(e.g. guix or guix,gentoo,azl3).")
|
||||||
parser.add_argument("--build-guix-also",
|
|
||||||
help=argparse.SUPPRESS,
|
|
||||||
action="store_true")
|
|
||||||
parser.add_argument("--no-create-config",
|
parser.add_argument("--no-create-config",
|
||||||
help="Do not automatically create config file",
|
help="Do not automatically create config file",
|
||||||
action="store_true")
|
action="store_true")
|
||||||
|
|
@ -658,8 +654,6 @@ def main():
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
args.extra_builds = parse_extra_builds(args.extra_builds)
|
args.extra_builds = parse_extra_builds(args.extra_builds)
|
||||||
if args.build_guix_also and "guix" not in args.extra_builds:
|
|
||||||
args.extra_builds.append("guix")
|
|
||||||
|
|
||||||
# Mode validation
|
# Mode validation
|
||||||
def check_types():
|
def check_types():
|
||||||
|
|
@ -786,7 +780,7 @@ def main():
|
||||||
repo_path=args.repo,
|
repo_path=args.repo,
|
||||||
early_preseed=args.early_preseed,
|
early_preseed=args.early_preseed,
|
||||||
mirrors=args.mirrors,
|
mirrors=args.mirrors,
|
||||||
build_guix_also=("guix" in args.extra_builds))
|
extra_builds=args.extra_builds)
|
||||||
|
|
||||||
bootstrap(args, generator, target, args.target_size, cleanup)
|
bootstrap(args, generator, target, args.target_size, cleanup)
|
||||||
cleanup()
|
cleanup()
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
#
|
#
|
||||||
# Guix extension manifest. Runs after main /steps manifest when BUILD_GUIX_ALSO=True.
|
# Guix extension manifest. Runs after main /steps manifest when EXTRA_BUILDS includes guix.
|
||||||
|
|
||||||
# We need a 64-bit kernel to enable Guix to run 64-bit programs.
|
# We need a 64-bit kernel to enable Guix to run 64-bit programs.
|
||||||
# Build 64-bit kernel
|
# Build 64-bit kernel
|
||||||
|
|
|
||||||
|
|
@ -18,10 +18,6 @@ if [ -d /steps/after ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
extra_builds="${EXTRA_BUILDS:-}"
|
extra_builds="${EXTRA_BUILDS:-}"
|
||||||
# Backward compatibility for older bootstrap.cfg.
|
|
||||||
if [ -z "${extra_builds}" ] && [ "${BUILD_GUIX_ALSO}" = True ]; then
|
|
||||||
extra_builds="guix"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -n "${extra_builds}" ]; then
|
if [ -n "${extra_builds}" ]; then
|
||||||
old_ifs="${IFS}"
|
old_ifs="${IFS}"
|
||||||
|
|
|
||||||
|
|
@ -122,10 +122,6 @@ EOF
|
||||||
cat >> /init <<- 'EOF'
|
cat >> /init <<- 'EOF'
|
||||||
run_extra_builds_if_requested() {
|
run_extra_builds_if_requested() {
|
||||||
extra_builds="${EXTRA_BUILDS:-}"
|
extra_builds="${EXTRA_BUILDS:-}"
|
||||||
# Backward compatibility for older bootstrap.cfg.
|
|
||||||
if [ -z "${extra_builds}" ] && [ "${BUILD_GUIX_ALSO}" = True ]; then
|
|
||||||
extra_builds="guix"
|
|
||||||
fi
|
|
||||||
if [ -z "${extra_builds}" ]; then
|
if [ -z "${extra_builds}" ]; then
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue