[Bf-blender-cvs] [a525b573cf5] codesign: Codesign: Finish codesign step of bundling

Sergey Sharybin noreply at git.blender.org
Thu Dec 12 13:31:05 CET 2019


Commit: a525b573cf5e38c7b7f1247a534efd01fd88b6c8
Author: Sergey Sharybin
Date:   Thu Dec 12 12:41:47 2019 +0100
Branches: codesign
https://developer.blender.org/rBa525b573cf5e38c7b7f1247a534efd01fd88b6c8

Codesign: Finish codesign step of bundling

Adds all the missing bits from the previous commit, and implements
extra required features: need to copy bundle's _CodeSignatures folder
from codesign machine to the worker machine.

===================================================================

M	build_files/buildbot/codesign/absolute_and_relative_filename.py
M	build_files/buildbot/codesign/base_code_signer.py
M	build_files/buildbot/codesign/macos_code_signer.py
M	build_files/buildbot/codesign/windows_code_signer.py
M	release/datafiles/locale
M	release/scripts/addons
M	release/scripts/addons_contrib

===================================================================

diff --git a/build_files/buildbot/codesign/absolute_and_relative_filename.py b/build_files/buildbot/codesign/absolute_and_relative_filename.py
index bea9ea7e8d0..cb42710e785 100644
--- a/build_files/buildbot/codesign/absolute_and_relative_filename.py
+++ b/build_files/buildbot/codesign/absolute_and_relative_filename.py
@@ -65,10 +65,14 @@ class AbsoluteAndRelativeFileName:
         """
         Create list of AbsoluteAndRelativeFileName for all the files in the
         given directory.
+
+        NOTE: Result will be pointing to a resolved paths.
         """
         assert base_dir.is_absolute()
         assert base_dir.is_dir()
 
+        base_dir = base_dir.resolve()
+
         result = []
         for filename in base_dir.glob('**/*'):
             if not filename.is_file():
diff --git a/build_files/buildbot/codesign/base_code_signer.py b/build_files/buildbot/codesign/base_code_signer.py
index 845eb6f5a5b..53c1ca71ede 100644
--- a/build_files/buildbot/codesign/base_code_signer.py
+++ b/build_files/buildbot/codesign/base_code_signer.py
@@ -45,6 +45,7 @@
 import abc
 import logging
 import shutil
+import subprocess
 import time
 import zipfile
 
@@ -400,7 +401,7 @@ class BaseCodeSigner(metaclass=abc.ABCMeta):
     # server from other platforms (for example, to test that macOS code signer
     # does what it is supposed to after doing a refactor on Linux).
 
-    # TODO(sergey): What is the typo annotation for the command?
+    # TODO(sergey): What is the type annotation for the command?
     def run_command_or_mock(self, command, platform: util.Platform) -> None:
         """
         Run given command if current platform matches given one
@@ -412,3 +413,4 @@ class BaseCodeSigner(metaclass=abc.ABCMeta):
             logger_server.info(
                 f'Will run command for {platform}: {command}')
             return
+        subprocess.run(command)
diff --git a/build_files/buildbot/codesign/macos_code_signer.py b/build_files/buildbot/codesign/macos_code_signer.py
index a60ef5771e5..3f011437170 100644
--- a/build_files/buildbot/codesign/macos_code_signer.py
+++ b/build_files/buildbot/codesign/macos_code_signer.py
@@ -110,7 +110,7 @@ class MacOSCodeSigner(BaseCodeSigner):
         """
 
         logger_server.info(
-            'Removing codesign signature from  %s...', file.relative_filepath)
+            'Removing codesign signature from %s...', file.relative_filepath)
 
         command = ['codesign', '--remove-signature', file.absolute_filepath]
         self.run_command_or_mock(command, util.Platform.MACOS)
@@ -124,13 +124,13 @@ class MacOSCodeSigner(BaseCodeSigner):
         """
 
         logger_server.info(
-            'Codesigning  %s...', file.relative_filepath)
+            'Codesigning %s...', file.relative_filepath)
 
         entitlements_file = self.config.MACOS_ENTITLEMENTS_FILE
         command = ['codesign',
                    '--timestamp',
                    '--options', 'runtime',
-                   f'--entitlements="{entitlements_file}"',
+                   f'--entitlements={entitlements_file}',
                    '--sign', self.config.MACOS_CODESIGN_IDENTITY,
                    file.absolute_filepath]
         self.run_command_or_mock(command, util.Platform.MACOS)
@@ -186,6 +186,7 @@ class MacOSCodeSigner(BaseCodeSigner):
         """
 
         signed_bundles = set()
+        extra_files = []
 
         for file in files:
             if not is_file_from_bundle(file):
@@ -203,6 +204,22 @@ class MacOSCodeSigner(BaseCodeSigner):
 
             signed_bundles.add(bundle_name)
 
+            # Codesign on a bundle adds an extra folder with information.
+            # It needs to be compied to the source.
+            code_signature_directory = \
+                bundle.absolute_filepath / 'Contents' / '_CodeSignature'
+            code_signature_files = \
+                AbsoluteAndRelativeFileName.recursively_from_directory(
+                    code_signature_directory)
+            for code_signature_file in code_signature_files:
+                bundle_relative_file = AbsoluteAndRelativeFileName(
+                    bundle.base_dir,
+                    code_signature_directory /
+                    code_signature_file.relative_filepath)
+                extra_files.append(bundle_relative_file)
+
+        files.extend(extra_files)
+
         return True
 
     def sign_all_files(self, files: List[AbsoluteAndRelativeFileName]) -> None:
diff --git a/build_files/buildbot/codesign/windows_code_signer.py b/build_files/buildbot/codesign/windows_code_signer.py
index 12aad3cc178..2557d3c0b68 100644
--- a/build_files/buildbot/codesign/windows_code_signer.py
+++ b/build_files/buildbot/codesign/windows_code_signer.py
@@ -19,7 +19,6 @@
 # <pep8 compliant>
 
 import logging
-import subprocess
 
 from pathlib import Path
 from typing import List
diff --git a/release/datafiles/locale b/release/datafiles/locale
index b0b6396312e..1e75f78b59a 160000
--- a/release/datafiles/locale
+++ b/release/datafiles/locale
@@ -1 +1 @@
-Subproject commit b0b6396312e7ceb78826d423f8f152ddba01c039
+Subproject commit 1e75f78b59a0647ceecb102b490ade1ada0dcdba
diff --git a/release/scripts/addons b/release/scripts/addons
index 1470f353c65..c02a98ba562 160000
--- a/release/scripts/addons
+++ b/release/scripts/addons
@@ -1 +1 @@
-Subproject commit 1470f353c65034db91131d21ab9c782d029a2ee9
+Subproject commit c02a98ba562679080ae550b3756759cc2793b765
diff --git a/release/scripts/addons_contrib b/release/scripts/addons_contrib
index ffbaca558a2..70b649775ee 160000
--- a/release/scripts/addons_contrib
+++ b/release/scripts/addons_contrib
@@ -1 +1 @@
-Subproject commit ffbaca558a27bab4716bcd51ca7ea1df8e4f4b14
+Subproject commit 70b649775eeeebedb02c1c7b7aa996a7f6294177



More information about the Bf-blender-cvs mailing list