Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 14 additions & 13 deletions build-rootfs

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find overlays to be more intuitive here given that the actual directories are prefixed overlay and how the contents are merged into the tree is like overlays are.
I understand it's not technically correct but dirs is generic and does not really give much information, while overlay does.
Maybe the bootc option should be merge-tree to be more explicit :)

/end of bikeshedding

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah. maybe the bootc-base-imagectl --add-dir should be changed to --overlay-dir ? If you want to PR that change we can then update it here?

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# This script is called by the Containerfile to build FCOS. Here's what it does at a high-level:
# 1. It gathers the list of FCOS-specific packages using the manifests.
# 2. It gathers the list of FCOS-specific overlays using the manifests.
# 3. It runs `bootc-base-imagectl rebuild`, passing in the packages and overlays.
# 3. It runs `bootc-base-imagectl make-rootfs`.
# 4. It injects various metadata (e.g. image.json, live/ bits, platforms.json, and disk.yaml).
# 5. It runs the postprocess scripts defined in the manifest.

Expand Down Expand Up @@ -165,7 +165,7 @@ def build_rootfs(target_rootfs, srcdir, manifest_name,
elif len(lockfile_repos) > 0:
raise Exception(f"unknown lockfile-repo found in {lockfile_repos}")

overlays = gather_overlays(manifest, srcdir)
add_dirs = gather_add_dirs(manifest, srcdir)
nodocs = (manifest.get('documentation') is False)
recommends = manifest.get('recommends')
# We generate the initramfs using dracut ourselves later after our
Expand All @@ -179,8 +179,8 @@ def build_rootfs(target_rootfs, srcdir, manifest_name,
with tempfile.NamedTemporaryFile(mode='w') as argsfile:
for pkg in packages:
argsfile.write(f"--install={pkg}\n")
for overlay in overlays:
argsfile.write(f"--add-dir={overlay}\n")
for add_dir in add_dirs:
argsfile.write(f"--add-dir={add_dir}\n")
if nodocs:
argsfile.write("--no-docs\n")
# temporarily work around https://issues.redhat.com/browse/RHEL-97826
Expand All @@ -198,6 +198,9 @@ def build_rootfs(target_rootfs, srcdir, manifest_name,
for locked_nevra in locked_nevras:
argsfile.write(f"--lock={locked_nevra}\n")
argsfile.flush()
# print out argsfile content for debugging
with open(argsfile.name, "r") as f:
print(f"Using following argsfile for bootc-base-imagectl:\n{f.read()}", flush=True)
cache_arg = []
if os.path.isdir('/cache') and rpm_ostree_has_cachedir_fix():
cache_arg = ['--cachedir=/cache']
Expand Down Expand Up @@ -226,7 +229,7 @@ def build_rootfs(target_rootfs, srcdir, manifest_name,
run_dracut(target_rootfs)
cleanup_extraneous_files(target_rootfs)

calculate_inputhash(target_rootfs, overlays, manifest)
calculate_inputhash(target_rootfs, add_dirs, manifest)

def get_bootc_base_imagectl_help():
return subprocess.check_output(['/usr/libexec/bootc-base-imagectl', 'build-rootfs', '-h'], encoding='utf-8')
Expand Down Expand Up @@ -331,7 +334,7 @@ def run_postprocess_scripts(rootfs, manifest):
with open(os.path.join(rootfs, name), mode='w') as f:
os.fchmod(f.fileno(), 0o755)
f.write(script)
print(f"Running CoreOS postprocess script {i}", flush=True)
print(f"\n<<< Running CoreOS postprocess script {i} >>>\n", flush=True)
bwrap(rootfs, [f'/{name}'], env=env)
os.unlink(os.path.join(rootfs, name))

Expand Down Expand Up @@ -453,19 +456,17 @@ def inject_version_info(rootfs, replace_version, version):
f.write(f'{k}={v}\n')


# This re-implements cosa's overlay logic.
def gather_overlays(manifest, srcdir):
overlays = []
def gather_add_dirs(manifest, srcdir):
add_dirs = []
for layer in manifest.get('ostree-layers', []):
Comment thread
dustymabe marked this conversation as resolved.
assert layer.startswith('overlay/')
overlays.append(os.path.join(srcdir, 'overlay.d', layer[len('overlay/'):]))
add_dirs.append(os.path.join(srcdir, layer))

rootfs_override = os.path.join(srcdir, 'overrides/rootfs')
if os.path.isdir(rootfs_override) and len(os.listdir(rootfs_override)) > 0:
print("Injecting rootfs override")
overlays.append(rootfs_override)
add_dirs.append(rootfs_override)

return overlays
return add_dirs


# Inject live/ bits.
Expand Down
4 changes: 0 additions & 4 deletions manifest.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
metadata:
# tell `cosa build` to default to buildah path
build_with_buildah: true

conditional-include:
# TODO: There is no coreos-pool for RISCV yet
# https://github.com/coreos/fedora-coreos-tracker/issues/1931
Expand Down
190 changes: 0 additions & 190 deletions manifests/fedora-coreos-base.yaml

This file was deleted.

Loading