From effb05f5dd167ec042cc36e1384e74b2f04a7f81 Mon Sep 17 00:00:00 2001 From: Vitalii Koshura Date: Wed, 31 Jul 2024 01:22:00 +0200 Subject: [PATCH] [ci] check for upstream updates of the custom vcpkgs ports Signed-off-by: Vitalii Koshura --- .../workflows/check_custom_vcpkg_ports.yml | 42 +++++++++++++++ .../vcpkg_ports/ports/gdk-pixbuf/vcpkg.json | 1 + .../check_custom_vcpkg_ports_for_updates.py | 53 +++++++++++++++++++ 3 files changed, 96 insertions(+) create mode 100644 .github/workflows/check_custom_vcpkg_ports.yml create mode 100644 ci_tools/check_custom_vcpkg_ports_for_updates.py diff --git a/.github/workflows/check_custom_vcpkg_ports.yml b/.github/workflows/check_custom_vcpkg_ports.yml new file mode 100644 index 0000000000..bf01109b5d --- /dev/null +++ b/.github/workflows/check_custom_vcpkg_ports.yml @@ -0,0 +1,42 @@ +# This file is part of BOINC. +# http://boinc.berkeley.edu +# Copyright (C) 2024 University of California +# +# BOINC is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License +# as published by the Free Software Foundation, +# either version 3 of the License, or (at your option) any later version. +# +# BOINC 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 Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with BOINC. If not, see . + +name: Check vcpkg ports +on: + schedule: + - cron: '0 0 * * *' + +jobs: + build: + if: github.repository == 'BOINC/boinc' + name: ${{ matrix.type }} + runs-on: ubuntu-latest + strategy: + matrix: + type: [check] + fail-fast: false + steps: + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 + with: + fetch-depth: 2 + - name: Bootstrap vcpkg + run: | + ./linux/bootstrap_vcpkg_cmake.sh + - name: Check custom vcpkg ports for upstream updates + if: success() + run: | + python ./ci_tools/check_custom_vcpkg_ports_for_updates.py diff --git a/3rdParty/vcpkg_ports/ports/gdk-pixbuf/vcpkg.json b/3rdParty/vcpkg_ports/ports/gdk-pixbuf/vcpkg.json index 078a3d6051..e8538e05af 100644 --- a/3rdParty/vcpkg_ports/ports/gdk-pixbuf/vcpkg.json +++ b/3rdParty/vcpkg_ports/ports/gdk-pixbuf/vcpkg.json @@ -1,6 +1,7 @@ { "name": "gdk-pixbuf", "version": "2.42.12", + "port-version": 1, "description": "Image loading library.", "homepage": "https://gitlab.gnome.org/GNOME/gdk-pixbuf", "license": "LGPL-2.1-or-later", diff --git a/ci_tools/check_custom_vcpkg_ports_for_updates.py b/ci_tools/check_custom_vcpkg_ports_for_updates.py new file mode 100644 index 0000000000..40ca149cdf --- /dev/null +++ b/ci_tools/check_custom_vcpkg_ports_for_updates.py @@ -0,0 +1,53 @@ +import json +import os +import sys + +def get_vcpkg_ports(): + vcpkg_ports = [] + for root, _, files in os.walk('3rdParty/vcpkg_ports/ports'): + for file in files: + if file == 'vcpkg.json': + vcpkg_ports.append(os.path.join(root, file)) + return vcpkg_ports + +def get_port_info(port): + with open(port, 'r') as f: + data = json.load(f) + + name = data.get('name') + version = data.get('version') + port_version = data.get('port-version', 0) + + return name, version, port_version + +def parse_ports(file_path): + with open(file_path, 'r') as f: + data = json.load(f) + + ports_info = [] + for port, details in data.get('default', {}).items(): + baseline = details.get('baseline') + port_version = details.get('port-version', 0) + ports_info.append((port, baseline, port_version)) + + return ports_info + +def check_for_updated_ports(): + updated_ports = [] + for port in get_vcpkg_ports(): + name, version, port_version = get_port_info(port) + for port, baseline, baseline_version in parse_ports('3rdParty/linux/vcpkg/versions/baseline.json'): + if name == port and (version != baseline or port_version != baseline_version): + updated_ports.append((port, baseline, baseline_version)) + + return updated_ports + +updated_ports = check_for_updated_ports() +if (updated_ports): + print('The following ports have been updated:') + for port, baseline, baseline_version in updated_ports: + print(f'{port}: {baseline}:{baseline_version}') + sys.exit(1) +else: + print('All ports are up-to-date.') + sys.exit(0)