diff options
author | Nicolas Fort <nicolasfort1988@gmail.com> | 2024-02-12 08:27:14 -0300 |
---|---|---|
committer | Nicolas Fort <nicolasfort1988@gmail.com> | 2024-02-12 08:27:14 -0300 |
commit | b31f5fe934bcb37534d49acdb5f7756bf05422e8 (patch) | |
tree | 48a285b78e01f1a1aaa69554ba7ab4d0bc934130 /packages/netfilter/build.py | |
parent | 8c5299e1cf7c7baa92a19c3ad78f468b1ffc672e (diff) | |
download | vyos-build-b31f5fe934bcb37534d49acdb5f7756bf05422e8.tar.gz vyos-build-b31f5fe934bcb37534d49acdb5f7756bf05422e8.zip |
T6009-6019: fix hour decoding when timezone offset is negative; bump libnftnl and nftables version.
Diffstat (limited to 'packages/netfilter/build.py')
-rwxr-xr-x | packages/netfilter/build.py | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/packages/netfilter/build.py b/packages/netfilter/build.py new file mode 100755 index 0000000..2851a67 --- /dev/null +++ b/packages/netfilter/build.py @@ -0,0 +1,55 @@ +#!/usr/bin/env python3 + +from pathlib import Path +from shutil import copy as copy_file +from subprocess import run + + +# copy patches +def apply_deb_patches() -> None: + """Apply patches to sources directory + """ + package_dir: str = Path.cwd().name + current_dir: str = Path.cwd().as_posix() + patches_dir = Path(f'../patches/{package_dir}') + patches_dir_dst = Path(f'{current_dir}/debian/patches') + if not patches_dir_dst.exists(): + patches_dir_dst.mkdir(parents = True) + if patches_dir.exists(): + patches_list = list(patches_dir.iterdir()) + patches_list.sort() + series_file = Path(f'{patches_dir_dst.as_posix()}/series') + if series_file.exists(): + series_data: str = series_file.read_text() + else: + + series_data = '' + for patch_file in patches_list: + print(f'Applying patch: {patch_file.name}') + copy_file(patch_file, f'{patches_dir_dst.as_posix()}') + series_data = f'{series_data}\n{patch_file.name}' + series_file.write_text(series_data) + + +def build_package() -> bool: + """Build a package + Returns: + bool: build status + """ + build_cmd: list[str] = ['dpkg-buildpackage', '-uc', '-us', '-tc', '-b'] + build_status: int = run(build_cmd).returncode + + if build_status: + return False + return True + + +# build a package +if __name__ == '__main__': + apply_deb_patches() + + if not build_package(): + exit(1) + + exit() + |