Skip to content

Conversation

fanquake
Copy link
Member

@fanquake fanquake commented Nov 19, 2020

This consolidates our macOS build code so that .DS_Store generation is the same when running make deploy for macOS when building on Linux and macOS, rather than maintaining two version of code that essentially do the same thing (just slightly differently).

It also removes unused code and any AppleScript usage, automates finding translation files and generally simplifies macdeployqtplus. It also gets rid of the annoying "popping up" behaviour during DMG generation, names the created image Bitcoin-Core.dmg rather than Bitcoin-Qt.dmg.

@laanwj
Copy link
Member

laanwj commented Nov 19, 2020

Concept ACK

@DrahtBot
Copy link
Contributor

🐙 This pull request conflicts with the target branch and needs rebase.

Want to unsubscribe from rebase notifications on this pull request? Just convert this pull request to a "draft".

@laanwj
Copy link
Member

laanwj commented Nov 23, 2020

One outstanding issue is that there is either a bug, or a backwards incompatibility with the latest (2.1.0) version of mac_alias:

It's a bug. Looks like they tried to spread the expression over multiple lines but forgot to either add parenthesis around the tuple or \s.

https://github.com/al45tair/mac_alias/blob/master/mac_alias/alias.py#L282

Edit: created an upstream issue dmgbuild/mac_alias#9

@RandyMcMillan
Copy link
Contributor

Concept ACK!

@bitcoin bitcoin deleted a comment Nov 28, 2020
Rather than using OSX_QT_TRANSLATIONS which must be manually updated,
and we forget to update anyway, i.e: bitcoin#19059, automatically find and copy
available translations from the translations directory.
4 different levels of verbosity is overkill for a fairly simple script, which
was always being run at 2 in any case.
We already require Python 3.5 or later
Rather than two lots of logic doing roughly the same thing, dependent on if
you're compiling on Linux or macOS, combine the .DS store generation into
macdeployqtplus.

This also removes the -fancy and -volname options.
@fanquake
Copy link
Member Author

Edit: created an upstream issue dmgbuild/mac_alias#9

Great, thanks. The upstream issue has been resolved with the release of mac_alias 2.1.1. I've added an additional commit to this PR to switch to that version in depends. I've also updated the PR description to remove no-longer-relevant info.

This PR should now be ready for review.

Copy link
Member

@dergoegge dergoegge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK b685f60 - Less and cleaner code looks good. I tested this with make deploy and everything still works + the popup during DMG generation is gone.

@@ -16,9 +16,13 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#

import subprocess, sys, re, os, shutil, stat, os.path, time
from string import Template
import plistlib
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This import was only used by the -fancy option and could also be removed since it is now unused.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. However I'm going to merge this now, and we'll take care of the leftover import shortly.

Copy link
Member

@willcl-ark willcl-ark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK. I don't have an Apple Developer account so can't get the SDK to test with I'm afraid.

@fanquake fanquake merged commit 16b31cc into bitcoin:master Dec 8, 2020
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Dec 8, 2020
@Sjors
Copy link
Member

Sjors commented Dec 10, 2020

Tested (via master) on macOS and it seems to work.

We should add an instruction before make deploy to install the Python dependency:

pip3 install ds_store

@fanquake fanquake deleted the macdeploy_unify branch February 9, 2021 06:35
fanquake added a commit to fanquake/bitcoin that referenced this pull request Jun 9, 2021
random-zebra added a commit to random-zebra/PIVX that referenced this pull request Jun 11, 2021
a68c7d5 depends: mac_alias 2.2.0 (fanquake)
d8e2baf doc: Add explicit macdeployqtplus dependencies install step (Hennadii Stepanov)
013305d macdeploy: use Python 3.6 (fanquake)
faf77c3 macdeploy: remove runHDIUtil in favor of directly calling subprocess.run (fanquake)
8bcfd58 macdeploy: remove existing PIVX-Core.dmg if present (fanquake)
023d3ca macdeploy: move qt_conf to where it's used (fanquake)
7cdb5bb macdeploy: consolidate .DS_Store generation (fanquake)
4da04d7 macdeploy: assume plistlib is available (fanquake)
56ab77a macdeploy: have a single level of logging output (fanquake)
d111cdf macdeploy: remove add-resources argument (fanquake)
4312410 macdeploy: remove codesigning argument (fanquake)
c2ee635 build: automatically determine macOS translations (fanquake)
1c44ecf scripts: filter more qt plugins we don't use in macdeployqtplus (fanquake)
c854f78 scripts: misc cleanups in macdeployqtplus (fanquake)
a3873ea scripts: use format() in macdeployqtplus (fanquake)
a65bea5 scripts: add type annotations to macdeployqtplus (fanquake)
ba179e5 build: Drop macports support (Ben Woosley)

