diff options
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/check-qemu-install | 12 | ||||
-rwxr-xr-x | scripts/package-build/build.py | 44 | ||||
-rw-r--r-- | scripts/package-build/libpam-radius-auth/.gitignore | 1 | ||||
l--------- | scripts/package-build/libpam-radius-auth/build.py (renamed from scripts/package-build/opennhrp/build.py) | 0 | ||||
-rw-r--r-- | scripts/package-build/libpam-radius-auth/package.toml | 10 | ||||
-rw-r--r-- | scripts/package-build/opennhrp/.gitignore | 1 | ||||
-rw-r--r-- | scripts/package-build/opennhrp/package.toml | 21 | ||||
-rw-r--r-- | scripts/package-build/vpp/.gitignore | 1 | ||||
-rw-r--r-- | scripts/package-build/vpp/package.toml | 20 |
9 files changed, 81 insertions, 29 deletions
diff --git a/scripts/check-qemu-install b/scripts/check-qemu-install index 11083706..5a59f13c 100755 --- a/scripts/check-qemu-install +++ b/scripts/check-qemu-install @@ -1,6 +1,6 @@ #!/usr/bin/env python3 # -# Copyright (C) 2019-2024, VyOS maintainers and contributors +# Copyright (C) 2019-2025, 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 @@ -95,6 +95,8 @@ parser.add_argument('--sbtest', help='Execute Secure Boot tests', action='store_true', default=False) parser.add_argument('--qemu-cmd', help='Only generate QEMU launch command', action='store_true', default=False) +parser.add_argument('--cpu', help='Set QEMU CPU', type=int, default=2) +parser.add_argument('--memory', help='Set QEMU memory', type=int, default=4) args = parser.parse_args() @@ -168,11 +170,11 @@ def get_qemu_cmd(name, enable_uefi, disk_img, raid=None, iso_img=None, tpm=False macbase = '00:00:5E:00:53' cmd = f'qemu-system-x86_64 \ -name "{name}" \ - -smp 2,sockets=1,cores=2,threads=1 \ + -smp {args.cpu},sockets=1,cores={args.cpu},threads=1 \ -cpu host \ -machine {machine},accel=kvm \ {uefi} \ - -m 4G \ + -m {args.memory}G \ -vga none \ -nographic \ {vga} {vnc}\ @@ -546,6 +548,10 @@ try: c.sendline('systemd-detect-virt') c.expect('kvm') c.expect(op_mode_prompt) + c.sendline('show system cpu') + c.expect(op_mode_prompt) + c.sendline('show system memory') + c.expect(op_mode_prompt) ################################################# # Verify /etc/os-release via lsb_release diff --git a/scripts/package-build/build.py b/scripts/package-build/build.py index d64a7378..9c1df7b3 100755 --- a/scripts/package-build/build.py +++ b/scripts/package-build/build.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 # -# Copyright (C) 2024 VyOS maintainers and contributors +# Copyright (C) 2024-2025 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 @@ -92,9 +92,45 @@ def build_package(package: list, patch_dir: Path) -> None: # Check out the specific commit run(['git', 'checkout', package['commit_id']], cwd=repo_dir, check=True) - # Apply patches if any - if (repo_dir / 'patches'): - apply_patches(repo_dir, patch_dir / repo_name) + # The `pre_build_hook` is an optional configuration defined in `package.toml`. + # It executes after the repository is checked out and before the build process begins. + # This hook allows you to perform preparatory tasks, such as creating directories, + # copying files, or running custom scripts/commands. + # + # Usage: + # - Single command: + # pre_build_hook = "echo 'Hello Pre-Build-Hook'" + # + # - Multi-line commands: + # pre_build_hook = """ + # mkdir -p ../hello/vyos + # mkdir -p ../vyos + # cp example.txt ../vyos + # """ + # + # - Combination of commands and scripts: + # pre_build_hook = "ls -l; ./script.sh" + pre_build_hook = package.get('pre_build_hook', '') + if pre_build_hook: + try: + print(f'I: execute pre_build_hook for the package "{repo_name}"') + run(pre_build_hook, cwd=repo_dir, check=True, shell=True) + except CalledProcessError as e: + print(e) + print(f"I: pre_build_hook failed for the {repo_name}") + raise + + # Apply patches if the 'apply_patches' key is set to True (default) in the package configuration + # This allows skipping patch application for specific packages when desired + # + # Usage: + # apply_patches = false + # + # Default to True if the key is missing + if package.get('apply_patches', True): + # Check if the 'patches' directory exists in the repository + if (repo_dir / 'patches'): + apply_patches(repo_dir, patch_dir / repo_name) # Sanitize the commit ID and build a tarball for the package commit_id_sanitized = package['commit_id'].replace('/', '_') diff --git a/scripts/package-build/libpam-radius-auth/.gitignore b/scripts/package-build/libpam-radius-auth/.gitignore new file mode 100644 index 00000000..b6ba8742 --- /dev/null +++ b/scripts/package-build/libpam-radius-auth/.gitignore @@ -0,0 +1 @@ +/libpam-radius-auth/ diff --git a/scripts/package-build/opennhrp/build.py b/scripts/package-build/libpam-radius-auth/build.py index 3c76af73..3c76af73 120000 --- a/scripts/package-build/opennhrp/build.py +++ b/scripts/package-build/libpam-radius-auth/build.py diff --git a/scripts/package-build/libpam-radius-auth/package.toml b/scripts/package-build/libpam-radius-auth/package.toml new file mode 100644 index 00000000..d2c760c8 --- /dev/null +++ b/scripts/package-build/libpam-radius-auth/package.toml @@ -0,0 +1,10 @@ +[[packages]] +name = "libpam-radius-auth" +commit_id = "current" +scm_url = "https://github.com/vyos/libpam-radius-auth.git" + +[dependencies] +packages = [ + "libpam-dev", + "libaudit-dev" +] diff --git a/scripts/package-build/opennhrp/.gitignore b/scripts/package-build/opennhrp/.gitignore deleted file mode 100644 index a06f6fde..00000000 --- a/scripts/package-build/opennhrp/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/opennhrp/ diff --git a/scripts/package-build/opennhrp/package.toml b/scripts/package-build/opennhrp/package.toml deleted file mode 100644 index d647c072..00000000 --- a/scripts/package-build/opennhrp/package.toml +++ /dev/null @@ -1,21 +0,0 @@ -[[packages]] -name = "opennhrp" -commit_id = "613277f" -scm_url = "https://git.code.sf.net/p/opennhrp/code" - -build_cmd = """ -make clean -make - -install --directory debian/etc debian/usr/sbin -install --mode 0644 etc/racoon-ph1dead.sh debian/etc -install --mode 0644 etc/racoon-ph1down.sh debian/etc -install --strip --mode 0755 nhrp/opennhrp debian/usr/sbin -install --strip --mode 0755 nhrp/opennhrpctl debian/usr/sbin - -fpm --input-type dir --output-type deb --name opennhrp \ - --version $(git describe --always | cut -c2-) --deb-compression gz \ - --maintainer "VyOS Package Maintainers <maintainers@vyos.net>" \ - --description "NBMA Next Hop Resolution Protocol daemon" \ - --license "MIT" -C debian --package .. -""" diff --git a/scripts/package-build/vpp/.gitignore b/scripts/package-build/vpp/.gitignore index 100411c4..38768675 100644 --- a/scripts/package-build/vpp/.gitignore +++ b/scripts/package-build/vpp/.gitignore @@ -1 +1,2 @@ /vpp/ +/vyos-vpp-patches/ diff --git a/scripts/package-build/vpp/package.toml b/scripts/package-build/vpp/package.toml index 255c3943..35a22896 100644 --- a/scripts/package-build/vpp/package.toml +++ b/scripts/package-build/vpp/package.toml @@ -1,9 +1,29 @@ [[packages]] +name = "vyos-vpp-patches" +commit_id = "current" +scm_url = "https://github.com/vyos/vyos-vpp-patches" +build_cmd = "/bin/true" +apply_patches = false + +[[packages]] name = "vpp" commit_id = "stable/2406" scm_url = "https://github.com/FDio/vpp" +# Skip apply patches by build.py as we use them in build_cmd +apply_patches = false + +pre_build_hook = """ +mkdir -p ../patches/vpp/ +rsync -av ../vyos-vpp-patches/patches/vpp/ ../patches/vpp/ +""" build_cmd = """ +# Patches for vpp should applied here +for patch in ../patches/vpp/*.patch; do + echo "I: build_cmd applying patch $patch..." + git -c user.email=maintainers@vyos.net -c user.name=vyos am "$patch" || { echo "Failed to apply patch $patch"; exit 1; } +done + make UNATTENDED=yes install-dep make pkg-deb cp build-root/*.deb ../ |