From f79571bca2929f1540168c67a651c75a7c59ec08 Mon Sep 17 00:00:00 2001
From: Marko Lindqvist <cazfi74@gmail.com>
Date: Sun, 6 Jul 2025 04:20:39 +0300
Subject: [PATCH 75/75] Drop rulesets_upgrade.sh.in & friends

- rulesets_upgrade.sh.in
- rulesets_save.sh.in
- ruleset_loads.sh.in

See RM #1574

Signed-off-by: Marko Lindqvist <cazfi74@gmail.com>
---
 configure.ac                          |  6 --
 tests/Makefile.am                     |  3 -
 tests/rs_test_res/ruleset_loads.sh.in | 26 --------
 tests/rulesets_save.sh.in             | 94 ---------------------------
 tests/rulesets_upgrade.sh.in          | 24 -------
 5 files changed, 153 deletions(-)
 delete mode 100644 tests/rs_test_res/ruleset_loads.sh.in
 delete mode 100644 tests/rulesets_save.sh.in
 delete mode 100644 tests/rulesets_upgrade.sh.in

diff --git a/configure.ac b/configure.ac
index 4844c2611e..9814bb591d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2006,12 +2006,6 @@ AC_CONFIG_FILES([fcruleup:bootstrap/fcruleup.in], [chmod +x fcruleup])
 if test "x$ruledit" = "xyes" ; then
   AC_CONFIG_FILES([fcruledit:bootstrap/fcruledit.in], [chmod +x fcruledit])
 fi
-AC_CONFIG_FILES([tests/rulesets_save.sh],
-                [chmod +x tests/rulesets_save.sh])
-AC_CONFIG_FILES([tests/rulesets_upgrade.sh],
-                [chmod +x tests/rulesets_upgrade.sh])
-AC_CONFIG_FILES([tests/rs_test_res/ruleset_loads.sh],
-                [chmod +x tests/rs_test_res/ruleset_loads.sh])
 AC_CONFIG_FILES([tests/rulesets_autohelp.sh],
                 [chmod +x tests/rulesets_autohelp.sh])
 
diff --git a/tests/Makefile.am b/tests/Makefile.am
index de079fef04..2b0ddad276 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -15,12 +15,9 @@ EXTRA_DIST =	check_macros.sh			\
 		generate_rs_save.sh		\
 		generate_rs_upgrade.sh		\
 		header_guard.sh			\
-		rulesets_save.sh.in		\
-		rulesets_upgrade.sh.in		\
 		rs_test_res/ruleset_is.lua	\
 		rs_test_res/ruleset_list_dist.txt \
 		rs_test_res/ruleset_list_opt.txt \
-		rs_test_res/ruleset_loads.sh.in	\
 		rs_test_res/generate_ruleset_loads.sh \
 		rulesets_autohelp.sh.in		\
 		src-check.sh			\
