Skip to content

Commit

Permalink
Fix prepare_release for 11.2 release
Browse files Browse the repository at this point in the history
  • Loading branch information
onurctirtir committed Feb 3, 2023
1 parent 48c3031 commit 48e81d5
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
20 changes: 10 additions & 10 deletions packaging_automation/prepare_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
MULTI_EXTENSION_SQL = "src/test/regress/sql/multi_extension.sql"
CITUS_CONTROL = "src/backend/distributed/citus.control"
MULTI_EXTENSION_OUT = "src/test/regress/expected/multi_extension.out"
CONFIG_PY = "src/test/regress/upgrade/config.py"
CONFIG_PY = "src/test/regress/citus_tests/config.py"
DISTRIBUTED_SQL_DIR_PATH = "src/backend/distributed/sql"
DOWNGRADES_DIR_PATH = f"{DISTRIBUTED_SQL_DIR_PATH}/downgrades"
CONFIGURE_IN = "configure.ac"
CONFIGURE_AC = "configure.ac"
CONFIGURE = "configure"
CITUS_CONTROL_SEARCH_PATTERN = r"^default_version*"

Expand All @@ -40,9 +40,9 @@
MULTI_EXT_DETAIL2_PATTERN = (
rf"^{MULTI_EXT_DETAIL_PREFIX}\d+\.\d+{MULTI_EXT_DETAIL2_SUFFIX}$")

CONFIG_PY_MASTER_VERSION_SEARCH_PATTERN = r"^MASTER_VERSION = '\d+\.\d+'"
CONFIG_PY_MASTER_VERSION_SEARCH_PATTERN = r'^MASTER_VERSION = "\d+\.\d+"'

CONFIGURE_IN_SEARCH_PATTERN = "AC_INIT*"
CONFIGURE_AC_SEARCH_PATTERN = "AC_INIT*"
REPO_OWNER = "citusdata"

BASE_PATH = pathlib2.Path(__file__).parent.absolute()
Expand All @@ -54,7 +54,7 @@
repo_details = {
"citus": {
"configure-in-str": "Citus",
"branch": "master"},
"branch": "main"},
"citus-enterprise": {
"configure-in-str": "Citus Enterprise",
"branch": "enterprise-master"}}
Expand Down Expand Up @@ -163,7 +163,7 @@ def update_release(github_token: non_blank(non_empty(str)), project_params: Proj
path_params = PathParams(multi_extension_out_path=f"{exec_path}/{MULTI_EXTENSION_OUT}",
multi_extension_sql_path=f"{exec_path}/{MULTI_EXTENSION_SQL}",
citus_control_file_path=f"{exec_path}/{CITUS_CONTROL}",
configure_in_path=f"{exec_path}/{CONFIGURE_IN}", config_py_path=f"{exec_path}/{CONFIG_PY}",
configure_in_path=f"{exec_path}/{CONFIGURE_AC}", config_py_path=f"{exec_path}/{CONFIG_PY}",
distributed_dir_path=f"{exec_path}/{DISTRIBUTED_SQL_DIR_PATH}",
downgrades_dir_path=f"{exec_path}/{DOWNGRADES_DIR_PATH}")

Expand Down Expand Up @@ -423,10 +423,10 @@ def add_downgrade_script_in_multi_extension_file(current_schema_version,
f"{template.render(current_schema_version=current_schema_version, upcoming_minor_version=f'{upcoming_minor_version}-1')}\n")

if not prepend_line_in_file(multi_extension_out_path,
"DROP TABLE prev_objects, extension_diff;",
"DROP TABLE multi_extension.prev_objects, multi_extension.extension_diff;",
string_to_prepend):
raise ValueError(f"Downgrade scripts could not be added in {multi_extension_out_path} since "
f"'DROP TABLE prev_objects, extension_diff;' script could not be found ")
f"'DROP TABLE multi_extension.prev_objects, multi_extension.extension_diff;' script could not be found ")
print(f"### Done Test downgrade scripts successfully added in {multi_extension_out_path}. ###")


Expand Down Expand Up @@ -458,7 +458,7 @@ def get_current_schema_from_citus_control(citus_control_file_path: str) -> str:
def update_version_with_upcoming_version_in_config_py(config_py_path, upcoming_minor_version):
print(f"### Updating {config_py_path} file with the upcoming version {upcoming_minor_version}... ###")
if not replace_line_in_file(config_py_path, CONFIG_PY_MASTER_VERSION_SEARCH_PATTERN,
f"MASTER_VERSION = '{upcoming_minor_version}'"):
f'MASTER_VERSION = "{upcoming_minor_version}"'):
raise ValueError(f"{config_py_path} does not have match for version")
print(f"### Done {config_py_path} file updated with the upcoming version {upcoming_minor_version}. ###")

Expand Down Expand Up @@ -508,7 +508,7 @@ def execute_autoconf_f():

def update_version_in_configure_in(project_name, configure_in_path, project_version):
print(f"### Updating version on file {configure_in_path}... ###")
if not replace_line_in_file(configure_in_path, CONFIGURE_IN_SEARCH_PATTERN,
if not replace_line_in_file(configure_in_path, CONFIGURE_AC_SEARCH_PATTERN,
f"AC_INIT([{repo_details[project_name]['configure-in-str']}], [{project_version}])"):
raise ValueError(f"{configure_in_path} does not have match for version")
print(f"### Done {configure_in_path} file is updated with project version {project_version}. ###")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
ALTER EXTENSION citus UPDATE TO '{{upcoming_minor_version}}';
ALTER EXTENSION citus UPDATE TO '{{current_schema_version}}';
-- Should be empty result since upgrade+downgrade should be a no-op
SELECT * FROM print_extension_changes();
SELECT * FROM multi_extension.print_extension_changes();
previous_object | current_object
---------------------------------------------------------------------
(0 rows)

-- Snapshot of state at {{upcoming_minor_version}}
ALTER EXTENSION citus UPDATE TO '{{upcoming_minor_version}}';
SELECT * FROM print_extension_changes();
SELECT * FROM multi_extension.print_extension_changes();
previous_object | current_object
---------------------------------------------------------------------
(0 rows)
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
ALTER EXTENSION citus UPDATE TO '{{upcoming_minor_version}}';
ALTER EXTENSION citus UPDATE TO '{{current_schema_version}}';
-- Should be empty result since upgrade+downgrade should be a no-op
SELECT * FROM print_extension_changes();
SELECT * FROM multi_extension.print_extension_changes();

-- Snapshot of state at {{upcoming_minor_version}}
ALTER EXTENSION citus UPDATE TO '{{upcoming_minor_version}}';
SELECT * FROM print_extension_changes();
SELECT * FROM multi_extension.print_extension_changes();
8 changes: 4 additions & 4 deletions packaging_automation/tests/test_prepare_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from ..common_tool_methods import (file_includes_line, count_line_in_file, run, get_last_commit_message,
remove_cloned_code)
from ..prepare_release import (update_release, MULTI_EXTENSION_OUT, MULTI_EXTENSION_SQL, CONFIGURE,
CONFIGURE_IN, CITUS_CONTROL, CONFIG_PY, ProjectParams)
CONFIGURE_AC, CITUS_CONTROL, CONFIG_PY, ProjectParams)

github_token = os.getenv("GH_TOKEN")

Expand Down Expand Up @@ -46,7 +46,7 @@ def test_major_release():
run(f"git checkout {update_release_return_value.release_branch_name}")

assert file_includes_line(test_base_path_major, MULTI_EXTENSION_OUT, " 10.1.0")
assert file_includes_line(test_base_path_major, CONFIGURE_IN, "AC_INIT([Citus], [10.1.0])")
assert file_includes_line(test_base_path_major, CONFIGURE_AC, "AC_INIT([Citus], [10.1.0])")
assert file_includes_line(test_base_path_major, CONFIGURE, "PACKAGE_VERSION='10.1.0'")
assert file_includes_line(test_base_path_major, CONFIGURE, "PACKAGE_STRING='Citus 10.1.0'")
assert file_includes_line(test_base_path_major, CONFIGURE,
Expand Down Expand Up @@ -76,7 +76,7 @@ def test_major_release():
assert count_line_in_file(test_base_path_major, MULTI_EXTENSION_SQL,
"ALTER EXTENSION citus UPDATE TO '10.2-1';") == 2
assert file_includes_line(test_base_path_major, CONFIG_PY, "MASTER_VERSION = '10.2'")
assert file_includes_line(test_base_path_major, CONFIGURE_IN, "AC_INIT([Citus], [10.2devel])")
assert file_includes_line(test_base_path_major, CONFIGURE_AC, "AC_INIT([Citus], [10.2devel])")
assert file_includes_line(test_base_path_major, CONFIGURE, "PACKAGE_VERSION='10.2devel'")
assert file_includes_line(test_base_path_major, CONFIGURE, "PACKAGE_STRING='Citus 10.2devel'")
assert file_includes_line(test_base_path_major, CONFIGURE,
Expand All @@ -103,7 +103,7 @@ def test_patch_release():
earliest_pr_date=datetime.strptime('2021.03.25 00:00', '%Y.%m.%d %H:%M'),
exec_path=test_base_path_patch, is_test=True)
assert file_includes_line(test_base_path_patch, MULTI_EXTENSION_OUT, f" {project_params.project_version}")
assert file_includes_line(test_base_path_patch, CONFIGURE_IN,
assert file_includes_line(test_base_path_patch, CONFIGURE_AC,
f"AC_INIT([Citus], [{project_params.project_version}])")
assert file_includes_line(test_base_path_patch, CONFIGURE,
f"PACKAGE_VERSION='{project_params.project_version}'")
Expand Down

0 comments on commit 48e81d5

Please sign in to comment.