Skip to content

Commit a4b32eb

Browse files
committed
Build: Check that all packages contain the same jar files
This should ensure, that RPM and DEB packages do not lack dependencies, that have been included in the tar.gz and zip files
1 parent 0bbf37c commit a4b32eb

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

dev-tools/build_release.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,22 @@ def get_artifacts(release):
338338
raise RuntimeError('Could not find required artifact at %s' % rpm)
339339
return common_artifacts
340340

341+
# Checks the jar files in each package
342+
# Barfs if any of the package jar files differ
343+
def check_artifacts_for_same_jars(artifacts):
344+
jars = []
345+
for file in artifacts:
346+
if file.endswith('.zip'):
347+
jars.append(subprocess.check_output("unzip -l %s | grep '\.jar$' | awk -F '/' '{ print $NF }' | sort" % file, shell=True))
348+
if file.endswith('.tar.gz'):
349+
jars.append(subprocess.check_output("tar tzvf %s | grep '\.jar$' | awk -F '/' '{ print $NF }' | sort" % file, shell=True))
350+
if file.endswith('.rpm'):
351+
jars.append(subprocess.check_output("rpm -pqli %s | grep '\.jar$' | awk -F '/' '{ print $NF }' | sort" % file, shell=True))
352+
if file.endswith('.deb'):
353+
jars.append(subprocess.check_output("dpkg -c %s | grep '\.jar$' | awk -F '/' '{ print $NF }' | sort" % file, shell=True))
354+
if len(set(jars)) != 1:
355+
raise RuntimeError('JAR contents of packages are not the same, please check the package contents. Use [unzip -l], [tar tzvf], [dpkg -c], [rpm -pqli] to inspect')
356+
341357
# Generates sha1 checsums for all files
342358
# and returns the checksum files as well
343359
# as the given files in a list
@@ -625,6 +641,8 @@ def ensure_checkout_is_clean(branchName):
625641
print(' Running maven builds now run-tests [%s]' % run_tests)
626642
build_release(run_tests=run_tests, dry_run=dry_run, cpus=cpus, bwc_version=find_bwc_version(release_version, bwc_path))
627643
artifacts = get_artifacts(release_version)
644+
print('Checking if all artifacts contain the same jars')
645+
check_artifacts_for_same_jars(artifacts)
628646
artifacts_and_checksum = generate_checksums(artifacts)
629647
smoke_test_release(release_version, artifacts, get_head_hash(), PLUGINS)
630648
print(''.join(['-' for _ in range(80)]))

0 commit comments

Comments
 (0)