Commit 21102b57 authored by Dirk Pranke's avatar Dirk Pranke Committed by Chromium LUCI CQ

Fix python3 issue in calculate_package_deps.

This addresses a 2->3 issue w/ print statements in
calculate_package_deps.py.

Bug: 1112471
Change-Id: I29e7e778bb8843a14fafea23e40fb754d959b772
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2638722Reviewed-by: default avatarNico Weber <thakis@chromium.org>
Reviewed-by: default avatarThomas Anderson <thomasanderson@chromium.org>
Commit-Queue: Nico Weber <thakis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#845183}
parent 528fa718
......@@ -7,6 +7,8 @@
are satisfiable on all supported debian-based distros.
"""
from __future__ import print_function
import argparse
import json
import os
......@@ -55,7 +57,7 @@ elif arch == 'mips64el':
cmd.extend(['-l%s/usr/lib/mips64el-linux-gnuabi64' % sysroot,
'-l%s/lib/mips64el-linux-gnuabi64' % sysroot])
else:
print 'Unsupported architecture ' + arch
print('Unsupported architecture ' + arch)
sys.exit(1)
cmd.extend(['-l%s/usr/lib' % sysroot, '-O', '-e', binary])
......@@ -64,8 +66,8 @@ proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
(stdout, stderr) = proc.communicate()
exit_code = proc.wait()
if exit_code != 0:
print 'dpkg-shlibdeps failed with exit code ' + str(exit_code)
print 'stderr was ' + stderr
print('dpkg-shlibdeps failed with exit code ' + str(exit_code))
print('stderr was ' + stderr)
sys.exit(1)
SHLIBS_DEPENDS_PREFIX = 'shlibs:Depends='
......@@ -98,9 +100,10 @@ if distro_check:
dep_satisfiable = True
break
if not dep_satisfiable:
print >> sys.stderr, (
print(
'Dependency %s not satisfiable on distro %s caused by binary %s' % (
interval_set.formatted(), distro, os.path.basename(binary)))
interval_set.formatted(), distro, os.path.basename(binary)),
file=sys.stderr)
ret_code = 1
if ret_code == 0:
with open(dep_filename, 'w') as dep_file:
......
......@@ -7,6 +7,8 @@
are satisfiable on all supported rpm-based distros.
"""
from __future__ import print_function
import argparse
import json
import os
......@@ -26,8 +28,8 @@ bundled_shlibs = [os.path.basename(file) for file in args.shlibs]
distro_check = args.distro_check
if os.stat(binary).st_mode & 0o111 == 0:
print (('/usr/lib/rpm/elfdeps requires that binaries have an exectuable ' +
'bit set, but binary "%s" does not.') % os.path.basename(binary))
print(('/usr/lib/rpm/elfdeps requires that binaries have an executable ' +
'bit set, but binary "%s" does not.') % os.path.basename(binary))
sys.exit(1)
proc = subprocess.Popen(['/usr/lib/rpm/find-requires'], stdin=subprocess.PIPE,
......@@ -35,8 +37,8 @@ proc = subprocess.Popen(['/usr/lib/rpm/find-requires'], stdin=subprocess.PIPE,
(stdout, stderr) = proc.communicate(binary + '\n')
exit_code = proc.wait()
if exit_code != 0:
print 'find-requires failed with exit code ' + str(exit_code)
print 'stderr was ' + stderr
print('find-requires failed with exit code ' + str(exit_code))
print('stderr was ' + stderr)
sys.exit(1)
requires = set([] if stdout == '' else stdout.rstrip('\n').split('\n'))
......@@ -54,9 +56,10 @@ if distro_check:
remove_requires.add(requirement)
continue
if requirement not in distro_package_provides[distro]:
print >> sys.stderr, (
print(
'Unexpected new dependency %s on distro %s caused by binary %s' % (
requirement, distro, os.path.basename(binary)))
requirement, distro, os.path.basename(binary)),
file=sys.stderr)
ret_code = 1
continue
if ret_code == 0:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment