OS Component Information

The command for getting information about MacOS packages seems to be pkgutil

This command would be used when extending the pkg2vesta.pl script to allow it to import MacOS components into Vesta packages.

General Information about a Package

Use --pkg-info to get information about an installed MacOS package:

% pkgutil --pkg-info com.apple.pkg.DeveloperToolsCLILeo
package-id: com.apple.pkg.DeveloperToolsCLILeo
version: 1.0.0.9000000000.1.1192168948
volume: /
location: ./
install-time: 1227100759
groups: com.apple.repair-permissions.pkg-group com.apple.FindSystemFiles.pkg-group com.apple.DevToolsBoth.pkg-group

Which Package Owns a File?

Use --file-info to find out which installed MacOS package owns a file:

% pkgutil --file-info /usr/bin/gcc 
volume: / 
path: usr/bin/gcc 
 
pkgid: com.apple.pkg.DeveloperToolsCLILeo 
pkg-version: 1.0.0.9000000000.1.1192168948 
install-time: 1227100759 
uid: 0 
gid: 0 
mode: 120755 
 
% pkgutil --file-info /usr/lib/libSystem.B.dylib  
volume: / 
path: usr/lib/libSystem.B.dylib 
 
pkgid: com.apple.pkg.BaseSystem 
pkg-version: 10.5.3.1.1.1191932192 
install-time: 1220411437 
uid: 0 
gid: 0 
mode: 100555 
 
pkgid: com.apple.pkg.update.os.10.5.6.combo 
pkg-version: 1.0.1.1191932192 
install-time: 1234331233 
uid: 0 
gid: 0 
mode: 100555 

Contents of a Package

Use --files to list the contents of an installed package:

% pkgutil --files com.apple.pkg.BaseSystem | head 
. 
.vol 
Applications 
Applications/Utilities 
Applications/Utilities/Disk Utility.app 
Applications/Utilities/Disk Utility.app/Contents 
Applications/Utilities/Disk Utility.app/Contents/CodeResources 
Applications/Utilities/Disk Utility.app/Contents/Frameworks 
Applications/Utilities/Disk Utility.app/Contents/Frameworks/DUSupport.framework 
Applications/Utilities/Disk Utility.app/Contents/Frameworks/DUSupport.framework/CodeResources 
... 
bin/[ 
bin/bash 
bin/cat 
bin/chmod 
bin/cp 
bin/csh 
bin/date 
bin/dd 
bin/df 
bin/domainname 
...

Possible Platform Definition

This is one possible definition of a MacOS platform to allow the evaluator to run tools on a PowerPC machine running MacOS:

[Darwin-ppc] 
sysname = Darwin 
release = * 
version = * 
machine = Power Macintosh 
cpus    = 1 
cpuMHz  = 0 
memKB   = 0 
hosts   = mymac

Minimal Tool Example

Root Filesystem

This is a listing of a minimal root filesystem created by copying installed files from a MacOS 10.5.6 machine into Vesta:

% ls -lR root
total 8
drwxr-xr-x  1 ken  vesta  512 Feb 25 01:12 usr

root/usr:
total 8
drwxr-xr-x  1 ken  vesta  512 Feb 25 01:24 lib

root/usr/lib:
total 24232
-r-xr-xr-x  1 ken  vesta  1059792 Feb 25 01:12 dyld
-r-xr-xr-x  1 ken  vesta  7895440 Feb 25 01:12 libSystem.B.dylib
-rw-r--r--  1 ken  vesta   264016 Feb 25 01:16 libgcc_s.1.dylib
-r-xr-xr-x  1 ken  vesta   142400 Feb 25 01:24 libmathCommon.A.dylib
-rwxr-xr-x  1 ken  vesta  3035296 Feb 25 01:15 libstdc++.6.0.4.dylib

This is enough to run a small "Hello world" C++ program as a tool on MacOS.

Vesta SDL Model

Here's a model for running a small pre-compiled C++ program as a tool on MacOS:

   1 files 
   2   // The directory "root" contains the minimal root filesystem 
   3   root; 
   4   // The file "hello.mac" is a compied C++ program 
   5   hello.mac; 
   6 { 
   7   . = [ root, envVars = [] ]; 
   8   // Emulate symlink 
   9   . ++= [ root/usr/lib/"libstdc++.6.dylib" = root/usr/lib/"libstdc++.6.0.4.dylib" ]; 
  10   // Executable to run 
  11   . ++= [ root/.WD = [ hello = hello.mac ] ]; 
  12  
  13   // Add these if you want to see some additional filesystem 
  14   // dependencies as the tool runs looking for files that aren't there 
  15   /* 
  16   . ++= [ root = [ dev = [], var/db = [], 
  17                    usr = [ local/lib = [], lib/system = [] ] 
  18                  ] 
  19         ]; 
  20   */ 
  21  
  22   cmd = <"hello">; 
  23   r = _run_tool("Darwin-ppc", cmd, 
  24                 /*stdin=*/ "" /* (the default value) */, 
  25                 /*stdout_treatment=*/ "report_value" /* (save stdout) */); 
  26  
  27   return r; 
  28 }

pkg2vesta Challenges

The MacOS system packages seem to be pretty coarse-grained. For example, com.apple.pkg.Essentials contains the dynamic libraries for Perl and Tcl (which would be needed to build bindings for the Vesta APIs in those languages), but it also contains a lot of other things. In fact, the total file size is 1.8G. (For comparison, all the OS components used by a Debian lenny x86-64 std_env total 123M.)

This could be worked around by selectively excluding un-needed pieces (e.g. Mac Carbon GUI applications and support files like fonts) when importing the OS components. pkg2vesta already has a --excludepath command-line flag to allow you to do that. Unfortunately, it looks like with MacOS one would need the ability to tell pkg2vesta "exclude /X, but include /X/Y". pkg2vesta should probably be extended to allow for more flexible ways to specify what to include and what to exclude.

Other Projects

These might be useful if one is interested in building a re-distributable Darwin chroot that could be used to build Vesta for MacOS:

Vesta: PortingNotes/MacOs (last edited 2009-03-03 13:43:50 by KenSchalk)