From 34d54e8c931585b27d093de875bdd277c662b89a Mon Sep 17 00:00:00 2001 From: James Simpson Date: Mon, 7 Nov 2022 13:45:31 +0800 Subject: T4796: Move additional_repositories Declare in architectures/amd64, not in defaults --- data/architectures/amd64.toml | 9 +++++++-- data/defaults.toml | 5 ----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/data/architectures/amd64.toml b/data/architectures/amd64.toml index 02027aa6..abfec53a 100644 --- a/data/architectures/amd64.toml +++ b/data/architectures/amd64.toml @@ -1,3 +1,10 @@ +additional_repositories = [ + "deb [arch=amd64] https://repo.saltproject.io/py3/debian/11/amd64/3004 bullseye main", + "deb [arch=amd64] http://repo.powerdns.com/debian bullseye-rec-48 main" +] + +kernel_flavor = "amd64-vyos" + # Packages added to images for x86 by default packages = [ "grub2", @@ -6,5 +13,3 @@ packages = [ "vyos-intel-qat", "telegraf" ] - -kernel_flavor = "amd64-vyos" diff --git a/data/defaults.toml b/data/defaults.toml index b14fceeb..2819b216 100644 --- a/data/defaults.toml +++ b/data/defaults.toml @@ -14,11 +14,6 @@ release_train = "current" kernel_version = "5.15.77" -additional_repositories = [ - "deb [arch=amd64] https://repo.saltproject.io/py3/debian/11/amd64/3004 bullseye main", - "deb [arch=amd64] http://repo.powerdns.com/debian bullseye-rec-48 main" -] - website_url = "https://vyos.io" support_url = "https://support.vyos.io" bugtracker_url = "https://phabricator.vyos.net" -- cgit v1.2.3 From 509d4500da6868381b770539e8474ccee5212458 Mon Sep 17 00:00:00 2001 From: James Simpson Date: Mon, 7 Nov 2022 13:47:45 +0800 Subject: T4796: Correct function name from dict_merge --- scripts/build-vyos-image | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/build-vyos-image b/scripts/build-vyos-image index 9bb48ed1..0b12752c 100755 --- a/scripts/build-vyos-image +++ b/scripts/build-vyos-image @@ -71,7 +71,7 @@ def merge_dicts(source, destination): if key not in tmp: tmp[key] = value elif isinstance(source[key], dict): - tmp[key] = dict_merge(source[key], tmp[key]) + tmp[key] = merge_dicts(source[key], tmp[key]) elif isinstance(source[key], list): tmp[key] = source[key] + tmp[key] else: -- cgit v1.2.3 From 048aa40655583543b8e67313f7d57307592910cc Mon Sep 17 00:00:00 2001 From: James Simpson Date: Mon, 7 Nov 2022 13:48:50 +0800 Subject: T4796: Fix ARCHIVES_DIR reference --- scripts/build-vyos-image | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/build-vyos-image b/scripts/build-vyos-image index 0b12752c..a9859ee6 100755 --- a/scripts/build-vyos-image +++ b/scripts/build-vyos-image @@ -397,7 +397,7 @@ if __name__ == "__main__": # Add custom APT keys if has_nonempty_key(build_config, 'custom_apt_key'): - key_dir = ARCHIVES_DIR + key_dir = defaults.ARCHIVES_DIR for k in build_config['custom_apt_key']: dst_name = '{0}.key.chroot'.format(os.path.basename(k)) shutil.copy(k, os.path.join(key_dir, dst_name)) -- cgit v1.2.3 From f4bfaa9b9782a7b255f9240270e4629711b62f86 Mon Sep 17 00:00:00 2001 From: James Simpson Date: Mon, 7 Nov 2022 13:50:34 +0800 Subject: T4796: Move and update custom_apt_entry logic Rather than only looking at the default config, look at the merged build_config. Check wether additional_repositories is actually defined before trying to reference it. --- scripts/build-vyos-image | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/build-vyos-image b/scripts/build-vyos-image index a9859ee6..5242a7dd 100755 --- a/scripts/build-vyos-image +++ b/scripts/build-vyos-image @@ -206,10 +206,6 @@ if __name__ == "__main__": print("Use --build-type=release option if you want to set version number") sys.exit(1) - if not args['custom_apt_entry']: - args['custom_apt_entry'] = [] - args['custom_apt_entry'] = args['custom_apt_entry'] + build_defaults['additional_repositories'] - ## Inject some useful hardcoded options args['build_dir'] = defaults.BUILD_DIR args['pbuilder_config'] = os.path.join(defaults.BUILD_DIR, defaults.PBUILDER_CONFIG) @@ -385,6 +381,10 @@ if __name__ == "__main__": f.write(vyos_repo_entry) # Add custom APT entries + if not args['custom_apt_entry']: + args['custom_apt_entry'] = [] + if build_config['additional_repositories']: + args['custom_apt_entry'] = args['custom_apt_entry'] + build_config['additional_repositories'] if build_config['custom_apt_entry']: custom_apt_file = defaults.CUSTOM_REPO_FILE entries = "\n".join(build_config['custom_apt_entry']) -- cgit v1.2.3