summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/check-qemu-install4
-rwxr-xr-xscripts/image-build/build-vyos-image103
-rw-r--r--scripts/image-build/defaults.py2
-rw-r--r--scripts/image-build/raw_image.py2
-rw-r--r--scripts/package-build/amazon-cloudwatch-agent/.gitignore7
l---------scripts/package-build/amazon-cloudwatch-agent/build.py (renamed from scripts/package-build/pam_tacplus/build.py)0
-rw-r--r--scripts/package-build/amazon-cloudwatch-agent/package.toml14
-rw-r--r--scripts/package-build/amazon-ssm-agent/.gitignore (renamed from scripts/package-build/pam_tacplus/.gitignore)4
l---------scripts/package-build/amazon-ssm-agent/build.py1
-rw-r--r--scripts/package-build/amazon-ssm-agent/package.toml16
-rwxr-xr-xscripts/package-build/build.py15
-rw-r--r--scripts/package-build/dropbear/.gitignore2
-rw-r--r--scripts/package-build/dropbear/package.toml4
-rw-r--r--scripts/package-build/frr/.gitignore1
-rw-r--r--scripts/package-build/frr/package.toml2
-rw-r--r--scripts/package-build/frr/patches/0001-Enable-PCRE2-in-Debian-package-builds.patch24
-rw-r--r--scripts/package-build/hsflowd/.gitignore1
-rw-r--r--scripts/package-build/hsflowd/package.toml2
-rw-r--r--scripts/package-build/isc-dhcp/.gitignore2
-rw-r--r--scripts/package-build/isc-dhcp/package.toml2
-rwxr-xr-xscripts/package-build/linux-kernel/build-intel-ixgbe.sh28
-rwxr-xr-xscripts/package-build/linux-kernel/build-intel-ixgbevf.sh28
-rwxr-xr-xscripts/package-build/linux-kernel/build-intel-qat.sh28
-rwxr-xr-xscripts/package-build/linux-kernel/build.py38
-rw-r--r--scripts/package-build/netfilter/.gitignore2
-rwxr-xr-xscripts/package-build/netfilter/build.py6
-rw-r--r--scripts/package-build/openvpn-otp/.gitignore1
-rw-r--r--scripts/package-build/openvpn-otp/package.toml2
-rw-r--r--scripts/package-build/pam_tacplus/package.toml19
-rw-r--r--scripts/package-build/podman/package.toml2
-rw-r--r--scripts/package-build/strongswan/.gitignore1
-rw-r--r--scripts/package-build/strongswan/package.toml2
-rw-r--r--scripts/package-build/tacacs/.gitignore9
l---------scripts/package-build/tacacs/build.py1
-rw-r--r--scripts/package-build/tacacs/package.toml24
-rw-r--r--scripts/package-build/waagent/package.toml2
-rwxr-xr-xscripts/utils/merge-flavors76
37 files changed, 357 insertions, 120 deletions
diff --git a/scripts/check-qemu-install b/scripts/check-qemu-install
index 8d65f8b2..7faea56f 100755
--- a/scripts/check-qemu-install
+++ b/scripts/check-qemu-install
@@ -563,7 +563,7 @@ try:
def verify_config():
# Verify encrypted config is loaded
c.sendline('show config commands | cat')
- c.expect('set system option performance \'latency\'')
+ c.expect('set system option performance \'network-latency\'')
c.expect('set system option reboot-on-panic')
c.expect(op_mode_prompt)
@@ -600,7 +600,7 @@ try:
log.info('Adding nodes for encrypted config test')
c.sendline('configure')
c.expect(cfg_mode_prompt)
- c.sendline('set system option performance latency')
+ c.sendline('set system option performance network-latency')
c.expect(cfg_mode_prompt)
c.sendline('set system option reboot-on-panic')
c.expect(cfg_mode_prompt)
diff --git a/scripts/image-build/build-vyos-image b/scripts/image-build/build-vyos-image
index a9294f38..1fc2c6c3 100755
--- a/scripts/image-build/build-vyos-image
+++ b/scripts/image-build/build-vyos-image
@@ -25,6 +25,7 @@ import copy
import uuid
import glob
import json
+import base64
import shutil
import argparse
import datetime
@@ -62,7 +63,7 @@ except Exception as e:
# Checkout vyos-1x under build directory
try:
branch_name = build_defaults['vyos_branch']
- url_vyos_1x = 'https://github.com/vyos/vyos-1x'
+ url_vyos_1x = os.getenv('VYOS1X_REPO_URL', default='https://github.com/vyos/vyos-1x')
path_vyos_1x = os.path.join(defaults.BUILD_DIR, 'vyos-1x')
try:
repo_vyos_1x = git.Repo.clone_from(url_vyos_1x, path_vyos_1x, no_checkout=True)
@@ -191,9 +192,10 @@ if __name__ == "__main__":
'pbuilder-debian-mirror': ('Debian repository mirror for pbuilder env bootstrap', None),
'vyos-mirror': ('VyOS package mirror', None),
'build-type': ('Build type, release or development', lambda x: x in ['release', 'development']),
- 'version': ('Version number (release builds only)', None),
+ 'version': ('Version string', None),
'build-comment': ('Optional build comment', None),
- 'build-hook-opts': ('Custom options for the post-build hook', None)
+ 'build-hook-opts': ('Custom options for the post-build hook', None),
+ 'bootloaders': ('Bootloaders to include in the image', None)
}
# Create the option parser
@@ -259,28 +261,24 @@ if __name__ == "__main__":
pre_build_config = merge_defaults(args, defaults=pre_build_config, skip_none=True)
# Some fixup for mirror settings.
- # The idea is: if --debian-mirror is specified but --pbuilder-debian-mirror is not,
- # use the --debian-mirror value for both lb and pbuilder bootstrap
- if pre_build_config['debian_mirror'] is None or pre_build_config['debian_security_mirror'] is None:
- print("E: debian_mirror and debian_security_mirror cannot be empty")
+ # The idea is: if --debian-mirror is specified
+ # but --pbuilder-debian-mirror or --debian-security-mirror are not,
+ # use the --debian-mirror value for those
+ if pre_build_config['debian_mirror'] is None:
+ print("E: debian_mirror must be specified")
sys.exit(1)
if pre_build_config['pbuilder_debian_mirror'] is None:
- args['pbuilder_debian_mirror'] = pre_build_config['pbuilder_debian_mirror'] = pre_build_config['debian_mirror']
-
- # Version can only be set for release builds,
- # for dev builds it hardly makes any sense
- if pre_build_config['build_type'] == 'development':
- if args['version'] is not None:
- print("E: Version can only be set for release builds")
- print("Use --build-type=release option if you want to set version number")
- sys.exit(1)
+ pre_build_config['pbuilder_debian_mirror'] = pre_build_config['debian_mirror']
+
+ if pre_build_config['debian_security_mirror'] is None:
+ pre_build_config['debian_security_mirror'] = pre_build_config['debian_mirror']
# Validate characters in version name
- if 'version' in args and args['version'] != None:
+ if args.get('version'):
allowed = string.ascii_letters + string.digits + '.' + '-' + '+'
if not set(args['version']) <= set(allowed):
- print(f'Version contained illegal character(s), allowed: {allowed}')
+ print(f'Version string contains illegal character(s), allowed: {allowed}')
sys.exit(1)
## Inject some useful hardcoded options
@@ -306,6 +304,11 @@ if __name__ == "__main__":
build_config = merge_defaults(flavor_config, defaults=build_config)
build_config = merge_defaults(args, defaults=build_config, skip_none=True)
+ # If Debian mirror is specified explicitly but Debian security mirror is not,
+ # assume that the user wants to use that mirror for security updates as well.
+ if (args['debian_mirror'] is not None) and (args['debian_security_mirror'] is None):
+ build_config['debian_security_mirror'] = args['debian_mirror']
+
## Rename and merge some fields for simplicity
## E.g. --custom-packages is for the user, but internally
## it's added to the same package list as everything else
@@ -326,6 +329,10 @@ if __name__ == "__main__":
print("E: image format is not specified in the build flavor file")
sys.exit(1)
+ ## Override bootloaders if specified
+ if args['bootloaders'] is not None:
+ build_config['bootloaders'] = args['bootloaders']
+
## Add default boot settings if needed
if "boot_settings" not in build_config:
build_config["boot_settings"] = defaults.boot_settings
@@ -412,8 +419,10 @@ if __name__ == "__main__":
build_git = ""
git_branch = ""
- # Create the build version string
- if build_config['build_type'] == 'development':
+ # Create the build version string, if it's not explicitly given
+ if build_config.get('version'):
+ version = build_config['version']
+ else:
try:
if not git_branch:
raise ValueError("git branch could not be determined")
@@ -428,9 +437,6 @@ if __name__ == "__main__":
except Exception as e:
print("W: Could not build a version string specific to git branch, falling back to default: {0}".format(str(e)))
version = "999.{0}".format(build_timestamp)
- else:
- # Release build, use the version from ./configure arguments
- version = build_config['version']
version_data = {
'version': version,
@@ -503,8 +509,9 @@ DOCUMENTATION_URL="{build_config['documentation_url']}"
## Create live-build configuration files
# Add the additional repositories to package lists
- print("I: Setting up additional APT entries")
+ print("I: Setting up VyOS repository APT entries")
vyos_repo_entry = "deb {vyos_mirror} {vyos_branch} main\n".format(**build_config)
+ vyos_repo_entry += "deb-src {vyos_mirror} {vyos_branch} main\n".format(**build_config)
apt_file = defaults.VYOS_REPO_FILE
@@ -516,10 +523,36 @@ DOCUMENTATION_URL="{build_config['documentation_url']}"
f.write(vyos_repo_entry)
# Add custom APT entries
+ print("I: Setting up additional APT entries")
if build_config.get('additional_repositories', False):
- build_config['custom_apt_entry'] += build_config['additional_repositories']
+ for r in build_config['additional_repositories']:
+ repo_data = build_config['additional_repositories'][r]
+
+ url = repo_data.get('url', None)
+ arch = repo_data.get('architecture', None)
+ distro = repo_data.get('distribution', build_config['debian_distribution'])
+ components = repo_data.get('components', 'main')
+
+ if not url:
+ print(f'E: repository {r} does not specify URL')
+ sys.exit(1)
+
+ if arch:
+ arch_string = f'[arch={arch}]'
+ else:
+ arch_string = ''
+
+ entry = f'deb {arch_string} {url} {distro} {components}'
+ build_config['custom_apt_entry'].append(entry)
+
+ if not repo_data.get('no_source', False):
+ src_entry = f'deb-src {url} {distro} {components}'
+ build_config['custom_apt_entry'].append(src_entry)
+
+ if repo_data.get('key', None):
+ build_config['custom_apt_keys'].append({'name': r, 'key': repo_data['key']})
- if build_config.get('custom_apt_entry', False):
+ if build_config.get('custom_apt_entry', []):
custom_apt_file = defaults.CUSTOM_REPO_FILE
entries = "\n".join(build_config['custom_apt_entry'])
if debug:
@@ -530,11 +563,13 @@ DOCUMENTATION_URL="{build_config['documentation_url']}"
f.write("\n")
# Add custom APT keys
- if has_nonempty_key(build_config, 'custom_apt_key'):
+ if has_nonempty_key(build_config, 'custom_apt_keys'):
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))
+ for k in build_config['custom_apt_keys']:
+ dst_name = '{0}.key.chroot'.format(k['name'])
+ with open(os.path.join(key_dir, dst_name), 'bw') as f:
+ key_data = base64.b64decode(k['key'])
+ f.write(key_data)
# Add custom packages
if has_nonempty_key(build_config, 'packages'):
@@ -644,7 +679,7 @@ Pin-Priority: 600
# If not, build additional flavors from the ISO.
if build_config["image_format"] != ["iso"]:
# For all non-iso formats, we always build a raw image first
- raw_image = raw_image.create_raw_image(build_config, iso_file, "tmp/")
+ version_data, raw_image = raw_image.create_raw_image(build_config, iso_file, "tmp/")
manifest['artifacts'].append(raw_image)
# If there are other formats in the flavor, the assumptions is that
@@ -674,8 +709,10 @@ Pin-Priority: 600
hook_opts = build_config["build_hook_opts"]
else:
hook_opts = ""
- custom_image = rc_cmd(f"./build_hook {raw_image} {build_config['version']} \
- {build_config['architecture']} {hook_opts}")
+ build_hook_command = f"./build_hook {raw_image} {version_data['version']} \
+ {build_config['architecture']} {hook_opts}"
+ print(f'I: executing build hook command: {build_hook_command}')
+ custom_image = rc_cmd(build_hook_command)
manifest['artifacts'].append(custom_image)
# Filter out unwanted files from the artifact list
diff --git a/scripts/image-build/defaults.py b/scripts/image-build/defaults.py
index a0c5c8bf..29a6d59f 100644
--- a/scripts/image-build/defaults.py
+++ b/scripts/image-build/defaults.py
@@ -35,7 +35,7 @@ boot_settings: dict[str, str] = {
# Hardcoded default values
HARDCODED_BUILD = {
'custom_apt_entry': [],
- 'custom_apt_key': [],
+ 'custom_apt_keys': [],
'custom_package': [],
'reuse_iso': None,
'disk_size': 10,
diff --git a/scripts/image-build/raw_image.py b/scripts/image-build/raw_image.py
index dedb6f5e..d850eead 100644
--- a/scripts/image-build/raw_image.py
+++ b/scripts/image-build/raw_image.py
@@ -210,4 +210,4 @@ def create_raw_image(build_config, iso_file, work_dir):
install_image(con, version)
install_grub(con, version)
- return raw_file
+ return (version_data, raw_file)
diff --git a/scripts/package-build/amazon-cloudwatch-agent/.gitignore b/scripts/package-build/amazon-cloudwatch-agent/.gitignore
new file mode 100644
index 00000000..7f8e0127
--- /dev/null
+++ b/scripts/package-build/amazon-cloudwatch-agent/.gitignore
@@ -0,0 +1,7 @@
+amazon-cloudwatch-agent/
+*.buildinfo
+*.build
+*.changes
+*.deb
+*.dsc
+*.tar.gz
diff --git a/scripts/package-build/pam_tacplus/build.py b/scripts/package-build/amazon-cloudwatch-agent/build.py
index 3c76af73..3c76af73 120000
--- a/scripts/package-build/pam_tacplus/build.py
+++ b/scripts/package-build/amazon-cloudwatch-agent/build.py
diff --git a/scripts/package-build/amazon-cloudwatch-agent/package.toml b/scripts/package-build/amazon-cloudwatch-agent/package.toml
new file mode 100644
index 00000000..833096d4
--- /dev/null
+++ b/scripts/package-build/amazon-cloudwatch-agent/package.toml
@@ -0,0 +1,14 @@
+[[packages]]
+name = "amazon-cloudwatch-agent"
+commit_id = "v1.300050.0"
+scm_url = "https://github.com/aws/amazon-cloudwatch-agent"
+
+build_cmd = """
+
+make prepackage package-deb
+ARCH=$(dpkg --print-architecture)
+TAG=$(git describe --tags --abbrev=0)
+COMMIT=$(git rev-parse --short HEAD)
+cp ./build/bin/linux/${ARCH}/*.deb ../amazon-cloudwatch-agent_${TAG}_${COMMIT}_${ARCH}.deb
+
+"""
diff --git a/scripts/package-build/pam_tacplus/.gitignore b/scripts/package-build/amazon-ssm-agent/.gitignore
index 04e8d4e9..f70728cf 100644
--- a/scripts/package-build/pam_tacplus/.gitignore
+++ b/scripts/package-build/amazon-ssm-agent/.gitignore
@@ -1,7 +1,7 @@
-pam_tacplus/
-pam_tacplus-debian/
+amazon-ssm-agent/
*.buildinfo
*.build
*.changes
*.deb
*.dsc
+*.tar.gz
diff --git a/scripts/package-build/amazon-ssm-agent/build.py b/scripts/package-build/amazon-ssm-agent/build.py
new file mode 120000
index 00000000..3c76af73
--- /dev/null
+++ b/scripts/package-build/amazon-ssm-agent/build.py
@@ -0,0 +1 @@
+../build.py \ No newline at end of file
diff --git a/scripts/package-build/amazon-ssm-agent/package.toml b/scripts/package-build/amazon-ssm-agent/package.toml
new file mode 100644
index 00000000..ecd2fdf6
--- /dev/null
+++ b/scripts/package-build/amazon-ssm-agent/package.toml
@@ -0,0 +1,16 @@
+[[packages]]
+name = "amazon-ssm-agent"
+commit_id = "3.3.1311.0"
+scm_url = "https://github.com/aws/amazon-ssm-agent"
+
+build_cmd = """
+
+ARCH=$(dpkg --print-architecture)
+TAG=$(git describe --tags --abbrev=0)
+COMMIT=$(git rev-parse --short HEAD)
+
+make build-linux
+make package-deb
+cp ./bin/debian_${ARCH}/*.deb ../amazon-ssm-agent_${TAG}_${COMMIT}_${ARCH}.deb
+
+"""
diff --git a/scripts/package-build/build.py b/scripts/package-build/build.py
index 0648b564..7212b6cf 100755
--- a/scripts/package-build/build.py
+++ b/scripts/package-build/build.py
@@ -75,12 +75,11 @@ def prepare_package(repo_dir: Path, install_data: str) -> None:
raise
-def build_package(package: list, dependencies: list, patch_dir: Path) -> None:
+def build_package(package: list, patch_dir: Path) -> None:
"""Build a package from the repository
Args:
package (list): List of Packages from toml
- dependencies (list): List of additional dependencies
patch_dir (Path): Directory containing patches
"""
repo_name = package['name']
@@ -94,9 +93,6 @@ def build_package(package: list, dependencies: list, patch_dir: Path) -> None:
# Check out the specific commit
run(['git', 'checkout', package['commit_id']], cwd=repo_dir, check=True)
- # Ensure dependencies
- ensure_dependencies(dependencies)
-
# Apply patches if any
if (repo_dir / 'patches'):
apply_patches(repo_dir, patch_dir)
@@ -177,11 +173,14 @@ if __name__ == '__main__':
packages = config['packages']
patch_dir = Path(args.patch_dir)
- for package in packages:
- dependencies = package.get('dependencies', {}).get('packages', [])
+ # Load global dependencies
+ global_dependencies = config.get('dependencies', {}).get('packages', [])
+ if global_dependencies:
+ ensure_dependencies(global_dependencies)
+ for package in packages:
# Build the package
- build_package(package, dependencies, patch_dir)
+ build_package(package, patch_dir)
# Clean up build dependency packages after build
cleanup_build_deps(Path(package['name']))
diff --git a/scripts/package-build/dropbear/.gitignore b/scripts/package-build/dropbear/.gitignore
index 6e8cff9c..3d080d7c 100644
--- a/scripts/package-build/dropbear/.gitignore
+++ b/scripts/package-build/dropbear/.gitignore
@@ -4,4 +4,4 @@ dropbear/
*.changes
*.deb
*.dsc
-
+*.tar.gz
diff --git a/scripts/package-build/dropbear/package.toml b/scripts/package-build/dropbear/package.toml
index cbb885ee..a00aad3d 100644
--- a/scripts/package-build/dropbear/package.toml
+++ b/scripts/package-build/dropbear/package.toml
@@ -3,5 +3,5 @@ name = "dropbear"
commit_id = "debian/2022.83-1+deb12u1"
scm_url = "https://salsa.debian.org/debian/dropbear.git"
-[packages.dependencies]
-packages = ["libpam0g-dev"] \ No newline at end of file
+[dependencies]
+packages = ["libpam0g-dev"]
diff --git a/scripts/package-build/frr/.gitignore b/scripts/package-build/frr/.gitignore
index 590895c0..f22f6747 100644
--- a/scripts/package-build/frr/.gitignore
+++ b/scripts/package-build/frr/.gitignore
@@ -6,3 +6,4 @@ libyang/
*.changes
*.deb
*.dsc
+*.tar.gz
diff --git a/scripts/package-build/frr/package.toml b/scripts/package-build/frr/package.toml
index 48d51ae6..caae3537 100644
--- a/scripts/package-build/frr/package.toml
+++ b/scripts/package-build/frr/package.toml
@@ -16,7 +16,7 @@ commit_id = "stable/9.1"
scm_url = "https://github.com/FRRouting/frr.git"
build_cmd = "sudo dpkg -i ../*.deb; sudo dpkg-buildpackage -us -uc -tc -b -Ppkg.frr.rtrlib,pkg.frr.lua"
-[packages.dependencies]
+[dependencies]
packages = [
"chrpath",
"gawk",
diff --git a/scripts/package-build/frr/patches/0001-Enable-PCRE2-in-Debian-package-builds.patch b/scripts/package-build/frr/patches/0001-Enable-PCRE2-in-Debian-package-builds.patch
new file mode 100644
index 00000000..c31c4a85
--- /dev/null
+++ b/scripts/package-build/frr/patches/0001-Enable-PCRE2-in-Debian-package-builds.patch
@@ -0,0 +1,24 @@
+From 21800432167ac022c01772df993efca8d4969b38 Mon Sep 17 00:00:00 2001
+From: Daniil Baturin <daniil@baturin.org>
+Date: Wed, 6 Nov 2024 15:58:10 +0000
+Subject: [PATCH] Enable PCRE2 in Debian package builds
+
+---
+ debian/rules | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/debian/rules b/debian/rules
+index 43e5d7e61..1f971ab22 100755
+--- a/debian/rules
++++ b/debian/rules
+@@ -69,6 +69,7 @@ override_dh_auto_configure:
+ --enable-vty-group=frrvty \
+ --enable-configfile-mask=0640 \
+ --enable-logfile-mask=0640 \
++ --enable-pcre2posix \
+ # end
+
+ override_dh_auto_install:
+--
+2.47.0
+
diff --git a/scripts/package-build/hsflowd/.gitignore b/scripts/package-build/hsflowd/.gitignore
index d0964b29..ecb384cd 100644
--- a/scripts/package-build/hsflowd/.gitignore
+++ b/scripts/package-build/hsflowd/.gitignore
@@ -4,3 +4,4 @@ host-sflow/
*.changes
*.deb
*.dsc
+*.tar.gz
diff --git a/scripts/package-build/hsflowd/package.toml b/scripts/package-build/hsflowd/package.toml
index 75d320a7..8418319e 100644
--- a/scripts/package-build/hsflowd/package.toml
+++ b/scripts/package-build/hsflowd/package.toml
@@ -4,5 +4,5 @@ commit_id = "v2.0.55-1"
scm_url = "https://github.com/sflow/host-sflow.git"
build_cmd = "make deb FEATURES='PCAP DROPMON DBUS'"
-[packages.dependencies]
+[dependencies]
packages = ["libpcap0.8-dev"]
diff --git a/scripts/package-build/isc-dhcp/.gitignore b/scripts/package-build/isc-dhcp/.gitignore
index 66d17cc8..3f2ca44a 100644
--- a/scripts/package-build/isc-dhcp/.gitignore
+++ b/scripts/package-build/isc-dhcp/.gitignore
@@ -4,4 +4,4 @@ isc-dhcp/
*.changes
*.deb
*.dsc
-
+*.tar.gz
diff --git a/scripts/package-build/isc-dhcp/package.toml b/scripts/package-build/isc-dhcp/package.toml
index 76a0e4a1..f07e71e3 100644
--- a/scripts/package-build/isc-dhcp/package.toml
+++ b/scripts/package-build/isc-dhcp/package.toml
@@ -3,5 +3,5 @@ name = "isc-dhcp"
commit_id = "debian/4.4.3-P1-4"
scm_url = "https://salsa.debian.org/debian/isc-dhcp"
-[packages.dependencies]
+[dependencies]
packages = ["libpam0g-dev"]
diff --git a/scripts/package-build/linux-kernel/build-intel-ixgbe.sh b/scripts/package-build/linux-kernel/build-intel-ixgbe.sh
index 797ed60f..fabfb7af 100755
--- a/scripts/package-build/linux-kernel/build-intel-ixgbe.sh
+++ b/scripts/package-build/linux-kernel/build-intel-ixgbe.sh
@@ -97,17 +97,17 @@ fpm --input-type dir --output-type deb --name vyos-intel-${DRIVER_NAME} \
--depends linux-image-${KERNEL_VERSION}${KERNEL_SUFFIX} \
--license "GPL2" -C ${DEBIAN_DIR} --after-install ${DEBIAN_POSTINST}
-echo "I: Cleanup ${DRIVER_NAME} source"
-cd ${CWD}
-if [ -e ${DRIVER_FILE} ]; then
- rm -f ${DRIVER_FILE}
-fi
-if [ -d ${DRIVER_DIR} ]; then
- rm -rf ${DRIVER_DIR}
-fi
-if [ -d ${DEBIAN_DIR} ]; then
- rm -rf ${DEBIAN_DIR}
-fi
-if [ -f ${DEBIAN_POSTINST} ]; then
- rm -f ${DEBIAN_POSTINST}
-fi
+# echo "I: Cleanup ${DRIVER_NAME} source"
+# cd ${CWD}
+# if [ -e ${DRIVER_FILE} ]; then
+# rm -f ${DRIVER_FILE}
+# fi
+# if [ -d ${DRIVER_DIR} ]; then
+# rm -rf ${DRIVER_DIR}
+# fi
+# if [ -d ${DEBIAN_DIR} ]; then
+# rm -rf ${DEBIAN_DIR}
+# fi
+# if [ -f ${DEBIAN_POSTINST} ]; then
+# rm -f ${DEBIAN_POSTINST}
+# fi
diff --git a/scripts/package-build/linux-kernel/build-intel-ixgbevf.sh b/scripts/package-build/linux-kernel/build-intel-ixgbevf.sh
index 7d389832..f0e4c89b 100755
--- a/scripts/package-build/linux-kernel/build-intel-ixgbevf.sh
+++ b/scripts/package-build/linux-kernel/build-intel-ixgbevf.sh
@@ -89,17 +89,17 @@ fpm --input-type dir --output-type deb --name vyos-intel-${DRIVER_NAME} \
--depends linux-image-${KERNEL_VERSION}${KERNEL_SUFFIX} \
--license "GPL2" -C ${DEBIAN_DIR} --after-install ${DEBIAN_POSTINST}
-echo "I: Cleanup ${DRIVER_NAME} source"
-cd ${CWD}
-if [ -e ${DRIVER_FILE} ]; then
- rm -f ${DRIVER_FILE}
-fi
-if [ -d ${DRIVER_DIR} ]; then
- rm -rf ${DRIVER_DIR}
-fi
-if [ -d ${DEBIAN_DIR} ]; then
- rm -rf ${DEBIAN_DIR}
-fi
-if [ -f ${DEBIAN_POSTINST} ]; then
- rm -f ${DEBIAN_POSTINST}
-fi
+# echo "I: Cleanup ${DRIVER_NAME} source"
+# cd ${CWD}
+# if [ -e ${DRIVER_FILE} ]; then
+# rm -f ${DRIVER_FILE}
+# fi
+# if [ -d ${DRIVER_DIR} ]; then
+# rm -rf ${DRIVER_DIR}
+# fi
+# if [ -d ${DEBIAN_DIR} ]; then
+# rm -rf ${DEBIAN_DIR}
+# fi
+# if [ -f ${DEBIAN_POSTINST} ]; then
+# rm -f ${DEBIAN_POSTINST}
+# fi
diff --git a/scripts/package-build/linux-kernel/build-intel-qat.sh b/scripts/package-build/linux-kernel/build-intel-qat.sh
index fb6ccbb5..c2c364a9 100755
--- a/scripts/package-build/linux-kernel/build-intel-qat.sh
+++ b/scripts/package-build/linux-kernel/build-intel-qat.sh
@@ -101,17 +101,17 @@ fpm --input-type dir --output-type deb --name vyos-intel-${DRIVER_NAME} \
--depends linux-image-${KERNEL_VERSION}${KERNEL_SUFFIX} \
--license "GPL2" -C ${DEBIAN_DIR} --after-install ${DEBIAN_POSTINST}
-echo "I: Cleanup ${DRIVER_NAME} source"
-cd ${CWD}
-if [ -e ${DRIVER_FILE} ]; then
- rm -f ${DRIVER_FILE}
-fi
-if [ -d ${DRIVER_DIR} ]; then
- rm -rf ${DRIVER_DIR}
-fi
-if [ -d ${DEBIAN_DIR} ]; then
- rm -rf ${DEBIAN_DIR}
-fi
-if [ -f ${DEBIAN_POSTINST} ]; then
- rm -f ${DEBIAN_POSTINST}
-fi
+# echo "I: Cleanup ${DRIVER_NAME} source"
+# cd ${CWD}
+# if [ -e ${DRIVER_FILE} ]; then
+# rm -f ${DRIVER_FILE}
+# fi
+# if [ -d ${DRIVER_DIR} ]; then
+# rm -rf ${DRIVER_DIR}
+# fi
+# if [ -d ${DEBIAN_DIR} ]; then
+# rm -rf ${DEBIAN_DIR}
+# fi
+# if [ -f ${DEBIAN_POSTINST} ]; then
+# rm -f ${DEBIAN_POSTINST}
+# fi
diff --git a/scripts/package-build/linux-kernel/build.py b/scripts/package-build/linux-kernel/build.py
index b16e0702..1433eaa8 100755
--- a/scripts/package-build/linux-kernel/build.py
+++ b/scripts/package-build/linux-kernel/build.py
@@ -63,6 +63,40 @@ def clone_or_update_repo(repo_dir: Path, scm_url: str, commit_id: str) -> None:
run(['git', 'checkout', commit_id], cwd=repo_dir, check=True)
+def create_tarball(package_name, source_dir=None):
+ """Creates a .tar.gz archive of the specified directory.
+
+ Args:
+ package_name (str): The name of the package. This will also be the name of the output tarball.
+ source_dir (str, optional): The directory to be archived. If not provided, defaults to `package_name`.
+
+ Raises:
+ FileNotFoundError: If the specified `source_dir` does not exist.
+ Exception: If an error occurs during tarball creation.
+
+ Example:
+ >>> create_tarball("linux-6.6.56")
+ I: Tarball created: linux-6.6.56.tar.gz
+
+ >>> create_tarball("my-package", "/path/to/source")
+ I: Tarball created: my-package.tar.gz
+ """
+ # Use package_name as the source directory if source_dir is not provided
+ source_dir = source_dir or package_name
+ output_tarball = f"{package_name}.tar.gz"
+
+ # Check if the source directory exists
+ if not os.path.isdir(source_dir):
+ raise FileNotFoundError(f"Directory '{source_dir}' does not exist.")
+
+ # Create the tarball
+ try:
+ shutil.make_archive(base_name=output_tarball.replace('.tar.gz', ''), format='gztar', root_dir=source_dir)
+ print(f"I: Tarball created: {output_tarball}")
+ except Exception as e:
+ print(f"I: Failed to create tarball for {package_name}: {e}")
+
+
def build_package(package: dict, dependencies: list) -> None:
"""Build a package from the repository
@@ -88,10 +122,13 @@ def build_package(package: dict, dependencies: list) -> None:
# Execute the build command
if package['build_cmd'] == 'build_kernel':
build_kernel(package['kernel_version'])
+ create_tarball(f'{package["name"]}-{package["kernel_version"]}', f'linux-{package["kernel_version"]}')
elif package['build_cmd'] == 'build_linux_firmware':
build_linux_firmware(package['commit_id'], package['scm_url'])
+ create_tarball(f'{package["name"]}-{package["commit_id"]}', f'{package["name"]}')
elif package['build_cmd'] == 'build_accel_ppp':
build_accel_ppp(package['commit_id'], package['scm_url'])
+ create_tarball(f'{package["name"]}-{package["commit_id"]}', f'{package["name"]}')
elif package['build_cmd'] == 'build_intel_qat':
build_intel_qat()
elif package['build_cmd'] == 'build_intel_ixgbe':
@@ -106,6 +143,7 @@ def build_package(package: dict, dependencies: list) -> None:
build_jool()
elif package['build_cmd'] == 'build_openvpn_dco':
build_openvpn_dco(package['commit_id'], package['scm_url'])
+ create_tarball(f'{package["name"]}-{package["commit_id"]}', f'{package["name"]}')
elif package['build_cmd'] == 'build_nat_rtsp':
build_nat_rtsp(package['commit_id'], package['scm_url'])
else:
diff --git a/scripts/package-build/netfilter/.gitignore b/scripts/package-build/netfilter/.gitignore
index 9bf39f82..c6444404 100644
--- a/scripts/package-build/netfilter/.gitignore
+++ b/scripts/package-build/netfilter/.gitignore
@@ -5,4 +5,4 @@
*.changes
*.deb
*.dsc
-
+*.tar.gz
diff --git a/scripts/package-build/netfilter/build.py b/scripts/package-build/netfilter/build.py
index 9737b7d3..d15b5770 100755
--- a/scripts/package-build/netfilter/build.py
+++ b/scripts/package-build/netfilter/build.py
@@ -112,6 +112,12 @@ def build_package(package: dict, dependencies: list, patch_dir: Path) -> None:
# Apply patches if any
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('/', '_')
+ tarball_name = f"{repo_name}_{commit_id_sanitized}.tar.gz"
+ run(['tar', '-czf', tarball_name, '-C', str(repo_dir.parent), repo_name], check=True)
+ print(f"I: Tarball created: {tarball_name}")
+
# Prepare the package if required
if package.get('prepare_package', False):
prepare_package(repo_dir, package.get('install_data', ''))
diff --git a/scripts/package-build/openvpn-otp/.gitignore b/scripts/package-build/openvpn-otp/.gitignore
index 7f89da2b..60dd3cad 100644
--- a/scripts/package-build/openvpn-otp/.gitignore
+++ b/scripts/package-build/openvpn-otp/.gitignore
@@ -4,3 +4,4 @@ openvpn-otp/
*.changes
*.deb
*.dsc
+*.tar.gz
diff --git a/scripts/package-build/openvpn-otp/package.toml b/scripts/package-build/openvpn-otp/package.toml
index 72209ad1..bdbc6d9d 100644
--- a/scripts/package-build/openvpn-otp/package.toml
+++ b/scripts/package-build/openvpn-otp/package.toml
@@ -1,6 +1,6 @@
[[packages]]
name = "openvpn-otp"
-commit_id = "master"
+commit_id = "9781ff1"
scm_url = "https://github.com/evgeny-gridasov/openvpn-otp"
# build_cmd = "cd ..; ./build-openvpn-otp.sh"
diff --git a/scripts/package-build/pam_tacplus/package.toml b/scripts/package-build/pam_tacplus/package.toml
deleted file mode 100644
index 79b28544..00000000
--- a/scripts/package-build/pam_tacplus/package.toml
+++ /dev/null
@@ -1,19 +0,0 @@
-[[packages]]
-name = "pam_tacplus-debian"
-commit_id = "50c6fd7"
-scm_url = "https://github.com/kravietz/pam_tacplus-debian"
-build_cmd = "/bin/true"
-
-[[packages]]
-name = "pam_tacplus"
-#commit_id = "4f91b0d" # This commit cannot build the package
-commit_id = "b839c44"
-scm_url = "https://github.com/kravietz/pam_tacplus"
-
-#build_cmd = "sudo mk-build-deps --install --tool 'apt-get --yes --no-install-recommends'; cd ..; ./build.sh"
-build_cmd = """
-cp -a ../pam_tacplus-debian debian
-rm -f debian/compat
-sudo mk-build-deps --install --tool 'apt-get --yes --no-install-recommends'
-dpkg-buildpackage -uc -us -tc -b -d
-"""
diff --git a/scripts/package-build/podman/package.toml b/scripts/package-build/podman/package.toml
index 952af518..707f3d7e 100644
--- a/scripts/package-build/podman/package.toml
+++ b/scripts/package-build/podman/package.toml
@@ -20,7 +20,7 @@ fpm --input-type dir --output-type deb --name podman \
--license "Apache License 2.0" -C podman-v$VERSION --package ..
"""
-[packages.dependencies]
+[dependencies]
packages = [
"libseccomp-dev",
"libgpgme-dev"
diff --git a/scripts/package-build/strongswan/.gitignore b/scripts/package-build/strongswan/.gitignore
index ec612740..f1ad761d 100644
--- a/scripts/package-build/strongswan/.gitignore
+++ b/scripts/package-build/strongswan/.gitignore
@@ -4,3 +4,4 @@ strongswan/
*.changes
*.deb
*.dsc
+*.tar.gz
diff --git a/scripts/package-build/strongswan/package.toml b/scripts/package-build/strongswan/package.toml
index 8cedd4ac..a5722062 100644
--- a/scripts/package-build/strongswan/package.toml
+++ b/scripts/package-build/strongswan/package.toml
@@ -13,7 +13,7 @@ dpkg-buildpackage -uc -us -tc -b -d
cd ..; ./build-vici.sh
"""
-[packages.dependencies]
+[dependencies]
packages = [
"bison",
"bzip2",
diff --git a/scripts/package-build/tacacs/.gitignore b/scripts/package-build/tacacs/.gitignore
new file mode 100644
index 00000000..142020c5
--- /dev/null
+++ b/scripts/package-build/tacacs/.gitignore
@@ -0,0 +1,9 @@
+libnss-tacplus/
+libpam-tacplus/
+libtacplus-map/
+*.buildinfo
+*.build
+*.changes
+*.deb
+*.dsc
+*.tar.gz
diff --git a/scripts/package-build/tacacs/build.py b/scripts/package-build/tacacs/build.py
new file mode 120000
index 00000000..3c76af73
--- /dev/null
+++ b/scripts/package-build/tacacs/build.py
@@ -0,0 +1 @@
+../build.py \ No newline at end of file
diff --git a/scripts/package-build/tacacs/package.toml b/scripts/package-build/tacacs/package.toml
new file mode 100644
index 00000000..fde9df6e
--- /dev/null
+++ b/scripts/package-build/tacacs/package.toml
@@ -0,0 +1,24 @@
+[[packages]]
+name = "libtacplus-map"
+commit_id = "master"
+scm_url = "https://github.com/vyos/libtacplus-map.git"
+build_cmd = "dpkg-buildpackage -us -uc -tc -b"
+
+[[packages]]
+name = "libpam-tacplus"
+commit_id = "master"
+scm_url = "https://github.com/vyos/libpam-tacplus.git"
+build_cmd = "sudo dpkg -i ../libtacplus-map*.deb; dpkg-buildpackage -us -uc -tc -b"
+
+[[packages]]
+name = "libnss-tacplus"
+commit_id = "master"
+scm_url = "https://github.com/vyos/libnss-tacplus.git"
+build_cmd = "sudo dpkg -i ../libtac*.deb ../libpam-tacplus*.deb; dpkg-buildpackage -us -uc -tc -b"
+
+[dependencies]
+packages = [
+ "libpam-dev",
+ "autoconf-archive",
+ "libaudit-dev"
+]
diff --git a/scripts/package-build/waagent/package.toml b/scripts/package-build/waagent/package.toml
index d7343a7a..1a382baa 100644
--- a/scripts/package-build/waagent/package.toml
+++ b/scripts/package-build/waagent/package.toml
@@ -3,5 +3,5 @@ name = "waagent"
commit_id = "debian/2.9.1.1-2"
scm_url = "https://salsa.debian.org/cloud-team/waagent.git"
-[packages.dependencies]
+[dependencies]
packages = ["dpkg-source-gitarchive"]
diff --git a/scripts/utils/merge-flavors b/scripts/utils/merge-flavors
new file mode 100755
index 00000000..79f8180e
--- /dev/null
+++ b/scripts/utils/merge-flavors
@@ -0,0 +1,76 @@
+#!/usr/bin/env python3
+#
+# Copyright (C) 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
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# Purpose: merges multiple flavor files into one
+
+import sys
+
+import tomli
+import tomli_w
+
+def load_flavor(file_path):
+ with open(file_path, 'rb') as f:
+ flavor_def = tomli.load(f)
+
+ return flavor_def
+
+# XXX: at the moment, this script is only used
+# to produce a meta-flavor for collecting packages
+# used in multiple flavors,
+# so it ignores all other flavor fields for now
+def merge_flavors(l, r):
+ if 'packages' in r:
+ l['packages'] += r['packages']
+
+ for arch in r.get('architectures', []):
+ if arch not in l['architectures']:
+ l['architectures'][arch] = {}
+
+ if 'packages' not in l['architectures'][arch]:
+ l['architectures'][arch]['packages'] = []
+
+ if 'packages' in r['architectures'][arch]:
+ l['architectures'][arch]['packages'] += \
+ r['architectures'][arch]['packages']
+
+ return l
+
+if __name__ == '__main__':
+ if len(sys.argv) < 3:
+ print("Please specify a base flavor and a list of flavor files to merge!")
+ sys.exit(1)
+
+ base_flavor = load_flavor(sys.argv[1])
+
+ if 'architectures' not in base_flavor:
+ base_flavor['architectures'] = {}
+
+ if 'packages' not in base_flavor:
+ base_flavor['packages'] = []
+
+ flavor_files = sys.argv[2:]
+ flavor_defs = map(load_flavor, flavor_files)
+
+ for fd in flavor_defs:
+ merge_flavors(base_flavor, fd)
+
+ base_flavor['packages'] = list(set(base_flavor['packages']))
+ for arch in base_flavor.get('architectures'):
+ if 'packages' in base_flavor['architectures'][arch]:
+ base_flavor['architectures'][arch]['packages'] = \
+ list(set(base_flavor['architectures'][arch]['packages']))
+
+ print(tomli_w.dumps(base_flavor))