diff options
author | Daniil Baturin <daniil@baturin.org> | 2024-02-19 13:28:07 +0000 |
---|---|---|
committer | Daniil Baturin <daniil@baturin.org> | 2024-02-19 13:28:07 +0000 |
commit | a45a1b3927e305707b35ead92b7483d53d0551ad (patch) | |
tree | 1c9c48501398ac3c14289fb0f14f6b50dbb04d37 | |
parent | 63369b1ac4b53706a11f0aae72b5d40d4e8030bf (diff) | |
download | vyos-build-a45a1b3927e305707b35ead92b7483d53d0551ad.tar.gz vyos-build-a45a1b3927e305707b35ead92b7483d53d0551ad.zip |
build: T3664: fix the chroot includes path
to account for the current working dir
-rwxr-xr-x | scripts/build-vyos-image | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/scripts/build-vyos-image b/scripts/build-vyos-image index 71001f2d..6b47fca7 100755 --- a/scripts/build-vyos-image +++ b/scripts/build-vyos-image @@ -1,6 +1,6 @@ #!/usr/bin/env python3 # -# Copyright (C) 2022 VyOS maintainers and contributors +# Copyright (C) 2022-2024 VyOS maintainers and contributors # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 or later as @@ -344,8 +344,15 @@ if __name__ == "__main__": BUG_REPORT_URL="{build_defaults['bugtracker_url']}" """ - chroot_includes_dir = os.path.join(defaults.BUILD_DIR, defaults.CHROOT_INCLUDES_DIR) - binary_includes_dir = os.path.join(defaults.BUILD_DIR, defaults.BINARY_INCLUDES_DIR) + # Switch to the build directory, this is crucial for the live-build work + # because the efective build config files etc. are there. + # + # All directory paths from this point must be relative to BUILD_DIR, + # not to the vyos-build repository root. + os.chdir(defaults.BUILD_DIR) + + chroot_includes_dir = defaults.CHROOT_INCLUDES_DIR + binary_includes_dir = defaults.BINARY_INCLUDES_DIR vyos_data_dir = os.path.join(chroot_includes_dir, "usr/share/vyos") os.makedirs(vyos_data_dir, exist_ok=True) with open(os.path.join(vyos_data_dir, 'version.json'), 'w') as f: @@ -366,11 +373,6 @@ if __name__ == "__main__": with open(os.path.join(chroot_includes_dir, 'usr/lib//os-release'), 'w') as f: print(os_release, file=f) - - ## Switch to the build directory, this is crucial for the live-build work work - ## because the efective build config files etc. are there - os.chdir(defaults.BUILD_DIR) - ## Clean up earlier build state and artifacts print("I: Cleaning the build workspace") os.system("lb clean") @@ -428,11 +430,12 @@ if __name__ == "__main__": if has_nonempty_key(build_config, "includes_chroot"): for i in build_config["includes_chroot"]: file_path = os.path.join(chroot_includes_dir, i["path"]) + if debug: + print(f"D: Creating chroot include file: {file_path}") os.makedirs(os.path.dirname(file_path), exist_ok=True) with open(file_path, 'w') as f: f.write(i["data"]) - ## Configure live-build lb_config_tmpl = jinja2.Template(""" lb config noauto \ |