From 142cca7995585da99922b40b3ca07303cc59c2cf Mon Sep 17 00:00:00 2001 From: gitlost Date: Tue, 24 Nov 2020 15:40:14 +0000 Subject: [PATCH] tools/update_version.php: zint.h -> zintconfig.h; remove CMakeLists.txt, backend_qt --- tools/update_version.php | 51 ++-------------------------------------- 1 file changed, 2 insertions(+), 49 deletions(-) diff --git a/tools/update_version.php b/tools/update_version.php index d6f57136..c967b95c 100644 --- a/tools/update_version.php +++ b/tools/update_version.php @@ -108,44 +108,6 @@ function rc_replace($file, $rc_str) { } } -// CMakeLists.txt - -$file = $data_dirname . 'CMakeLists.txt'; - -if (($get = file_get_contents($file)) === false) { - exit("$basename: ERROR: Could not read file \"$file\"" . PHP_EOL); -} - -$lines = explode("\n", $get); -$done = 0; -foreach ($lines as $li => $line) { - if (preg_match('/\(ZINT_VERSION_(MAJOR|MINOR|RELEASE)/', $line, $matches)) { - $cnt = 0; - $mmr = $matches[1] === "MAJOR" ? $major : ($matches[1] === "MINOR" ? $minor : $release); - $lines[$li] = preg_replace('/[0-9]+\)/', $mmr . ')', $line, 1, $cnt); - if ($cnt === 0 || $lines[$li] === NULL) { - exit("$basename: ERROR: Could not replace ZINT_VERSION_{$matches[1]} in file \"$file\"" . PHP_EOL); - } - $done++; - } elseif (preg_match('/\(ZINT_VERSION_BUILD/', $line)) { - $cnt = 0; - $lines[$li] = preg_replace('/"\.?[0-9]*"\)/', '"' . ($build ? ".$build" : '') . '")', $line, 1, $cnt); - if ($cnt === 0 || $lines[$li] === NULL) { - exit("$basename: ERROR: Could not replace ZINT_VERSION_BUILD in file \"$file\"" . PHP_EOL); - } - $done++; - } - if ($done === 4) { - break; - } -} -if ($done !== 4) { - exit("$basename: ERROR: Only did $done replacements of 4 in file \"$file\"" . PHP_EOL); -} -if (!file_put_contents($file, implode("\n", $lines))) { - exit("$basename: ERROR: Could not write file \"$file\"" . PHP_EOL); -} - // zint.spec version_replace(1, $data_dirname . 'zint.spec', '/^Version:/', '/[0-9.]+/', $v_base_str); @@ -158,9 +120,9 @@ version_replace(1, $data_dirname . 'zint.nsi', '/^!define +PRODUCT_VERSION/', '/ rc_replace($data_dirname . 'backend/libzint.rc', $rc_str); -// backend/zint.h +// backend/zintconfig.h -$file = $data_dirname . 'backend/zint.h'; +$file = $data_dirname . 'backend/zintconfig.h'; if (($get = file_get_contents($file)) === false) { exit("$basename: ERROR: Could not read file \"$file\"" . PHP_EOL); @@ -200,15 +162,6 @@ if (!file_put_contents($file, implode("\n", $lines))) { version_replace(1, $data_dirname . 'backend/Makefile.mingw', '/^ZINT_VERSION:=-DZINT_VERSION=/', '/[0-9.]+/', $v_str); -// backend_qt/backend_vc8.pro - -version_replace(1, $data_dirname . 'backend_qt/backend_vc8.pro', '/^VERSION[ \t]*=/', '/[0-9.]+/', $v_str); - -// backend_qt/backend_qt.pro - -version_replace(1, $data_dirname . 'backend_qt/backend_qt.pro', '/ZINT_VERSION="/', '/[0-9.]+/', $v_str); -version_replace(1, $data_dirname . 'backend_qt/backend_qt.pro', '/^VERSION[ \t]*=/', '/[0-9.]+/', $v_str); - // backend_tcl/zint.c version_replace(1, $data_dirname . 'backend_tcl/zint.c', '/#define[ \t]+VERSION[ \t]+"/', '/[0-9.]+/', $v_str);