also looking at this
fix(packaging): stop macOS packages relocating themselves elsewhere
#46
4 files
+164
-16
| @@ -155,10 +155,21 @@ async function exerciseMacOS(v1: PackageResult[], v2: PackageResult[]): Promise< | ||
| 155 | 155 | const second = requireArtifact(v2, 'pkg') |
| 156 | 156 | const app = '/Applications/craft-lifecycle.app' |
| 157 | 157 | const executable = join(app, 'Contents', 'MacOS', 'craft-lifecycle') |
| 158 | // `installer` can report success and put the payload somewhere else entirely: | |
| 159 | // a package built with bundle relocation enabled is redirected to wherever the | |
| 160 | // system already has that bundle identifier registered. When that happened | |
| 161 | // here the only symptom was `launch` throwing ENOENT, which says nothing about | |
| 162 | // where the app went. The receipt does — `location:` is the path the payload | |
| 163 | // actually landed at — so record it as its own step, into report.json and the | |
| 164 | // uploaded evidence, every time. | |
| 165 | const receipt = (label: string) => command(`receipt after ${label}`, ['pkgutil', '--pkg-info', 'dev.craft.lifecycle']) | |
| 166 | ||
| 158 | 167 | if (existsSync(app)) await command('remove pre-existing fixture', ['sudo', 'rm', '-rf', app]) |
| 159 | 168 | await command('install v1', ['sudo', 'installer', '-pkg', first, '-target', '/']) |
| 169 | await receipt('install v1') | |
| 160 | 170 | await command('launch v1', [executable], 'craft-lifecycle 1.0.0') |
| 161 | 171 | await command('update to v2', ['sudo', 'installer', '-pkg', second, '-target', '/']) |
| 172 | await receipt('update to v2') | |
| 162 | 173 | await command('launch v2', [executable], 'craft-lifecycle 1.0.1') |
| 163 | 174 | for (const step of macOSRollbackPlan(app, 'dev.craft.lifecycle', first)) |
| 164 | 175 | await command(step.name, step.argv) |