summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/check-qemu-install12
-rwxr-xr-xscripts/package-build/build.py44
-rw-r--r--scripts/package-build/hsflowd/package.toml2
-rw-r--r--scripts/package-build/linux-kernel/arch/arm64/configs/vyos_defconfig2
-rw-r--r--scripts/package-build/linux-kernel/arch/x86/configs/vyos_defconfig2
-rw-r--r--scripts/package-build/opennhrp/.gitignore1
-rw-r--r--scripts/package-build/opennhrp/package.toml21
-rw-r--r--scripts/package-build/vpp/.gitignore1
-rw-r--r--scripts/package-build/vpp/package.toml20
-rw-r--r--scripts/package-build/vyos-1x/.gitignore2
l---------scripts/package-build/vyos-1x/build.py (renamed from scripts/package-build/opennhrp/build.py)0
-rw-r--r--scripts/package-build/vyos-1x/package.toml11
12 files changed, 86 insertions, 32 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/hsflowd/package.toml b/scripts/package-build/hsflowd/package.toml
index 8418319e..05ec13fe 100644
--- a/scripts/package-build/hsflowd/package.toml
+++ b/scripts/package-build/hsflowd/package.toml
@@ -2,7 +2,7 @@
name = "host-sflow"
commit_id = "v2.0.55-1"
scm_url = "https://github.com/sflow/host-sflow.git"
-build_cmd = "make deb FEATURES='PCAP DROPMON DBUS'"
+build_cmd = "make deb FEATURES='PCAP DROPMON DBUS PSAMPLE'"
[dependencies]
packages = ["libpcap0.8-dev"]
diff --git a/scripts/package-build/linux-kernel/arch/arm64/configs/vyos_defconfig b/scripts/package-build/linux-kernel/arch/arm64/configs/vyos_defconfig
index 91f26660..9592b39b 100644
--- a/scripts/package-build/linux-kernel/arch/arm64/configs/vyos_defconfig
+++ b/scripts/package-build/linux-kernel/arch/arm64/configs/vyos_defconfig
@@ -1735,7 +1735,7 @@ CONFIG_RFKILL_INPUT=y
# CONFIG_CAIF is not set
# CONFIG_CEPH_LIB is not set
# CONFIG_NFC is not set
-# CONFIG_PSAMPLE is not set
+CONFIG_PSAMPLE=y
# CONFIG_NET_IFE is not set
CONFIG_LWTUNNEL=y
CONFIG_LWTUNNEL_BPF=y
diff --git a/scripts/package-build/linux-kernel/arch/x86/configs/vyos_defconfig b/scripts/package-build/linux-kernel/arch/x86/configs/vyos_defconfig
index a77a6a13..f33cde92 100644
--- a/scripts/package-build/linux-kernel/arch/x86/configs/vyos_defconfig
+++ b/scripts/package-build/linux-kernel/arch/x86/configs/vyos_defconfig
@@ -1780,7 +1780,7 @@ CONFIG_RFKILL_INPUT=y
# CONFIG_CAIF is not set
# CONFIG_CEPH_LIB is not set
# CONFIG_NFC is not set
-# CONFIG_PSAMPLE is not set
+CONFIG_PSAMPLE=y
# CONFIG_NET_IFE is not set
CONFIG_LWTUNNEL=y
CONFIG_LWTUNNEL_BPF=y
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 ../
diff --git a/scripts/package-build/vyos-1x/.gitignore b/scripts/package-build/vyos-1x/.gitignore
new file mode 100644
index 00000000..990c6351
--- /dev/null
+++ b/scripts/package-build/vyos-1x/.gitignore
@@ -0,0 +1,2 @@
+/vyos-1x/
+/vyos-vpp/
diff --git a/scripts/package-build/opennhrp/build.py b/scripts/package-build/vyos-1x/build.py
index 3c76af73..3c76af73 120000
--- a/scripts/package-build/opennhrp/build.py
+++ b/scripts/package-build/vyos-1x/build.py
diff --git a/scripts/package-build/vyos-1x/package.toml b/scripts/package-build/vyos-1x/package.toml
new file mode 100644
index 00000000..6dcbadb3
--- /dev/null
+++ b/scripts/package-build/vyos-1x/package.toml
@@ -0,0 +1,11 @@
+[[packages]]
+name = "vyos-vpp"
+commit_id = "current"
+scm_url = "https://github.com/vyos/vyos-vpp.git"
+build_cmd = "/bin/true"
+
+[[packages]]
+name = "vyos-1x"
+commit_id = "current"
+scm_url = "https://github.com/vyos/vyos-1x.git"
+build_cmd = "rsync -av --exclude='.git' --exclude='.github' --exclude='README*' --exclude='LICENSE' --exclude='*.md' ../vyos-vpp/ ./; dpkg-buildpackage -us -uc -F"