Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Distribute as .zip instead of .dmg #33

Closed
simonw opened this issue Sep 1, 2021 · 9 comments
Closed

Distribute as .zip instead of .dmg #33

simonw opened this issue Sep 1, 2021 · 9 comments
Labels
ci packaging Anything involving making stuff installable

Comments

@simonw
Copy link
Owner

simonw commented Sep 1, 2021

https://twitter.com/tominsam/status/1432892683756867589 and https://daringfireball.net/2009/09/how_should_mac_apps_be_distributed

@simonw simonw added ci packaging Anything involving making stuff installable labels Sep 1, 2021
@simonw simonw added this to the First public installer release milestone Sep 1, 2021
@simonw
Copy link
Owner Author

simonw commented Sep 1, 2021

This is annoying: npm run dist seems to be producing a corrupt zip file:

dist % ls
Datasette-0.1.0-mac.zip		Datasette-0.1.0.dmg		Datasette-0.1.0.dmg.blockmap	builder-debug.yml		builder-effective-config.yaml	latest-mac.yml			mac
dist % unzip Datasette-0.1.0-mac.zip 
Archive:  Datasette-0.1.0-mac.zip
  End-of-central-directory signature not found.  Either this file is not
  a zipfile, or it constitutes one disk of a multi-part archive.  In the
  latter case the central directory and zipfile comment will be found on
  the last disk(s) of this archive.
unzip:  cannot find zipfile directory in one of Datasette-0.1.0-mac.zip or
        Datasette-0.1.0-mac.zip.zip, and cannot find Datasette-0.1.0-mac.zip.ZIP, period.

Bug reported here, but doesn't look like there's a workaround or fix: electron-userland/electron-builder#3779

@simonw
Copy link
Owner Author

simonw commented Sep 1, 2021

Tried this instead:

cd dist/mac
zip -r Datasette.app.zip Datasette.app

But... du -h Datasette.app reports 274MB and ls -lah Datasette.app.zip reports 280MB, so the zip file is bigger not smaller!

@simonw
Copy link
Owner Author

simonw commented Sep 1, 2021

I tried zip -r -9 Datasette.app.zip Datasette.app and got 279MB, still rubbish.

@simonw
Copy link
Owner Author

simonw commented Sep 1, 2021

Well this is weird... right click in the Finder and "Compress Datasette.app" gets me a 118.9MB file:

contextMenu_and_mac_and_mac_—_-zsh_—_80×43_and_mac_—_-zsh_—_255×51

@simonw
Copy link
Owner Author

simonw commented Sep 1, 2021

This worked:

ditto -c -k --sequesterRsrc --keepParent Datasette.app Datasette.app.zip

Gave me a 113MB file. I found that recipe here: https://stackoverflow.com/a/2473201/6083

@simonw
Copy link
Owner Author

simonw commented Sep 1, 2021

I'm going to try without these options:

     --sequesterRsrc
                   When creating a PKZip archive, preserve resource forks and HFS meta-data in the subdirectory
                   __MACOSX.  PKZip extraction will automatically find these resources.

     --keepParent  When creating an archive, embed the parent directory name src in dst_archive.

simonw added a commit that referenced this issue Sep 1, 2021
@simonw
Copy link
Owner Author

simonw commented Sep 1, 2021

Annoyingly that produced a zip of a zip. https://github.com/actions/upload-artifact#zipped-artifact-downloads describes this. See also actions/upload-artifact#39

@simonw
Copy link
Owner Author

simonw commented Sep 1, 2021

Removing --keepParent was a mistake.

simonw added a commit that referenced this issue Sep 1, 2021
@simonw
Copy link
Owner Author

simonw commented Sep 1, 2021

This works well enough now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci packaging Anything involving making stuff installable
Projects
None yet
Development

No branches or pull requests

1 participant