3
# Licensed to the Apache Software Foundation (ASF) under one
4
# or more contributor license agreements. See the NOTICE file
5
# distributed with this work for additional information
6
# regarding copyright ownership. The ASF licenses this file
7
# to you under the Apache License, Version 2.0 (the
8
# "License"); you may not use this file except in compliance
9
# with the License. You may obtain a copy of the License at
11
# http://www.apache.org/licenses/LICENSE-2.0
13
# Unless required by applicable law or agreed to in writing, software
14
# distributed under the License is distributed on an "AS IS" BASIS,
15
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
# See the License for the specific language governing permissions and
17
# limitations under the License.
19
# Compares two records.config files, printing which items are different and
20
# what the before/after values are.
21
# Ignores FLOAT differences and @foo@ values from the source code defaults.
24
def parse_records_file(filename):
29
if line.startswith('CONFIG') or line.startswith('LOCAL'):
31
if parts[2] == 'FLOAT':
32
parts[3] = parts[3].rstrip('0')
33
if parts[2] == 'INT' and parts[3][-1] in 'KMG':
39
val = int(val) * 1048576
41
val = int(val) * 1073741824
44
settings[parts[1]] = parts[3]
46
sys.stderr.write("Skipping malformed line: %s\n" % line)
50
def compare_settings(old, new):
51
for key in sorted(tuple(set(old) | set(new))):
57
for key in sorted(old):
58
if old[key].startswith('@') and old[key].endswith('@'):
59
# Skip predefined values
61
if old[key] != new[key]:
62
print "%s %s -> %s" % (key, old[key], new[key])
64
if __name__ == '__main__':
65
settings_orig = parse_records_file(sys.argv[1])
66
settings_new = parse_records_file(sys.argv[2])
67
compare_settings(settings_orig, settings_new)