-
Notifications
You must be signed in to change notification settings - Fork 145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Manylinux2010 #92
Merged
Merged
Manylinux2010 #92
Changes from 6 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
1f62c18
Script to generate symbol_versions from lib_whitelist.
markrwilliams 3a98ce4
First draft of manylinux2 policy.
markrwilliams c3fc172
Remove unused import.
markrwilliams 780f630
linux ABI tags should be removed from manylinux2 wheels.
markrwilliams 4f794da
Update tests for manylinux2.
markrwilliams 6474314
Rename manylinux2 tag as manylinux2010
wtolson 55970f2
Test audit wheel with manylinux1 and manylinux2010 containers
wtolson bdee5a1
Make manylinux2010 policy lower precedence than manylinux1
ehashman a16b27b
Merge branch 'master' into manylinux2010
ehashman b96413d
Fix some logging issues
ehashman 7047b95
Update tests to account for correct manylinux2010 behaviour
ehashman b4cba09
Also test per-policy for pure wheels
ehashman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
""" | ||
Calculate symbol_versions for a policy in policy.json by collection | ||
defined version (.gnu.version_d) from libraries in lib_whitelist. | ||
This should be run inside a manylinux Docker container. | ||
""" | ||
import argparse | ||
import os | ||
import platform | ||
import json | ||
from elftools.elf.elffile import ELFFile | ||
|
||
if platform.architecture()[0] == '64bit': | ||
LIBRARY_PATHS = ['/lib64', '/usr/lib64'] | ||
else: | ||
LIBRARY_PATHS = ['/lib', '/usr/lib'] | ||
|
||
parser = argparse.ArgumentParser(description=__doc__) | ||
parser.add_argument("policy", help="The policy name") | ||
parser.add_argument("policyjson", help="The policy.json file.") | ||
|
||
|
||
def load_policies(path): | ||
with open(path) as f: | ||
return json.load(f) | ||
|
||
|
||
def choose_policy(name, policies): | ||
try: | ||
return next(policy for policy in policies if policy['name'] == name) | ||
except StopIteration: | ||
raise RuntimeError("Unknown policy {}".format(name)) | ||
|
||
|
||
def find_library(library): | ||
for p in LIBRARY_PATHS: | ||
path = os.path.join(p, library) | ||
if os.path.exists(path): | ||
return path | ||
else: | ||
raise RuntimeError("Unknown library {}".format(library)) | ||
|
||
|
||
def versionify(version_string): | ||
return [int(n) for n in version_string.split('.')] | ||
|
||
|
||
def calculate_symbol_versions(libraries, symbol_versions, arch): | ||
calculated_symbol_versions = {k: set() for k in symbol_versions} | ||
prefixes = ['/lib', '/usr/lib'] | ||
if arch == '64bit': | ||
prefixes = [p + '64' for p in prefixes] | ||
|
||
for library in libraries: | ||
library_path = find_library(library) | ||
with open(library_path, 'rb') as f: | ||
e = ELFFile(f) | ||
section = e.get_section_by_name('.gnu.version_d') | ||
if section: | ||
for _, verdef_iter in section.iter_versions(): | ||
for vernaux in verdef_iter: | ||
for symbol_name in symbol_versions: | ||
try: | ||
name, version = vernaux.name.split('_', 1) | ||
except ValueError: | ||
pass | ||
if name in calculated_symbol_versions \ | ||
and version != 'PRIVATE': | ||
calculated_symbol_versions[name].add(version) | ||
return { | ||
k: sorted(v, key=versionify) | ||
for k, v in calculated_symbol_versions.items() | ||
} | ||
|
||
|
||
def main(): | ||
args = parser.parse_args() | ||
policies = load_policies(args.policyjson) | ||
policy = choose_policy(args.policy, policies) | ||
arch, _ = platform.architecture() | ||
print( | ||
json.dumps( | ||
calculate_symbol_versions( | ||
policy['lib_whitelist'], | ||
policy['symbol_versions'], | ||
arch, | ||
) | ||
) | ||
) | ||
|
||
|
||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Following up on my most recent comment, I believe this priority should be lowered such that it is between manylinux1 (most restrictive) and "linux" (least restrictive). Current manylinux1 binaries should also be manylinux2010 compliant, but not vice versa.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps we should have done the priorities in increasing rather than decreasing order... feel free to pick an arbitrary number between 0 and 100 for now (90?) and if we need to renumber later because the range was too small we can do that eventually.