Skip to content

Commit

Permalink
Merge branch 'cassandra-4.0' into cassandra-4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
driftx committed Aug 18, 2023
2 parents cd3e564 + ba50ec9 commit f4ee77c
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 1 deletion.
24 changes: 24 additions & 0 deletions .build/build-cqlsh.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project basedir="." name="apache-cassandra-cqlsh-tasks"
xmlns:if="ant:if">
<target name="set-cqlsh-version">
<echo file="pylib/cqlshlib/serverversion.py" append="false">version = "${base.version}"${line.separator}</echo>
</target>
</project>
1 change: 1 addition & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Merged from 4.0:
* Migrate Python optparse to argparse (CASSANDRA-17914)
Merged from 3.11:
Merged from 3.0:
* CQLSH emits a warning when the server version doesn't match (CASSANDRA-18745)
* Fix missing speculative retries in tablestats (CASSANDRA-18767)
* Fix Requires for Java for RPM package (CASSANDRA-18751)
* Fix CQLSH online help topic link (CASSANDRA-17534)
Expand Down
11 changes: 11 additions & 0 deletions bin/cqlsh.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ def find_zip(libprefix):
from cqlshlib.tracing import print_trace, print_trace_session
from cqlshlib.util import get_file_encoding_bomsize
from cqlshlib.util import is_file_secure
from cqlshlib.serverversion import version as build_version


DEFAULT_HOST = '127.0.0.1'
Expand Down Expand Up @@ -521,6 +522,8 @@ def __init__(self, hostname, port, color=False,
if stdin is None:
stdin = sys.stdin

self.check_build_versions()

if tty:
self.reset_prompt()
self.report_connection()
Expand All @@ -537,6 +540,14 @@ def __init__(self, hostname, port, color=False,
self.single_statement = single_statement
self.is_subshell = is_subshell

def check_build_versions(self):
baseversion = self.connection_versions['build']
extra = baseversion.rfind('-')
if extra:
baseversion = baseversion[0:extra]
if baseversion != build_version:
print("WARNING: cqlsh was built against {}, but this server is {}. All features may not work!".format(baseversion, build_version))

@property
def batch_mode(self):
return not self.tty
Expand Down
3 changes: 2 additions & 1 deletion build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -900,7 +900,7 @@
</target>

<!-- create properties file with C version -->
<target name="createVersionPropFile">
<target name="createVersionPropFile" depends="set-cqlsh-version">
<taskdef name="propertyfile" classname="org.apache.tools.ant.taskdefs.optional.PropertyFile"/>
<mkdir dir="${version.properties.dir}"/>
<propertyfile file="${version.properties.dir}/version.properties">
Expand Down Expand Up @@ -2406,4 +2406,5 @@
<import file="${build.helpers.dir}/build-resolver.xml"/>
<import file="${build.helpers.dir}/build-rat.xml"/>
<import file="${build.helpers.dir}/build-owasp.xml"/>
<import file="${build.helpers.dir}/build-cqlsh.xml"/>
</project>

0 comments on commit f4ee77c

Please sign in to comment.