diff --git a/tests/rs_test_res/ruleset_loads.sh.in b/tests/rs_test_res/ruleset_loads.sh.in
deleted file mode 100644
index 0b5693bef2..0000000000
--- a/tests/rs_test_res/ruleset_loads.sh.in
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/usr/bin/env bash
-#/***********************************************************************
-# Freeciv - Copyright (C) 2017-2023
-#   This program is free software; you can redistribute it and/or modify
-#   it under the terms of the GNU General Public License as published by
-#   the Free Software Foundation; either version 2, or (at your option)
-#   any later version.
-#
-#   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.
-#
-#***********************************************************************/
-
-# ruleset_loads.sh ruleset
-# Exits with 0 when the specified ruleset is able to load. Exits with 1 if
-# it fails to load.
-
-(echo "lua unsafe-file @abs_top_srcdir@/tests/rs_test_res/ruleset_is.lua" \
- | (EXPECTED_RULESET=$1 @abs_top_builddir@/fcser \
-      -F --Announce none --ruleset $1)) \
-|| exit 1
-
-# The ruleset was able to load.
-exit 0
diff --git a/tests/rulesets_save.sh.in b/tests/rulesets_save.sh.in
deleted file mode 100644
index 72772e199b..0000000000
--- a/tests/rulesets_save.sh.in
+++ /dev/null
@@ -1,94 +0,0 @@
-#!/usr/bin/env bash
-#/***********************************************************************
-# Freeciv - Copyright (C) 2017-2025
-#   This program is free software; you can redistribute it and/or modify
-#   it under the terms of the GNU General Public License as published by
-#   the Free Software Foundation; either version 2, or (at your option)
-#   any later version.
-#
-#   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.
-#
-#***********************************************************************/
-
-# rulesets_save.sh [ruleset]...
-# Exits with 0 when each specified ruleset or, if no rulesets are specified,
-# each ruleset that is developed with Freeciv, can be saved using ruleup.
-# Exits with 1 if not.
-# If KEEP_RESULT_IN_DIR is set to a folder the saved result will be kept
-# there for later inspection even if nothing fails.
-
-if test "$1" = "" ; then
-  # Try to save all rulesets that are developed with Freeciv
-  rulesets="$(cat @abs_top_srcdir@/tests/rs_test_res/ruleset_list_dist.txt)"
-  optional="$(cat @abs_top_srcdir@/tests/rs_test_res/ruleset_list_opt.txt)"
-  for opt in $optional ; do
-    if test -d "@abs_top_srcdir@/data/$opt" ; then
-      rulesets="$rulesets $opt"
-    fi
-  done
-else
-  # Try to save the specified ruleset(s)
-  rulesets=$@
-fi
-
-if test "$KEEP_RESULT_IN_DIR" = "" ; then
-  # Put upgrade results in a temporary folder.
-  tmpdir=`mktemp -d`
-else
-  # Save the upgrade result to the specified folder
-  tmpdir=$KEEP_RESULT_IN_DIR
-fi
-
-if [ -d "${tmpdir}" ] ; then
-  cp -R @abs_top_srcdir@/data/ruledit/ "${tmpdir}" || exit 1
-  cp -R @abs_top_srcdir@/data/default/ "${tmpdir}" || exit 1
-else
-  echo "Unable to create folder for temporary files: \"${tmpdir}\""
-  exit 1
-fi
-
-for ruleset in $rulesets; do
-  resaved="rs_${ruleset}_resaved"
-  resaved_path="${tmpdir}/${resaved}"
-  reresaved="resaved_rs_${ruleset}"
-  reresaved_path="${tmpdir}/${reresaved}"
-
-  echo "Loading $ruleset and saving it as $resaved"
-  @abs_top_builddir@/fcruleup -F -c -r $ruleset \
-      --output "$resaved_path" \
-    || exit 1
-
-  echo "Trying to load $ruleset saved as $resaved"
-  FREECIV_DATA_PATH=$tmpdir \
-      @abs_top_builddir@/tests/rs_test_res/ruleset_loads.sh "$resaved" \
-    || exit 1
-
-  echo "Checking ruleset saving stability for $ruleset"
-
-  echo "Resaving resaved $ruleset"
-  FREECIV_DATA_PATH=$tmpdir @abs_top_builddir@/fcruleup -F -c -r "$resaved" \
-      --output "$reresaved_path" \
-    || exit 1
-  if [ ! -d "$reresaved_path" ] ; then
-    echo "Missing $reresaved_path means that resaving must have failed."
-    exit 1
-  fi
-  result="`diff -u \"${resaved_path}\" \"${reresaved_path}\"`"
-  if test "${result}" != "" ; then
-    echo "${result}"
-    echo "Unstable ruleset saving."
-    exit 1
-  fi
-done
-
-if test "$KEEP_RESULT_IN_DIR" = "" ; then
-  # Should not be kept
-  rm -rf "${tmpdir}"
-fi
-
-echo "No resaving problems detected."
-
-exit 0
diff --git a/tests/rulesets_upgrade.sh.in b/tests/rulesets_upgrade.sh.in
deleted file mode 100644
index a5f8351de5..0000000000
--- a/tests/rulesets_upgrade.sh.in
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/usr/bin/env bash
-#/***********************************************************************
-# Freeciv - Copyright (C) 2017-2023
-#   This program is free software; you can redistribute it and/or modify
-#   it under the terms of the GNU General Public License as published by
-#   the Free Software Foundation; either version 2, or (at your option)
-#   any later version.
-#
-#   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.
-#
-#***********************************************************************/
-
-# rulesets_upgrade.sh
-# Exits with 0 when each ruleset specified in upgrade_ruleset_list.txt can
-# be saved using ruleup.
-# Exits with 1 if not.
-# If KEEP_RESULT_IN_DIR is set to a folder the saved result will be kept
-# there for later inspection even if nothing fails.
-
-FREECIV_DATA_PATH="@abs_top_srcdir@/tests/rs_test_res/upgrade_rulesets:$FREECIV_DATA_PATH" \
- ./tests/rulesets_save.sh `cat @abs_top_srcdir@/tests/rs_test_res/upgrade_ruleset_list.txt`
-- 
2.47.2

