From: Claudio Cambra Date: Sat, 22 Jun 2024 08:44:31 +0000 (+0800) Subject: Throw on failure of any shell commands to complete successfully in ma crafter X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~12^2~6^2~129 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=6bca3373211c76d9f87dd596b099530455955131;p=nextcloud-desktop.git Throw on failure of any shell commands to complete successfully in ma crafter Signed-off-by: Claudio Cambra --- diff --git a/admin/osx/mac-crafter/Sources/main.swift b/admin/osx/mac-crafter/Sources/main.swift index 00a282134..28944af4d 100644 --- a/admin/osx/mac-crafter/Sources/main.swift +++ b/admin/osx/mac-crafter/Sources/main.swift @@ -23,6 +23,8 @@ struct MacCrafter: ParsableCommand { enum MacCrafterError: Error { case failedEnumeration(String) case environmentError(String) + case gitError(String) + case craftError(String) } @Argument(help: "Path to the root directory of the Nextcloud Desktop Client git repository.") @@ -100,17 +102,25 @@ struct MacCrafter: ParsableCommand { print("KDE Craft is already cloned.") } else { print("Cloning KDE Craft...") - shell("\(gitCloneCommand) \(craftMasterGitUrl) \(craftMasterDir)") + guard shell("\(gitCloneCommand) \(craftMasterGitUrl) \(craftMasterDir)") == 0 else { + throw MacCrafterError.gitError("Error cloning craftmaster.") + } } print("Configuring Nextcloud Desktop Client blueprints for KDE Craft...") - shell("\(craftCommand) --add-blueprint-repository \(clientBlueprintsGitUrl)") + guard shell("\(craftCommand) --add-blueprint-repository \(clientBlueprintsGitUrl)") == 0 else { + throw MacCrafterError.craftError("Error adding blueprint repository.") + } print("Crafting KDE Craft...") - shell("\(craftCommand) craft") + guard shell("\(craftCommand) craft") == 0 else { + throw MacCrafterError.craftError("Error crafting KDE Craft.") + } print("Crafting Nextcloud Desktop Client dependencies...") - shell("\(craftCommand) --install-deps \(craftBlueprintName)") + guard shell("\(craftCommand) --install-deps \(craftBlueprintName)") == 0 else { + throw MacCrafterError.craftError("Error installing dependencies.") + } } var craftOptions = ["\(craftBlueprintName).srcDir=\(repoRootDir)"] @@ -140,9 +150,11 @@ struct MacCrafter: ParsableCommand { let allOptionsString = craftOptions.map({ "--options \"\($0)\"" }).joined(separator: " ") - shell( + guard shell( "\(craftCommand) --buildtype \(buildType) --compile --install \(allOptionsString) \(craftBlueprintName)" - ) + ) == 0 else { + throw MacCrafterError.craftError("Error crafting Nextcloud Desktop Client.") + } guard let codeSignIdentity else { print("Crafted Nextcloud Desktop Client. Not codesigned.")