From a0a06f9fb67a12e5a400f957b787b9c5a4af372a Mon Sep 17 00:00:00 2001 From: ralf Date: Thu, 17 Oct 2024 08:34:27 +0200 Subject: [PATCH] always verify version in composer.json matches release tag, before creating archives --- doc/rpm-build/checkout-build-archives.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/doc/rpm-build/checkout-build-archives.php b/doc/rpm-build/checkout-build-archives.php index 282a954ac4..197c9be0a1 100755 --- a/doc/rpm-build/checkout-build-archives.php +++ b/doc/rpm-build/checkout-build-archives.php @@ -1181,6 +1181,16 @@ function do_copy() // we need to stash uncommited changes, before copying if (file_exists($config['checkoutdir'].'/.git')) run_cmd("cd $config[checkoutdir]; git stash"); + // verify version in composer.json matches release-tag + if (!($json = file_get_contents($path=$config['checkoutdir'].'/composer.json')) || !($json = json_decode($json, true)) || !is_array($json)) + { + throw new Exception("Can NOT read $path to verify version!"); + } + if ($json['version'] !== $config['version']) + { + throw new Exception("Version in composer.json does not match: '$json[version]' !== '$config[version] --> aborting!"); + } + try { $cmd = '/usr/bin/rsync -r --delete --delete-excluded --exclude .svn --exclude .git\* --exclude tests '.$config['checkoutdir'].'/ '.$config['egw_buildroot'].'/'.$config['aliasdir'].'/'; run_cmd($cmd);