diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/package-build/amazon-cloudwatch-agent/.gitignore | 7 | ||||
l--------- | scripts/package-build/amazon-cloudwatch-agent/build.py | 1 | ||||
-rw-r--r-- | scripts/package-build/amazon-cloudwatch-agent/package.toml | 14 | ||||
-rw-r--r-- | scripts/package-build/amazon-ssm-agent/.gitignore | 7 | ||||
l--------- | scripts/package-build/amazon-ssm-agent/build.py | 1 | ||||
-rw-r--r-- | scripts/package-build/amazon-ssm-agent/package.toml | 16 | ||||
-rwxr-xr-x | scripts/utils/merge-flavors | 73 |
7 files changed, 119 insertions, 0 deletions
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/amazon-cloudwatch-agent/build.py b/scripts/package-build/amazon-cloudwatch-agent/build.py new file mode 120000 index 00000000..3c76af73 --- /dev/null +++ b/scripts/package-build/amazon-cloudwatch-agent/build.py @@ -0,0 +1 @@ +../build.py
\ No newline at end of file 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/amazon-ssm-agent/.gitignore b/scripts/package-build/amazon-ssm-agent/.gitignore new file mode 100644 index 00000000..f70728cf --- /dev/null +++ b/scripts/package-build/amazon-ssm-agent/.gitignore @@ -0,0 +1,7 @@ +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/utils/merge-flavors b/scripts/utils/merge-flavors new file mode 100755 index 00000000..013014e0 --- /dev/null +++ b/scripts/utils/merge-flavors @@ -0,0 +1,73 @@ +#!/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'] = {} + + 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)) |