Cleanup: use _build_packages.
[cdist.git] / cdist
diff --git a/cdist b/cdist
index 8e01599daeac5813dcef769e98ebdcfd0575719d..244d8f1eacb926be2b9c98a00bd3c35523c7bb6b 100755 (executable)
--- a/cdist
+++ b/cdist
@@ -775,9 +775,8 @@ class OSXTarget(Target):
     def command(self, c):
         command('%s %s' % (self.variables_string(False), c))
 
-    def build(self, *a, **k):
+    def unlock_keychain(self):
         self.command('security unlock-keychain -p %s %s' % (self.osx_keychain_password, self.osx_keychain_file))
-        return super().build(*a, **k)
 
 
 class OSXSingleTarget(OSXTarget):
@@ -790,6 +789,8 @@ class OSXSingleTarget(OSXTarget):
         host_enviro = '%s/x86_64' % config.get('osx_environment_prefix')
         target_enviro = '%s/%s' % (config.get('osx_environment_prefix'), arch)
 
+        self.bin = '%s/bin' % target_enviro
+
         # Environment variables
         self.set('CFLAGS', '"-I%s/include -I%s/include %s"' % (self.directory, target_enviro, flags))
         self.set('CPPFLAGS', '')
@@ -811,6 +812,7 @@ class OSXSingleTarget(OSXTarget):
     def package(self, project, checkout, output_dir, options, no_notarize):
         tree = self.build(project, checkout, options)
         tree.add_defaults(options)
+        self.unlock_keychain()
         p = self._build_packages(tree, options)
         for x in p:
             if not isinstance(x, tuple):
@@ -839,13 +841,10 @@ class OSXUniversalTarget(OSXTarget):
             tree.build_dependencies(options)
             tree.build(options)
 
+        self.unlock_keychain()
         tree = globals.trees.get(project, checkout, self)
         with TreeDirectory(tree):
-            if len(inspect.getfullargspec(tree.cscript['package']).args) == 3:
-                packages = tree.call('package', tree.version, options)
-            else:
-                log_normal("Deprecated cscript package() method with no options parameter")
-                packages = tree.call('package', tree.version)
+            self._build_packages(tree, options)
             for p in packages:
                 copyfile(p, os.path.join(output_dir, os.path.basename(devel_to_git(tree.git_commit, p))))
 
@@ -907,15 +906,17 @@ def target_factory(args):
         target = LinuxTarget(p[0], None, int(p[1]), args.work)
     elif s == 'raspbian':
         target = LinuxTarget(s, None, None, args.work)
-    elif s == 'osx-intel':
-        # Universal Intel 32/64-bit
+    elif s == 'osx-intel-32-64':
+        # Universal Intel 32/64-bit built for config's os_sdk
         if args.command == 'build':
             target = OSXSingleTarget('x86_64', args.work)
         else:
             target = OSXUniversalTarget(('i386', 'x86_64'), args.work)
-    elif s == 'osx-arm':
-        # Universal arm64 and Intel 64-bit
+    elif s == 'osx-arm-intel-64':
+        # Universal arm64 and Intel 64-bit built for SDK 11.0
         target = OSXUniversalTarget(('arm64', 'x86_64'), args.work)
+    elif s == 'osx-arm64':
+        target = OSXSingleTarget('arm64', '11.0', args.work)
     elif s == 'source':
         target = SourceTarget()
     elif s == 'flatpak':