Pull request description:

  This is a companion to PIVX-Project#2272 that focuses on on the `.dmg` creation aspect of macOS builds (ie, `make deploy`). The following upstream PRs are backported here:
   - bitcoin#15175
   - bitcoin#16477
   - bitcoin#20422
   - bitcoin#20890
   - bitcoin#21658

  Also worth mentioning: This drops support for MacPorts entirely, which has been antiquated and un-maintained for quite some time, and never actually used by any PIVX macOS build doc.

ACKs for top commit:
  furszy:
    Tested using depends, ACK a68c7d5.
  random-zebra:
    utACK a68c7d5 and merging...

Tree-SHA512: 3e9fa81a905ca3e90f07ff1213ec69dd1220a19a6a215f256ab67f2594476dc95e8fe88f15a1c9f3314b1757a7a2e5d8e6d7a790d85c117bf4236a3833757430
fanquake added a commit that referenced this pull request Jul 20, 2021
0a5723b macdeploy: cleanup .temp.dmg if present (fanquake)
ecffe86 macdeploy: remove qt4 related code (fanquake)
639f064 macdeploy: select the plugins we need, rather than excluding those we don't (fanquake)
3d26b6b macdeploy: fix framework printing when passing -verbose (fanquake)
dca6c90 macdeploy: remove unused plistlib import (fanquake)

Pull request description:

  This includes [one followup](#20422 (comment)) and [one bug fix](3d26b6b) from #20422, as well as some simplifications to the `macdeployqtplus` code.

ACKs for top commit:
  hebasto:
    ACK 0a5723b, tested on macOS Big Sur 11.4 (20F71, x86_64) + Homebrew's Qt 5.15.2.

Tree-SHA512: cfad9505eacd32fe3a9d06eb13b2de0b6d2cad7b17778e90b503501cbf922e53d4e7f7f74952d1aed58410bdae9b0bb3248098583ef5b85689cb27d4dc06c029
josibake pushed a commit to josibake/bitcoin that referenced this pull request Jul 21, 2021
hebasto pushed a commit to hebasto/gui-qml that referenced this pull request Jul 22, 2021
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Jul 23, 2021
0a5723b macdeploy: cleanup .temp.dmg if present (fanquake)
ecffe86 macdeploy: remove qt4 related code (fanquake)
639f064 macdeploy: select the plugins we need, rather than excluding those we don't (fanquake)
3d26b6b macdeploy: fix framework printing when passing -verbose (fanquake)
dca6c90 macdeploy: remove unused plistlib import (fanquake)

Pull request description:

  This includes [one followup](bitcoin#20422 (comment)) and [one bug fix](bitcoin@3d26b6b) from bitcoin#20422, as well as some simplifications to the `macdeployqtplus` code.

ACKs for top commit:
  hebasto:
    ACK 0a5723b, tested on macOS Big Sur 11.4 (20F71, x86_64) + Homebrew's Qt 5.15.2.

Tree-SHA512: cfad9505eacd32fe3a9d06eb13b2de0b6d2cad7b17778e90b503501cbf922e53d4e7f7f74952d1aed58410bdae9b0bb3248098583ef5b85689cb27d4dc06c029
@hebasto
Copy link
Member

hebasto commented Sep 14, 2021

It appears this PR breaks make deploy on macOS 10.14.6 (18G9323):

$ make deploy
...
created: /Users/hebasto/bitcoin/Bitcoin-Core.temp.dmg
+ Applying fancy settings +
+ Finalizing .dmg disk image +
"disk23" ejected.
hdiutil: convert failed - Resource temporarily unavailable
Traceback (most recent call last):
  File "/Users/hebasto/bitcoin/./contrib/macdeploy/macdeployqtplus", line 687, in <module>
    run(["hdiutil", "convert", tempname, "-format", "UDZO", "-o", appname, "-imagekey", "zlib-level=9"], check=True, universal_newlines=True)
  File "/usr/local/Cellar/python@3.9/3.9.7/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 528, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['hdiutil', 'convert', 'Bitcoin-Core.temp.dmg', '-format', 'UDZO', '-o', 'Bitcoin-Core', '-imagekey', 'zlib-level=9']' returned non-zero exit status 1.
make: *** [Makefile:1282: Bitcoin-Core.dmg] Error 1

Newer macOS versions—10.15 and 11.x—are not affected.

@fanquake
Copy link
Member Author

hdiutil: convert failed - Resource temporarily unavailable

This looks like an intermittent issue, and I would be somewhat surprised if the changes here worked on macOS 10.15 but not 10.14. I don't think there's anything we're doing that would be specific to the OS, or a certain version of a tool, like hdiutil etc.

Does make deploy work on 10.14 with this change reverted? Without any more info there's not a lot to go on here.

@hebasto
Copy link
Member

hebasto commented Sep 16, 2021

Does make deploy work on 10.14 with this change reverted?

Yes, it does.

I think @jarolrod could also confirm such behavior?

I would be somewhat surprised if the changes here worked on macOS 10.15 but not 10.14.

Me too.

janus pushed a commit to BitgesellOfficial/bitgesell that referenced this pull request Oct 29, 2021
@bitcoin bitcoin locked and limited conversation to collaborators Oct 30, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants