homebysix / recipe-robot

A kick ass tool for creating AutoPkg recipes.
Apache License 2.0
299 stars 28 forks source link

Unexpected result when following bitbucket redirect #119

Open arubdesu opened 7 years ago

arubdesu commented 7 years ago

I know there's a pre-existing recipe for this product, I'm trying to add install and pkg flavors by running with --ignore-existing.

Processing https://bitbucket.org/objective-see/deploy/downloads/BlockBlock_0.9.4.zip ...
[WARNING] Could not detect BitBucket description.
Generating munki recipe...
[REMINDER] I couldn't find a description for this app, so you'll need to manually add one to the munki recipe.
    /Users/allister/Library/AutoPkg/Recipe Robot Output/Objective-See, LLC/RansomWhere.munki.recipe
homebysix commented 7 years ago

That output looks good to me — it generated a Munki recipe, but couldn't programmatically determine the description so you'll have to add that manually. (That's not uncommon.)

Throw a --verbose on there and you'll get a little more information:

Processing https://bitbucket.org/objective-see/deploy/downloads/BlockBlock_0.9.4.zip ...
Input path looks like a BitBucket URL.
Getting BitBucket repo...
    BitBucket repo is: objective-see/deploy
Getting app name...
    App name is: Deploy
    BitBucket owner full name is: patrick wardle
Getting BitBucket description...
[WARNING] Could not detect BitBucket description.
Getting information from latest BitBucket release...
    BitBucket release download format is: zip
    BitBucket release download URL is: https://api.bitbucket.org/2.0/repositories/objective-see/deploy/downloads/RansomWhere_1.1.0.zip
    Download URL is: https://api.bitbucket.org/2.0/repositories/objective-see/deploy/downloads/RansomWhere_1.1.0.zip
Downloading file for further inspection...
    Downloaded to /Users/elliot/Library/Caches/Recipe Robot/2016-12-08_10-13-37_681254/RansomWhere_1.1.0.zip
Determining download format...
    File extension is zip
Opening downloaded file...
    Successfully unarchived zip
Validating app...
    App seems valid
Getting app name...
    App name is: RansomWhere
Getting bundle identifier...
    Bundle identifier is: com.objectiveSee.RansomWhere
Checking for a Sparkle feed...
    No Sparkle feed
Looking for version key...
    Version key is: CFBundleShortVersionString (1.1.0)
Looking for app icon...
    App icon is: /Users/elliot/Library/Caches/Recipe Robot/2016-12-08_10-13-37_681254/unpacked/RansomWhere.app/Contents/Resources/AppIcon
Getting app description from MacUpdate...
Gathering code signature information...
    Code signature verification requirements recorded
    3 authority names recorded
    Developer: Objective-See, LLC
Generating munki recipe...
[REMINDER] I couldn't find a description for this app, so you'll need to manually add one to the munki recipe.
    /Users/elliot/Library/AutoPkg/Recipe Robot Output/Objective-See, LLC/RansomWhere.png
    /Users/elliot/Library/AutoPkg/Recipe Robot Output/Objective-See, LLC/RansomWhere.munki.recipe
Generating install recipe...
    /Users/elliot/Library/AutoPkg/Recipe Robot Output/Objective-See, LLC/RansomWhere.install.recipe
Generating download recipe...
    /Users/elliot/Library/AutoPkg/Recipe Robot Output/Objective-See, LLC/RansomWhere.download.recipe
Generating pkg recipe...
    /Users/elliot/Library/AutoPkg/Recipe Robot Output/Objective-See, LLC/RansomWhere.pkg.recipe

You've now created 4366 recipes with Recipe Robot. Isn't meta-automation great?

At this point, the next step would be to take the install and pkg recipes and change their ParentRecipe to the existing download recipe (com.github.jps3.download.RansomWhere), and then shift processors/arguments as necessary.

EDIT: I see now that it generated recipes for a totally different app. I'll go get some coffee and let you know what I find after. ;-)

homebysix commented 7 years ago

OK, I see the issue. Recipe Robot expects BitBucket repositories to contain downloads for a single app, but Objective-See is using a single repository to host downloads for multiple apps. Therefore, the assumption made here is incorrect:

Getting BitBucket repo...
    BitBucket repo is: objective-see/deploy

In this case, Recipe Robot should treat the URL you provided as a simple zip download, rather than trying to be clever about the fact that it contains bitbucket.org. Fortunately, there's a way to do that, outlined here: https://github.com/homebysix/recipe-robot/issues/98#issuecomment-216584831

Basically, download the zip you want and provide the path to that zip as input for Recipe Robot. That should at least get you the right app. (Whether or not the resulting AWS download URL is valid is up to you to determine.)

I think you also discovered a bug, which is that the Versioner and CodeSignatureVerifier processors are set to use the app's name, even if the actual filename differs (i.e. BlockBlock vs BlockBlock_Installer). For most apps, they're identical, but not for BlockBlock.

Now, I notice that zip file contains an installer app, so the next problem you see will be that Recipe Robot assumes that app should go into your Applications folder when installed. That's wrong, and will require manual rewriting. Recipe Robot offers you moral support there, but not much else. :-)

homebysix commented 6 years ago

Not exactly a fix, but the latest change (8672ddb) should warn if a BitBucket or GitHub repo URL contains "download," since there's some ambiguity about how such URL can be processed. I think treating the URL as a repo is the right method, though, since download URLs are version specific and there's no guarantee we'll find a Sparkle feed in the app bundle.