diff options
author | zdc <zdc@users.noreply.github.com> | 2023-10-30 18:13:59 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-30 18:13:59 +0200 |
commit | 231dc565c0a6ad0a2f9366f8c38197a5007b7f8e (patch) | |
tree | fd671aa9f205027eab176d4a2a4a870ad1056332 /packages/keepalived/build.py | |
parent | af8092503dee57b0728be700cc961133cda1e225 (diff) | |
parent | 9db3647a1fc19ebaa56a641389cc8c75fd0d6acd (diff) | |
download | vyos-build-231dc565c0a6ad0a2f9366f8c38197a5007b7f8e.tar.gz vyos-build-231dc565c0a6ad0a2f9366f8c38197a5007b7f8e.zip |
Merge pull request #444 from vyos/mergify/bp/sagitta/pr-442
keepalived:T5402:Added patch with arp_ignore to 1 on IPv6 VMACs (backport #442)
Diffstat (limited to 'packages/keepalived/build.py')
-rwxr-xr-x | packages/keepalived/build.py | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/packages/keepalived/build.py b/packages/keepalived/build.py new file mode 100755 index 00000000..04f4791b --- /dev/null +++ b/packages/keepalived/build.py @@ -0,0 +1,50 @@ +#!/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 + """ + patches_dir = Path('../patches') + current_dir: str = Path.cwd().as_posix() + if patches_dir.exists(): + patches_list = list(patches_dir.iterdir()) + patches_list.sort() + Path(f'{current_dir}/debian/patches').mkdir(parents=True, exist_ok=True) + series_file = Path(f'{current_dir}/debian/patches/series') + series_data = '' + for patch_file in patches_list: + print(f'Applying patch: {patch_file.name}') + copy_file(patch_file, f'{current_dir}/debian/patches/') + if series_file.exists(): + series_data: str = series_file.read_text() + 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() |