| | |
| | | #!/usr/bin/python3.5 |
| | | #!/usr/bin/python3.9 |
| | | # |
| | | # CDDL HEADER START |
| | | # |
| | |
| | | import re |
| | | import subprocess |
| | | import shutil |
| | | import stat |
| | | |
| | | |
| | | import pkg.fmri |
| | |
| | | # |
| | | def mangle_elf(manifest, action, src, dest): |
| | | strip_elf_runpath = action.attrs.pop('mangler.elf.strip_runpath', 'true') |
| | | if strip_elf_runpath is 'false': |
| | | if strip_elf_runpath == 'false': |
| | | return |
| | | |
| | | # |
| | |
| | | destdir = os.path.dirname(dest) |
| | | if not os.path.exists(destdir): |
| | | os.makedirs(destdir) |
| | | # Create a copy to mangle if it doesn't exist yet. |
| | | if os.path.isfile(dest) == False: |
| | | shutil.copy2(src, dest) |
| | | # Create a copy to mangle |
| | | # Earlier the code would check that the destination file does not exist |
| | | # yet, however internal library versioning can be different while the |
| | | # filename remains the same. |
| | | # When publishing from a non-clean prototype directory older libraries |
| | | # which may be ABI incompatible would then be republished in the new |
| | | # package instead of the new version. |
| | | shutil.copy2(src, dest) |
| | | |
| | | # Make sure we do have write permission before we try to modify the file |
| | | os.chmod(dest, os.stat(dest).st_mode | stat.S_IWUSR) |
| | | |
| | | # Mangle the copy by deleting the tag if there is nothing left to keep |
| | | # or replacing the value if there is something left. |
| | |
| | | # |
| | | def mangle_cddl(manifest, action, text): |
| | | strip_cddl = action.attrs.pop('mangler.strip_cddl', 'false') |
| | | if strip_cddl is 'false': |
| | | if strip_cddl == 'false': |
| | | return text |
| | | cddl_re = re.compile('^[^\n]*CDDL HEADER START.+CDDL HEADER END[^\n]*$', |
| | | re.MULTILINE|re.DOTALL) |